The binaryANDoperation 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

ANDoperation can only be0or1and the result can only be0or1The binary

ANDoperation (also known as the binaryANDfunction) will always produce a1output if both of its inputs are1and will produce a0output if one or both of its inputs are0.If we call the inputs

AandBand the outputCwe can show theANDfunction as:

ABC0AND0->00AND1->01AND0->01AND1->1The PIC machine code

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

ANDtwo 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 theANDfunction 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 ofANDing these two sets of 8 bits in parallel.e.g.

argument 1 00100100argument 2 00100001result 00100000The 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

ANDoperator 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 XCSBANDoperation onJandKand assign the result toM. The value stored inMwill be0x20which is the hexadecimal equivalent of the binary value00100000Written as XCSB source code this would be:

J = 0x24 K = 0x21 M = J & K