## Binary OR Operation

The binary OR operation has two inputs and one output. It is like the ADD operation which takes two arguments (two inputs) and produces one result (one output).

The inputs to a binary OR operation can only be 0 or 1 and the result can only be 0 or 1

The binary OR operation (also known as the binary OR function) will always produce a 1 output if either of its inputs are 1 and will produce a 0 output if both of its inputs are 0.

If we call the inputs A and B and the output C we can show the OR function as:

 A B C 0 OR 0 -> 0 0 OR 1 -> 1 1 OR 0 -> 1 1 OR 1 -> 1

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

If we OR two 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 the OR function on two corresponds bits of the input

i.e.

 A7 A6 A5 A4 A3 A2 A1 A0 B7 B6 B5 B4 B3 B2 B1 B0 C7 C6 C5 C4 C3 C2 C1 C0
So if we have two binary numbers 00100100 and 00100001 we can see the effect of ORing these two sets of 8 bits in parallel.
e.g.
 argument 1 0 0 1 0 0 1 0 0 argument 2 0 0 1 0 0 0 0 1 result 0 0 1 0 0 1 0 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 OR 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, the value 0x21 to the variable K which is the hexadecimal equivalent of the binary value 00100001 and then perform the XCSB OR operation on J and K and assign the result to M. The value stored in M will be 0x25 which is the hexadecimal equivalent of the binary value 00100101

Written as XCSB source code this would be:

```	J = 0x24
K = 0x21
M = J | K
```