We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
When I write the following in uVision,
mov A, -2000
I want A to contain 0x30, as -2000 is 0xF830. Instead it contains 0x05. Is there any predefined macro to be able to treat a literal as sixteen bits and extract the lower (or upper) eight bits out of it?
Thanks.
Actually it does make sense to cram -2000 into TL registers sure, but then why do you post mov a,...
anyhow this
#define NEG_VAL -2000 #define POS_VAL 2000 mov a,#LOW (NEG_VAL) mov a,#HIGH (NEG_VAL) mov a,#LOW (-POS_VAL) mov a,#HIGH (-POS_VAL) mov a,#LOW (-2000) mov a,#HIGH (-2000)
Gives
0092 7430 607 mov a,#LOW (-2000) 0094 74F8 608 mov a,#HIGH (-2000) 0096 7430 609 mov a,#LOW (-2000) 0098 74F8 610 mov a,#HIGH (-2000) 009A 7430 611 mov a,#LOW (-2000) 009C 74F8 612 mov a,#HIGH (-2000)
what is the problem? I guess that like so many others (including myself) you are periodically blind to a missing '#' Erik
It's working now. I had to move some code that _should_ have caused a memory conflict error during compilation, but didn't.
ya, wonder what time you get to your job or work,