Program branching instructions, Label (label), Ljmp (label jump) – IDEC MicroSmart User Manual
Page 315: Label (label) -1 ljmp (label jump) -1, Rogram, Ranching, Nstructions
« FC4A M
ICRO
S
MART
U
SER
’
S
M
ANUAL
»
18-1
18: P
ROGRAM
B
RANCHING
I
NSTRUCTIONS
Introduction
The program branching instructions reduce execution time by making it possible to bypass portions of the program when-
ever certain conditions are not satisfied.
The basic program branching instructions are LABEL and LJMP, which are used to tag an address and jump to the address
which has been tagged. Programming tools include “either/or” options between numerous portions of a program and the
ability to call one of several subroutines which return execution to where the normal program left off.
The DI or EI instruction disables or enables interrupt inputs and timer interrupt individually.
LABEL (Label)
Applicable CPU Modules
Valid Operands
LJMP (Label Jump)
Applicable CPU Modules
Valid Operands
For the valid operand number range, see pages 6-1 and 6-2.
Since the LJMP instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction
should be used as required.
Note:
Make sure that a LABEL instruction of the label number used for a LJMP instruction is programmed. When designating
S1 using other than a constant, the value for the label is a variable. When using a variable for a label, make sure that all
probable LABEL numbers are included in the user program. If a matching label does not exist, a user program execution
error will result, turning on special internal relay M8004 and the ERR LED on the CPU module.
FC4A-C10R2/C
FC4A-C16R2/C
FC4A-C24R2/C
FC4A-D20K3/S3
FC4A-D20RK1/RS1 & FC4A-D40K3/S3
X
X
X
X
X
Operand
Function
I
Q
M
R
T
C
D
Constant
Repeat
Label number
Tag for LJMP and LCAL
—
—
—
—
—
—
—
0-127
—
FC4A-C10R2/C
FC4A-C16R2/C
FC4A-C24R2/C
FC4A-D20K3/S3
FC4A-D20RK1/RS1 & FC4A-D40K3/S3
X
X
X
X
X
Operand
Function
I
Q
M
R
T
C
D
Constant
Repeat
S1 (Source 1)
Label number to jump to
—
—
—
—
—
—
X
0-127
—
This is the label number, from 0 to 127, used at the program address where the execution of pro-
gram instructions begins for a program branch.
An END instruction may be used to separate a tagged por tion of the program from the main pro-
gram. In this way, scan time is minimized by not executing the program branch unless input condi-
tions are satisfied.
Note: The same label number cannot be used more than once.
LABEL
***
When input is on, jump to the address with label 0 through 127 designated by S1.
When input is off, no jump takes place, and program execution proceeds with the next
instruction.
The LJMP instruction is used as an “either/or” choice between two por tions of a program.
Program execution does not return to the instruction following the LJMP instruction, after
the program branch.
LJMP
S1
*****