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.
I'm having problems with the following simple line of code and was wondering if I could get a little insight as to what the problem may be..
My code..
My variables SystemStatus is declared as a unsigned int.
And MODEFAIL_BITS is equal to 0x0110.
Here is the simple line of cdoe.. The casts to UINT16 were added to try to solve the problem but were in vain.
if ((UINT16)SystemStatus & (UINT16)MODEFAIL_BITS) { ..Print out some stuff and set a flag. }
This compiles to the following.
; SOURCE LINE # 2776 015C E500 E MOV A,SystemStatus+01H 015E 5410 ANL A,#010H 0160 FF MOV R7,A 0161 7401 MOV A,#01H 0163 4F ORL A,R7 0164 603B JZ ?C0394
Which gives the wrong answer.. In my particular case
SystemStatus is 0x4000 MODEFAIL_BITS is 0x0110
The answer I get is 0x0100.. Looking at the assembly code I can see why I get that answer.. but looking at my C code I can;t see why I'm getting that assembly code..
Any ideas or suggestions are greatly appreciated... Thanks..
Seems a bit related to this thread: http://www.keil.com/forum/docs/thread13145.asp
Might be time to contact Keil support.
By the way: Have you verified that sizeof(SystemStatus)is 2?