Skip to main content

6.1.3.5.3 XOR

Function

Perform an "XOR" operation on the values ​​of IN1...INn according to binary bits, and output the result at OUT

LD Graphics

alt text

Parameter description

Interface variableDeclarationData typeDescription
IN1Var_InputANY_BITOperand
IN2Var_InputANY_BITOperand
OUTVar_OutputANY_BITOutput result
warning
  • XOR is an extensible function, and inputs can be added by clicking the "+" in the graph
  • IN1...INn data types need to be consistent and the same as OUT
  • ANY_BIT data types include BYTE, WORD, DWORD, and LWORD
  • ST language operator: XOR

Example

Perform an "XOR" operation on bit 0 of the value input to IN1 and bit 0 of the value input to IN2. The result is stored in bit 0 of the output OUT. The same logical operation is performed on all other bits of the specified value. As shown in the figure below, the result of 15 "XOR" 36 is 43

Operandvalue
IN10000 1111
IN20010 0100
OUT0010 1011

alt text