Chapter 6 Applied Instructions Symbol S 1 : Minimum value of the zone comparison S 2 : Maximum value of the zone comparison S : Comparison value 6_ Explanation D : Comparison result 1. This instruction compares the floating-point numbers in S and S 1 , and compare the floating-point numbers in S with that in S 2 , and then stores the results 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 is the maximum/minimum value during the execution of the FZCP instruction. 3. The operand D occupies three 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 , D is ON. If the value in S is between the value in S 1 and the value in S 2 , D +1 is ON. If the compared value in S 2 is less than the value in S , D +2 is ON. Example 1. If the operand D is M0, the comparison results are stored in M0, M1 and M2. 2. When M0 is ON, the FZCP instruction is executed. M10, M11, or M12 is ON. When M0 is OFF, the FZCP instruction is not executed, and the state of M10, the state of M11, and the state of M12 remain unchanged. 3. If you want to clear the comparison result, use the RST or ZRST instruction.
6-31 API Instruction code Operand Function 0057 FZCP P S1,S2,S,D Floating-point zone comparison Device X Y M S T C HC D FR SM SR E K 16# “$” F S1 S2 S D BOOL WORD DWORD LWORD UINT INT DINT LINT REAL LREAL TMR CNT STRING Data type S1 S2 S D Pulse Instruction 16-bit instruction 32-bit instruction ES3 - ES3