Delta AH500 — 6.1.2 Explanation of Comparison Instructions

AH500 Programming Manual API 0054 Symbol: S 1 : Comparison value 1 Word/Double word S 2 : Comparison value 2 Word/Double word D : Comparison result Bit Explanation: 1. The instruction is used to compare the value in S 1 with that in S 2 , and the values compared are singed decimal numbers. The comparison results are stored in D . 2. The operand D occupies three consecutive devices. The comparison results are stored in D , D +1, and D +2. If the comparison value in S 1 is greater than the comparison value in S 2 , D will be ON. If the comparison value in S 1 is equal to the comparison value in S 2 , D +1 is ON.

If the comparison value in S 1 is less than the comparison value in S 2 , D +2 will be ON. 3. Only the instructions D CMP and D CMPP can use the 32-bit counter. Example: 1. If the operand D is M0, the comparison results will be stored in M0, M1 and M2, as shown below. 2. When X0.0 is ON, the instruction CMP is executed. M0, M1, or M2 is ON. When X0.0 is OFF, the execution of the instruction CMP stops. The state of M0, the state of M1, and the state of M1 remain unchanged . 3. If users want to clear the comparison result, they can use the instruction RST or ZRST.

6-23 Instruction code Operand Function D CMP P S , S , D 1 2 Comparing the values Device X Y M S T C HC D L SM SR E PR K 16# “$” DF S 1             S 2             D         Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps) AH500 AH500 AH500