Chapter 5 Instruction Specifications

Syntax of JMP, CJMP

1] LBL n with the same code number as the code number n of the JMP instruction is required.

JMP 1

• If JMP 1 is executed when there

Program A

is no LBL 1, an LBL undefined

error occurs. JMP 1 will do

LBL 2

nothing and execute the next

Program B

processing of program A.

 

6] An overlap of JMP instructions with the same code number is valid.

JMP 5

JMP 5

CJMP 5

LBL 5

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.

CJMP n (s)

Program head

Normal scan area

JMP 1

LBL 7

 

JMP 2

 

LBL 3

 

END

 

SB

 

JMP 3

Subroutine area

LBL 2

 

JMP 4

 

RTS

 

SB

 

LBL 4

Subroutine area

JMP 5

 

LBL 6

 

PTS

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.

Startup condition

X00000 X00001

X00002

JMP 0

Program A

Program B

X00003

Program C

LBL 0

If a jump is performed from JMP 0 to LBL 0, programs A, B and C will not be executed.

INTO

Interrupt scan area JMP 6

LBL 5

JMP 7

LBL 1

RTI

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.

JMP 5

In the pre-operation process, the

A]

LBL 5

label instructions A] and B] have 5

B]

LBL 5

as the code numbers, so a duplicate

definition error will occur.

4] Nesting of JMP instructions is allowed.

JMP 0

JMP 1

X00000

JMP 1

X00001TD0

LBL 1

0.1s

100

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.

JMP 2 LBL 1 LBL 0 JMP 3 LBL 2

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.

JMP 4

LBL 3

LBL 4

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

X00000

 

 

JMP 1

 

 

 

 

 

 

 

Program

 

 

 

MCS0

X00001

 

 

 

 

Program

 

 

 

 

 

 

 

 

 

 

LBL 2

 

 

 

 

 

X00002

Y00100

• 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

LBL 0 CJMP1(X00000) JMP 0

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

MCR0

follow the on/off of

X00002 regardless of the

on/off of X00001.

LBL 1

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.

Note 3: Do not create a circuit that jumps to outside from between MCS and MCR.

5-104

Page 154
Image 154
Hitachi NJI-350B manual Syntax of JMP, Cjmp, Nesting of JMP instructions is allowed, 104