The binaryXOR(exclusiveOR) operation has two inputs and one output. It is like theADDoperation which takes two arguments (two inputs) and produces one result (one output).The inputs to a binary

XORoperation can only be0or1and the result can only be0or1The binary

XORoperation (also known as the binaryXORfunction) will always produce a1output if either of its inputs is1and will produce a0output if both of its inputs are0or1.If we call the inputs

AandBand the outputCwe can show theXORfunction as:

ABC0XOR0->00XOR1->11XOR0->11XOR1->0The PIC machine code

XORinstruction operates on 8 sets of inputs and outputs in parallel.If we

XORtwo input bytes together 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 theXORfunction on two corresponds bits of the inputi.e.

So if we have two binary numbers

A_{7}A_{6}A_{5}A_{4}A_{3}A_{2}A_{1}A_{0}B_{7}B_{6}B_{5}B_{4}B_{3}B_{2}B_{1}B_{0}C_{7}C_{6}C_{5}C_{4}C_{3}C_{2}C_{1}C_{0}00100100and00100001we can see the effect ofXORing these two sets of 8 bits in parallel.e.g.

argument 1 00100100argument 2 00100001result 00000101The input bits

Aand_{5}Band the output bit_{5}Care here shown in red_{5}The input bits

Aand_{2}Band the output bit_{2}Care here shown in green_{2}The input bits

Aand_{1}Band the output bit_{1}Care here shown in yellow_{1}The input bits

Aand_{0}Band the output bit_{0}Care here shown in blue_{0}In XCSB the binary

XORoperator works in the same way, operating in parallel on sets of inputs and outputs within a variable or constant.If we assign the value

0x24to the variableJ, which is the hexadecimal equivalent of the binary value00100100, the value0x21to the variableKwhich is the hexadecimal equivalent of the binary value00100001and then perform the XCSBXORoperation onJandKand assign the result toM. The value stored inMwill be0x05which is the hexadecimal equivalent of the binary value00000101Written as XCSB source code this would be:

J = 0x24 K = 0x21 M = J ^ K