I use Keil C and my hardware need CPL P3.0 command No problem in asm, but i need it in C. b1 = P3^0; b1^=1; not work :( after compiling i have MOV c,b1 CPL c MOV b1,c but i need exactly one command "CPL b1" Anyone can help?
Do this for regular bit data: B1 = !B1; For Port bits, you can use the predifined name or assign a new name. Example: TXD = !TXD; ... or sbit NewName = 0xB1; NewName = !NewName; The above method will produce what you're looking for.
The bitwise operator in C for complementing one or more bits is "~". So,
b1 = ~b1;