I'm programming with Keil uVision 4.
I have some code like this:
sbit X = P3 ^ 3; // X is third bit of P3 register
...
while (1) {
X = !X; // X equals not X ?!
if (X == 0)
printf("0");
else
printf("1");
}
I can control `P3^3
generic input pin, because on this pin i've got a PIR (pulse infrared sensor). It gives me 1 on that line when it is blinking, 0 when it is sleeping.
when P3^3
is pulled-up to 1
,
output is (as expected) 10101010101010..
When it is still to 0,
output is (as not expected) 0000000000000..
The behaviour I'm obtaing is that I described above, considering that sbit X
is setted/unsetted by PIR..
So the question is, what is the meaning of the operator !
in the Keil C51 compiler?