Comparison instructions include CMP (compare) and ZCP (interval) b.
(1) compare CMP (d) CMP (p) order number is FNC10, and the source operand [S1.] And the source operand [S2.] Compared, the comparison with target element [d.] Expressed in the State. As shown in Figure 3-33, when X1 is switched on, the constant 100 compared to the current value of C20, compare the results into the M0~M2. X1 to OFF does not perform, M0~M2 ‘s status also remains unchanged.
(2) compare ZCP (d) ZCP (p) order number is FNC11, source operand instruction execution time [s.] The [S1.] And [S2.] Compare the contents of, and compare the results to send to the destination operand [d.] In the. As shown in Figure 3-34, when X0 is ON, compared to the current value of the K100 and K120 C30, will deliver results, M3, M4 and M5. X0 is OFF, the ZCP does, M3, M4, M5, unchanged.
Compare CMP/ZCP should be used note:
1)[S1.]、[S2.] Any data format, destination operand [d.] Y, m, and s.
2) when using the ZCP, [S2.] The value cannot be less than [S1.]
3) all sources of data is treated as binary values;