Mitsubishi Electronics FX2C Home Theater Server User Manual


 
FX Series Programmable Controlers Applied Instructions 5
5-11
5.1.5 FEND (FNC 06)
Operation:
An FEND instruction indicates the first end of a main pro
g
ram and the start of the pro
g
ram
area to be used for subroutines. Under normal operatin
g
circumstances the FEND instruction
performs a similar action to the END instruction, i.e. output processin
g
, input processin
g
and
watchdo
g
timer refresh are all carried out on execution.
Points to note:
a) The FEND instruction is commonl
y
used with CJ-P-FEND, CALL-P-SRET and I-IRET
pro
g
ram constructions (P refers to pro
g
ram pointer, I refers to interrupt pointer).
Both CALL pointers/subroutines and interrupt pointers (I) subroutines are ALWAYS
pro
g
rammed after an FEND instruction, i.e. these pro
g
ram features NEVER appear in the
bod
y
of a main pro
g
ram.
b) Multiple occurrences of FEND instructions can be used to separate different subroutines
(see dia
g
ram above).
c) The pro
g
ram flow constructions are NOT allowed to be split b
y
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 pro
g
ram
block
N/A
Note:
Can be used with CJ (FNC 00), CALL (FNC 01)
and interrupt routines
FEND:
1 step
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