Processor: 8051 (AT89LP4052)
for (i=0; i<8; i++){ if ((P1 >> i) & 1){ //if the channel is high (idle) P1mask &= ~(1 << i); //clear the bit chan_counter[i] = 0xFF; //reset the channel counter } }
In the debugger, when added to the Watch1 ((P1 >> i) & 1) shows 0 correctly when I switch off the port1 pins; but the code inside the {} still runs!
I can't figure out why this is not working. Another part of my code I am using
if ((P1 | P1mask) == 0xFF) {
and it works fine.
Any tips on getting this if statement to work? Thanks!