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

Скачать
Страница из 382
FX Series Programmable Controlers
Applied Instructions 5
5-9
5.1.4
IRET, EI, DI
(FNC 03, 04, 05)
General description of an interrupt routine:
An interrupt routine is a section of program which is, when triggered, operated immediately
interrupting the main program flow. Once the interrupt has been processed the main program
flow continues from where it was, just before the interrupt originally occurred.
Operation:
Interrupts are triggered by different input conditions, sometimes a direct input such as X0 is
used other times a timed interval e.g. 30 msec can be used. The availability of different
interrupt types and the number operational points for each PLC type are detailed on page 4-
12, Interrupt Pointers. To program and operate interrupt routines requires up to 3 dedicated
instructions (those detailed in this section) and an interrupt pointer.
Defining an interrupt routine:
An interrupt routine is specified between its own
unique interrupt pointer and the first occurrence of an
IRET instruction.
Interrupt routines are ALWAYS programmed after an
FEND instruction.
The IRET instruction may only be used within
interrupt routines.
Mnemonic
Function 
Operands
Program steps
D
IRET
FNC 03
(Interrupt
return)
Forces the
program to return
from the active
interrupt routine
N/A
Automatically returns to the main program step 
which was being processed at the time of the 
interrupt call.
IRET:
1 step
EI
FNC 04
(Enable
interrupts)
Enables interrupt 
inputs to be pro-
cessed 
N/A
Any interrupt input being activated after an EI 
instruction and before FEND or DI instructions 
will be processed immediately unless it has 
been specifically disabled.
EI:
1 step
DI
FNC 05
(Disable
interrupts)
Disables the
processing of
interrupt routines
N/A
Any interrupt input being activated after a DI 
instruction and before an EI instruction will be 
stored until the next sequential EI instruction is 
processed.
DI:
1 step
I
(Interrupt
pointer)
Identifies the
beginning of an
interrupt routine
A 3 digit numeric code relating to the interrupt 
type and operation.
I
:
1 step
FX
0(S)
FX
0N
FX FX
(2C)
FX
2N(C)
FEND
I001
IRET 
IRET 
I201
Interrupt Program I001
Interrupt Program I201