Binary NOT Operation

The binary NOT operation has one input and one output. It is like the NEGATIVE operation which takes one argument (one input) and produces one result (one output).

The input to a binary NOT operation can only be 0 or 1 and the result can only be 0 or 1

The binary NOT operation (also known as the binary NOT function or complement function or bit invert function) will always produce a 1 output if its input is 0 and will produce a 0 output if its input is 1.

If we call the input A and the output B we can show the NOT function as:

 A B
NOT 0->1
NOT 1->0

The PIC machine code NOT instruction operates on 8 sets of inputs and outputs in parallel.

If we NOT an input byte on the PIC we get an output byte. If we give each bit within a byte a number we can see that each bit in the output is the result of the NOT function on the corresponds bit of the input

i.e.

  A7 A6 A5 A4 A3 A2 A1 A0
  B7 B6 B5 B4 B3 B2 B1 B0
So if we have a binary numbers 00100100 we can see the effect of NOTing these 8 bits in parallel.
e.g.
argument 1 0 0 1 0 0 1 0 0
result 1 1 0 1 1 0 1 1

The input bits A5 and B5 and the output bit C5 are here shown in red

The input bits A2 and B2 and the output bit C2 are here shown in green

The input bits A1 and B1 and the output bit C1 are here shown in yellow

The input bits A0 and B0 and the output bit C0 are here shown in blue

In XCSB the binary NOT operator works in the same way, operating in parallel on sets of inputs and outputs within a variable or constant.

If we assign the value 0x24 to the variable J, which is the hexadecimal equivalent of the binary value 00100100, and then perform the XCSB NOT operation on J and assign the result to M. The value stored in M will be 0xDB which is the hexadecimal equivalent of the binary value 11011011

Written as XCSB source code this would be:

	J = 0x24
	M = ~J