3. Instructions
282
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Precautions
• When ZCPS(117)/ZCPSL(118) is executed, the result is reflected in the Arithmetic Flags. Control the
desired output or right-hand instruction with a branch from the same input condition that controls
ZCPS(117)/ZCPSL(118), as shown in the following diagram.
• Do not program another instruction between ZCPS(117)/ZCPSL(118) and the instruction controlled
by the Arithmetic Flag because the other instruction might change the status of the Arithmetic Flag.
Example Programming
• When CIO 0.00 is ON in the following example, the 16-bit signed binary data in D0 is compared to the
range FFF6 to 0064 hex (−10 to 100 decimal) and the result is output to the Arithmetic Flags.
• CIO 20.00 is turned ON if −10 decimal ≤ content of D0 ≤ 100 decimal. CIO 20.01 is turned ON if the
content of D0 > 100 decimal. CIO 20.02 is turned ON if the content of D0 < −10 decimal.
A
ZCPS
CD
LL
UL
Arithmetic Flag
Example: P_EQ
If LL ≤ CD ≤ UL, P_EQ turns ON
and A turns ON.
In this case, the results of instruction B
might change the results of ZCPS(117)/ZCPSL(118).
A
ZCPSL
CD
LL
UL
Arithmetic Flag
Example: P_EQ
Instruction
B
20.00
0.00
P_GT
20.01
P_EQ
20.02
P_LT
ZCPS
D0
−10
+100
CD
LL
UL
Arithmetic Flags
≤
≤
D0
LL CD UL
= ON(1)
D0
> ON(1)
D0
< ON(1)
>
>
−10
100
100
−10