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.
Sirs,
I am trying to compare a register value to a hex code value as shown below:
if(P0 == 0xAA) { P0 = 0x00; } else if(P0 == 0x00) { P0 = 0xAA; }
in my code, I have it declared as:
sfr P0 = 0x80;
and initialized as:
P0 = 0x00;
Currently, the value of P0 is 0x00. Unfortunately, it isn't entering the else if loop as I would expect (so my program isn't setting P0 to 0xAA). I'm guessing it's because I am handling a register value incorrectly or can't compare a register value to a hex code. I'm guessing it's probably a pretty simple fix or there is a better approach to this. Can you help me understand what I am doing incorrectly? Thanks!