Hello
In simulation the (0x869f) is incorect >> (0x1869F)
Regards Wolfgang
long variable
Moderator: Benj
-
- Posts: 714
- Joined: Wed Jan 31, 2007 12:41 pm
- Has thanked: 1 time
- Been thanked: 26 times
- JonnyW
- Posts: 1230
- Joined: Fri Oct 29, 2010 9:13 am
- Location: Matrix Multimedia Ltd
- Has thanked: 63 times
- Been thanked: 290 times
- Contact:
Re: long variable
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
It might be a problem with the variable view, possibly?
Cheers,
Jonny
-
- Posts: 714
- Joined: Wed Jan 31, 2007 12:41 pm
- Has thanked: 1 time
- Been thanked: 26 times
Re: long variable
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
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
- Attachments
-
- sample_long_var.rar
- (212.48 KiB) Downloaded 322 times
- JonnyW
- Posts: 1230
- Joined: Fri Oct 29, 2010 9:13 am
- Location: Matrix Multimedia Ltd
- Has thanked: 63 times
- Been thanked: 290 times
- Contact:
Re: long variable
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
Cheers,
Jonny
-
- Posts: 714
- Joined: Wed Jan 31, 2007 12:41 pm
- Has thanked: 1 time
- Been thanked: 26 times
Re: long variable
He Jonny
Thanks for answer.You have any idea why "long variable xyz << 16" not work on my hardware?
Regards Wolfgang
Thanks for answer.You have any idea why "long variable xyz << 16" not work on my hardware?
Regards Wolfgang
- JonnyW
- Posts: 1230
- Joined: Fri Oct 29, 2010 9:13 am
- Location: Matrix Multimedia Ltd
- Has thanked: 63 times
- Been thanked: 290 times
- Contact:
Re: long variable
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
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
-
- Posts: 714
- Joined: Wed Jan 31, 2007 12:41 pm
- Has thanked: 1 time
- Been thanked: 26 times
Re: long variable
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
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
- Attachments
-
- long var other way.gif
- 1 time << 8 and 1 time << 8 inside the load line...
- (30.04 KiB) Downloaded 1465 times
-
- long var.gif
- 2 times << 8 than load
- (30.19 KiB) Downloaded 1465 times
- JonnyW
- Posts: 1230
- Joined: Fri Oct 29, 2010 9:13 am
- Location: Matrix Multimedia Ltd
- Has thanked: 63 times
- Been thanked: 290 times
- Contact:
Re: long variable
Glad you got it sorted. It does sound like a HW/compiler issue, but its good there is a workaround.
Jonny
Jonny