Chapter 5 Instruction Specifications

5-104

Syntax of JMP, CJMP

LBL 2
JMP 1
JMP 1
LBL 7
JMP 2
LBL 3
END
SB
JMP 3
LBL 2
JMP 4
RTS
SB
LBL 4
JMP 5
LBL 6
PTS
INTO
JMP 6
LBL 5
JMP 7
LBL 1
RTI
JMP 5
A]
B] LBL 5
LBL 5
JMP 0
JMP 1
JMP 2
LBL 1
LBL 0
JMP 3
LBL 2
JMP 4
LBL 3
LBL 4
LBL 0
CJMP1(X00000)
JMP 0
LBL 1
JMP 5
JMP 5
CJMP 5
LBL 5
JMP 0
Program A
Program C
Program B
X00000 X00001
X00002
X00003
LBL 0
X00000
X00001
JMP 1
LBL 1
TD0
0.1s
100
X00000
X00001
JMP 1
MCS0
LBL 2
X00002 Y00100
MCR0
Program
Program

1] LBL n with the same code number as the code

number n of the JMP instruction is required.

If JMP 1 is executed when there
is no LBL 1, an LBL undefined
error occurs. JMP 1 will do
nothing and execute the next
processing of program A.

6] An overlap of JMP instructions with the same code

number is valid.

Program A
Program B

2] Jump is not permitted to outside the area in which the JMP

instruction resides. 7] A startup condition can be programmed with respect to

JMP instructions.

When the JMP 1 instruction
is executed, since LBL 1 is
not in the normal scan area,
a "jump outside the area"
error will be generated. The
JMP 1 instruction will do
nothing and execute the next
processing of program.
JMP 2 to JMP 7 perform
similar processing.
If a jump is performed
from JMP 0 to LBL 0,
programs A, B and C
will not be executed.

3] Code number n of the JMP instruction and the LBL n with

the same code number may not be overlapped.

8] The CJMP instruction also follows the same syntax as 1]

through 7].

Note 1: When a JMP instruction jumps to LBL, the status

of each I/O between JMP and LBL is retained.

However, the timer progress value will be updated.

In the pre-operation process, the
label instructions A] and B] have 5
as the code numbers, so a duplicate
definition error will occur.
If X00000 turns on after
X00001 turns on, the
progress value of TD0 will
be updated even if a jump
is performed from JMP 1
to LBL 1. If X00000
remains on, TD0 will not
turn on even if its progress
value exceeds 100.

4] Nesting of JMP instructions is allowed.

5] The JMP instruction can jump to a location before the

instruction itself.

Note 2: If the JMP instruction is used in conjunction with

the MCS or MCR instruction, the following actions

will result, so exercise caution when programming.

Note 3: Do not create a circuit that jumps to outside from

between MCS and MCR.

When JMP 2 does not
jump, Y00100 will turn on
when X00001 and X00002
are both on.
When JMP 2 does jump, if
X00000 is on, Y00100 will
follow the on/off of
X00002 regardless of the
on/off of X00001.
JMP 0 will jump to LBL 0, which is a
location before the JMP instruction.
When input X00000 turns on, the loop
between LBL 0 and JMP 0 is escaped
by jumping from CJMP 1 (X00000) to
LBL 1.
If there is no instruction as CJMP 1
(X00000) to escape from the loop, the
loop from LBL 0 to JMP 0 will
continue endlessly.
Program head
Normal scan area
Subroutine area
Subroutine area
Interrupt scan area
Startup condition
CJMP n (s)