Mitsubishi — 5.6 Descriptions of the Applied Instructions

Chapter 5 Applied Instructions  D 1 : Value which is interchanged; D 2 : Value which is interchanged  The instruction is used to interchange the value in D 1 with the value in D 2 .  It is suggested that users should use the pulse instruction XCHP. Explanation Example  When X0.0 is turned from OFF to ON, the value in D20 is interchanged with the value in D40. X0.0 XCHP D20 D40 Before the instruction is executed After the instruction is executed D20 120 40 D20 D40 D40 40 120 Additional remark  16-bit instruction: If D 1 is the same as D 2 , and SM303 is ON, the high 8 bits are interchanged with the low 8 bits.  32-bit instruction:

If D 1 is the same as D 2 , and SM303 is ON, the high 16 bits are interchanged with the low 16 bits.  When X0.0 is ON, and SM303 is ON, the high 8 bits in D100 are interchanged with the high 8 bits in D101, and the low 8 bits in D100 are interchanged with the low 8 bits in D101.

Before the instruction is executed After the instruction is executed X0.0 SM303 D100 Low 9 8 D100 Low DXCHP D100 High 20 40 D100 High D101 Low 8 9 D101 Low D101 High 40 20 D101 High 5-35 API Instruction code Operand Function 17 D XCH P D , D 1 2 Interchanging values Device Xn.n Yn.n M S K 16# F KnM KnS D W T C V Z D 1         D 2         Pulse instruction 16-bit instruction (5 steps) 3 2-bit instruction (5 steps)    D100 D101