FX Series Programmable Controlers Applied Instructions 5
5-12
5.1.5 FEND (FNC 06)
Operation:
An FEND instruction indicates the first end of a main program and the start of the program
area to be used for subroutines. Under normal operating circumstances the FEND instruction
performs a similar action to the END instruction, i.e. output processing, input processing and
watchdog timer refresh are all carried out on execution.
Points to note:
a) The FEND instruction is commonly used with CJ-P-FEND, CALL-P-SRET and I-IRET
program constructions (P refers to program pointer, I refers to interrupt pointer).
Both CALL pointers/subroutines and interrupt pointers (I) subroutines are ALWAYS
programmed after an FEND instruction, i.e. these program features NEVER appear in the
body of a main program.
b) Multiple occurrences of FEND instructions can be used to separate different subroutines
(see diagram above).
c) The program flow constructions are NOT allowed to be split by an FEND instruction.
d) FEND can never be used after an END instruction.
Mnemonic Function
Operands
Program steps
D
FEND
FNC 06
(First end)
Used to indicate
the end of the
main program
block
N/A
Note:
CanbeusedwithCJ(FNC00),CALL(FNC01)
and interrupt routines
FEND:
1step
FX
1S
FX1N FX2N
FX2NC
FEND
X10
P 20CJ
FEND
FEND
X11
P 21CJ
END END
P20 P21
0
0
I100
Main program
Main program
Main program Main program
Subroutine
Main program
Main program
Interrupt prog'
X10
=
OFF
X10
=
ON
X11
=
ON
X11
=
OFF