Delta Electronics — 6.1.2 Explanation of Comparison Instructions

Chapter 6 Applied Instructions Symbol S1 : Comparison value1 S2 : Comparison value2 D : Comparison result 6_ Explanation 1. These instructions compare the single decimal numbers in S 1 and S 2 and store the comparison results in D . 2. The operand D occupies 3 consecutive devices. The comparison results are stored in D , D +1, and D +2. If the value in S 1 is greater than the value in S 2 , D is ON. If the value in S 1 is equal to the value in S 2 , D +1 is ON. If the value in S 1 is less than the value in S 2 , D +2 is ON. 3. Only the DCMP and DCMPP instructions can use the 32-bit counter, but not the device E. Example 1.

If the operand D is M0, the comparison results are stored in M0, M1 and M2, as shown below. 2. When X0.0 is ON, the CMP instruction is executed. M0, M1, or M2 is ON. When X0.0 is OFF, the execution of the CMP instruction stops and the state of M0, the state of M1, and the state of M1 remain unchanged. 6-25 API Instruction code Operand Function 0054 D CMP P S1,S2,D Comparing values Device X Y M S T C HC D FR SM SR E K 16# “$” F S1            S2            D     BOOL WORD DWORD LWORD UINT INT DINT LINT REAL LREAL TMR CNT STRING Data type S1        S2        D  Pulse Instruction 16-bit instruction 32-bit instruction AS AS AS