im using 8051 and had a problem writing a code to interface the LED using serial port interface.Im using the I/O controller.the problem is when i ON the LED it light all the 7 leds.There is 7 output port. i try to use a bitwise as to ON the LED of bit 0: if((c&0x01)=='0'){ OPORT=0x00;}
else if(c=='1') { OPORT=0xff; }
thanks
The expression (c & 0x01) can only yield the value 0 or 1, and since the value of the ASCII character '0' is 0x30, neither 0 nor 1 will ever equal '0'.