Delta AH500 — 6.1.2 Explanation of Comparison Instructions

AH500 Programming Manual API 0055 Symbol: S 1 : Minimum value of the zone comparison Word/Double word S 2 : Maximum value of the zone comparison Word/Double word S : Comparison value Word/Double word D : Comparison result Bit Explanation: 1. The instruction is used to compare the value in S with that in S 1 , and compare the value in S with that in S 2 . The values compared are singed decimal numbers, and the comparison results are stored in D . 2. The value in S 1 must be less than that in S 2 . If the value in S 1 is larger than that in S 2 , S 1 will be taken as the maximum/minimum value during the execution of the instruction ZCP. 3. 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 less than the comparison value in S , D will be ON. If the comparison value in S is within the range between the value in S 1 and the value in S 2 , D +1 will ON. If the comparison value in S is greater than the value in S 2 , D +2 will be ON. 4. Only the instructions D ZCP and D ZCPP 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 ZCP is executed. M0, M1, or M2 is ON. When X0.0 is OFF, the instruction ZCP is not executed.

The state of M0, the state of M1, and the state of M2 remain the same as those before X0.0’s being OFF. 3. If users want to clear the comparison result, they can use the instruction RST or ZRST. 6-25 Instruction code Operand Function D ZCP P S , S , S, D 1 2 Zone comparison Device X Y M S T C HC D L SM SR E PR K 16# “$” DF S 1             S 2             S             D         Pulse instruction 16-bit instruction (9 steps) 32-bit instruction (9 steps) AH500 AH500 AH500