Chapter 6 Applied Instructions
6-28
API
Instruction code
Operand
Function
0057 FZCP P
S
1
, S
2
, S, D
Floating-point zone comparison
Device
X Y M S T C HC D W L Bm SM
SR E PR
K 16# “$“ DF
Pulse instruction
32-bit instruction (9-12 steps) 64-bit instruction
AH500 AH500
Symbol:
S
1
Minimum value of the zone
comparison
Double word
S
2
Maximum value of the zone
comparison
Double word
S
Comparison value 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 floating-point 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 FZCP.
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 greater 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 be ON. If the compared value in S
2
is less than the value in S, D+2 will be ON.
Example:
1. If the operand D is M0, the comparison results will be stored in M0, M1 and M2.
2. When X0.0 is ON, the instruction FZCP is executed. M0, M1, or M2 is ON. When X0.0 is OFF,
the instruction FZCP 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.
Additional remark:
1. If the value in S
1
or S
2
or S exceeds the range of values which can be represented by the
floating-point numbers, the contact is OFF, SM is ON, and the error code in SR0 is 16#2013.
2. If users declare the operand D in ISPSoft, the data type will be ARRAY [3] of BOOL.
3. If D+2 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.