Bitwise XOR XOR

Dest gets the bits that differ between A and B.

TagAfter two scans
BitsChanged6
BitsLast10
BitsNow12

How it works

While the rung is true, each bit of Dest is on where A and B differ. A false rung changes nothing.

How it's used

Use XOR to find which bits changed since the last scan.

TagValue
InputsNow12
InputsLast12
Changed6

Bits 1 and 2 changed, so Changed is 6. InputsLast already shows 12 because the MOV below ran in this scan.

Operands

OperandData typeRead or write
ADINT or a numberReads
BDINT or a numberReads
DestDINTWrites

Common mistakes

  • Expecting bits on in both to stay onXOR turns a bit on only where A and B differ.