I need to know what is wrong with uVision. I had not seen this before.
I wrote this piece of code in uVisio, the program is not working well. When I simulated it, I realized the compiler is not doing the right process:
void Write_LCD(unsigned int A ){ unsigned int E; E=0xf0&A; //here is the problem*** LCD_Data=e; ... }
in ***, E=0xf0&A, the compiler does not execute the ligical operation AND, it passes the value of A to E and when I put parenthesis, this is E=(0xf0&A); it puts 0x00 to the variable E. I wonder what is wrong with this instruction?
Thanks for your help.
LCD_Data = 0xF0 & A;
This Could be valid code. It is less likely that you found a compiler bug in a common statement. Post the smallest amount of code that shows the problem. Copy and Paste it. This avoids new bugs, and you correcting any bugs during the retyping.
By the way if you want the upper nibble
LCD_Data = A >> 4;
would be a better choice
LCD_Data = 0xF0 & A; first, although somewhat irrelevant (and should be valid) I have never before seen the above. All I know of writes LCD_Data = A & 0xf0; which is more like what you would say
Post ... code Copy and Paste it. and it should be commented
Erik
I can not recall hoiw many threads have gone astray because the 'bug' discussed was in the retype, not in the code in question