3. Instructions
1068
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Example Programming
The following example shows two different
block programs controlled by CIO 0.00 and
CIO 0.02.
The first block executes one of two additions
depending on the status of CIO 0.01. This
block is executed when CIO 0.00 is ON. If CIO
0.01 is ON, 1 is added to the contents of CIO
1. If CIO 0.01 is OFF, 2 is added to the
contents of CIO 1. In either case, the result is
placed in D0.
The second block is executed when CIO 0.02 is
ON and shows nesting two levels. If CIO 0.03
and CIO 0.04 are both ON, the contents of CIO
1200 and CIO 2 are added and the result is
placed in D10 and then 0001 is moved into D11
based on the status of CY. If either CIO 0.03 or
CIO 0.04 is OFF, then the entire addition
operation is skipped and CIO 3.01 is turned
ON.
+B(404)
ELSE(803)
+B(404)
IEND(804)
BEND(801)
IF(802)
+B(404)
MOV(030)
IEND(804)
ELSE(803)
IF(802)
1
#0001
D0
1
#0002
D0
LD
AND
1200
2
D10
CY
IF(802)
#0001
D11
SET(016)
IEND(804)
BEND(801)
0.00
0.02
0
1
0.01
0.03
0.04
3.01
Coding
Address Instruction Operands
000200 LD 0.00
000201 BPRG(096) 0
000202 IF(802) 0.01
000203 +B(404) ---
1
#0001
D0
000204 ELSE(803) ---
000205 +B(404) ---
1
#0002
D0
000206 IEND(804) ---
000207 BEND(801) ---
000208 LD 0.02
000209 BPRG(096) 1
000210 LD 0.03
000211 AND 0.04
000212 IF(802) ---
000213 +B(404) ---
1200
2
D10
000214 IF(802) A50004
000215 MOV(030) ---
#0001
D11
000216 IEND(804) ---
000217 ELSE(803) ---
000218 SET(016) 3.01
000219 IEND(804) ---
000220 BEND(801) ---