Page 1 of 1

long variable

Posted: Sun Feb 05, 2012 8:26 pm
by saschech@gmx.de
Hello
In simulation the (0x869f) is incorect >> (0x1869F)

Regards Wolfgang

Re: long variable

Posted: Sun Feb 05, 2012 9:16 pm
by JonnyW
Hi Wolfgang. Can you post your program for this please, or some sample code? It seems to be a 16 bit value that is displayed but I cant get any code from the annotation in the screen-shot.

It might be a problem with the variable view, possibly?

Cheers,

Jonny

Re: long variable

Posted: Sun Feb 05, 2012 10:40 pm
by saschech@gmx.de
Hi Jonny

A long time I experiment a "long variable" e.g. ..settime[1] 99999 = 3 byte 159,134,1 in the F_RAM to save and build back.

I read back to the three byte-variable and want build the value 99999 back without success.
In simulation it work ok but on my hardware the value is (without the 1 = 65535) 34463.
If i go the way >> if....then it work on my hardware but show 99998
("0 to 0xffff" the code work ok)

Hope You can help

Nice evening and regards Wolfgang

Re: long variable

Posted: Mon Feb 06, 2012 11:40 am
by JonnyW
Hi Wolfgang. The error is a cosmetic one in the debug variable view window. The decimal value should be right but the hex is cropped to 16 bits. This will be fixed int he release.

Cheers,

Jonny

Re: long variable

Posted: Mon Feb 06, 2012 1:37 pm
by saschech@gmx.de
He Jonny

Thanks for answer.You have any idea why "long variable xyz << 16" not work on my hardware?

Regards Wolfgang

Re: long variable

Posted: Mon Feb 06, 2012 1:50 pm
by JonnyW
Hi. At a guess, this is probably a limitation of the HW.

A lot of instruction sets store the constant shift to perform in as small an area as possible, and it is likely that this is 4 bits for an 8-bit device. This means that the shift wraps and shifting by 16 (0x10) will actually shift by 0, and shifting by 21 (0x15) will shift by 5, etc. If I remember right Windows compilers have the same issue with shifts of 32 and above.

You could test this and probably work-around it by assigning 16 to a variable and shifting by that var:
shift = 16
value = value << shift

Keep us posted if this works.

Jonny

Re: long variable

Posted: Mon Feb 06, 2012 3:06 pm
by saschech@gmx.de
Hi Jonny

shift = 16
value = value << shift I test without success;show the same.

suggest for a new way,I do "dummi_long << 8" for two times and load with the result ; works fine on my hardware!
Thanks for your help!!!!!!
I test it two way`s it work also.....Hurra

Regards Wolfgang

Re: long variable

Posted: Mon Feb 06, 2012 3:10 pm
by JonnyW
Glad you got it sorted. It does sound like a HW/compiler issue, but its good there is a workaround.

Jonny