Chapter 5 Applied Instructions S 1 : Source device 1; S 2 : Source device 2 The instruction is used to compare the value in S 1 with that in S 2 . If the comparison result is not 0, the condition of the instruction is met. If the comparison result is 0, the condition of the instruction is not met. The instruction LD# can be connected to a busbar directly. Explanation &: Logical AND operation |: Logical OR operation ^: Logical exclusive OR operation If a 32-bit counter is used, the 32-bit insturciton DLD# must be used. If a 32-bit counter and the 16-bit instruction LD# are used, ,a program error will occur, and the ERROR LED indicator on the motion control module will blink.
(C200~C255 are 32-bit counters.) A logical AND operator takes the values in C0 and C10, and performs the logical AND operation on each pair of corresponding bits. If the operation result is not 0, Y1.0 will be ON. A logical OR operator takes the values in D200 and D300, and performs the logical OR operation on each pair of corresponding bits. If the operation result is not 0 and X0.1 is ON, Y1.1 will be set to ON. A logical operator XOR takes the values in C240 and C241, and performs the logical exclusive OR operation on each pair of corresponding bits. If the operation result is not 0, or if M3 is ON, M50 will be ON.
Example C10 Y1.0 D300 X0.1 M3 C241 M50 5-109 API Instruction code Operand Function 215~217 D LD# S , S 1 2 Logical operation Device Xn.n Yn.n M S K 16# F KnM KnS D W T C V Z S 1 S 2 Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (7 steps) – API No. 16-bit 32-bit ON OFF instruction instruction 215 LD& DLD& S 1 & S 2 ≠0 S 1 & S 2 = 0 216 LD| DLD| S 1 | S 2 ≠0 S 1 | S 2 = 0 217 LD^ DLD^ S 1 ^ S 2 ≠0 S 1 ^ S 2 = 0 LD & C0 LD I D200 SET Y1.1 DLD^ C240