Справочник Пользователя для Mitsubishi Electronics FX2NC

Скачать
Страница из 382
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 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:
Can be used with CJ (FNC 00), CALL (FNC 01)
and interrupt routines
FEND:
1 step
FX
0(S)
FX
0N
FX FX
(2C)
FX
2N(C)
FEND
X10
P 20
CJ
FEND
FEND
X11
P 21
CJ
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