32.13.4.4 Confirming Execution Results - XCH/XCHP

Program Example

XCH

Exchanges the contents of Data_1 and Data_2.

  1. When the positive transition instruction turns ON, the XCH instruction will be executed. When the XCH instruction is executed, the summary of the Data_1[0] in D1 and the Data_2[0]in D2 will be switched.
    When using a normally-open instruction, as long as the instruction variable is ON, the XCH instruction is always executed.

Array Variable Name

Data 1

Instruction Execution

Data 2

Element

Data_1[0]

←→

Data_2[0]

Data_1[1]

 

Data_2[1]

Data_1[2]

 

Data_2[2]

Data_1[3]

 

Data_2[3]

Data_1[4]

 

Data_2[4]

XCHP

  1. When the positive transition instruction turns ON, the XCHP instruction will be executed. When the XCHP instruction is executed, the summary of the Data_1[0] in D1 and the Data_2[0]in D2 will be switched.
    Even when the operation is a normally open instruction, the XCHP instruction will execute only when an upward transition is detected.
    As a result, even if the instruction is always on, the XCHP instruction is executed only for one scan.