Mitsubishi Electronics FX2C Home Theater Server User Manual


 
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 pro
g
ram which is, when tri
gg
ered, operated immediatel
y
interruptin
g
the main pro
g
ram flow. Once the interrupt has been processed the main pro
g
ram
flow continues from where it was,
j
ust before the interrupt ori
g
inall
y
occurred.
Operation:
Interrupts are tri
gg
ered b
y
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 availabilit
y
of different
interrupt t
y
pes and the number operational points for each PLC t
y
pe are detailed on pa
g
e 4-
12, Interrupt Pointers. To pro
g
ram 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 pro
g
rammed after an
FEND instruction.
The IRET instruction ma
y
onl
y
be used within
interrupt routines.
Mnemonic Function
Operands
Program steps
D
IRET
FNC 03
(Interrupt
return)
Forces the
pro
g
ram to return
from the active
interrupt routine
N/A
Automaticall
y
returns to the main pro
g
ram step
which was bein
g
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
An
y
interrupt input bein
g
activated after an EI
instruction and before FEND or DI instructions
will be processed immediatel
y
unless it has
been specificall
y
disabled.
EI:
1 step
DI
FNC 05
(Disable
interrupts)
Disables the
processin
g
of
interrupt routines
N/A
An
y
interrupt input bein
g
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
be
g
innin
g
of an
interrupt routine
A 3 di
g
it numeric code relatin
g
to the interrupt
t
y
pe and operation.
I
:
1 step
FEND
I001
IRET
IRET
I201
Interrupt Program I001
Interrupt Program I201