IDEC FC4A-C10R2 User Manual page 141

Fc4a series microsmart micro programmable logic controller
Table of Contents

Advertisement

Example: Interrupt Input
The following example demonstrates a program of using the interrupt input function, with input I2 designated as an inter-
rupt input. When the interrupt input is turned on, the input I0 status is immediately transferred to output Q0 using the
IOREF (I/O refresh) instruction before the END instruction is executed. For the IOREF instruction, see page 18-5.
MOV(W)
S1 –
M8120
Main Program
M8125
M300
M8125
Notes for Using Interrupt Inputs and Timer Interrupt:
When using an interrupt input or timer interrupt, separate the interrupt program from the main program using the END
instruction at the end of the main program.
When an interrupt program calls another subroutine, a maximum of 3 subroutine calls can be nested. If more than 3 calls
are nested, a user program execution error occurs, turning on special internal relay M8004 and the ERR LED.
When using an interrupt input or timer interrupt, include the label number of the interrupt program to be executed when an
interrupt occurs. The label numbers stored in data registers D8032 through D8036 specify the interrupt programs for
interrupt inputs I2 through I5 and timer interrupt, respectively.
When more than one interrupt input or timer interrupt is turned on at the same time, interrupt program execution is given
priority to inputs I2, I3, I4, timer interrupt, and I5, in that order. If an interrupt is initiated while another interrupt program
is executed, the subsequent interrupt program is executed after the prior interrupt is completed. Multiple interrupt pro-
grams cannot be executed simultaneously.
When a communication function is used, such as data link, the interrupt program size must be limited to the executable
time listed in the table below.
Communication Function
Not Used
Used
Used
If the interrupt program is longer than the value listed above, the entire system performance is affected. The timer and fil-
ter functions may not operate correctly, and communication error may be caused in the data link or communication with
display units. Make sure that the interrupt program execution time is within the values listed above, referring to the execu-
tion times on page A-1. When using high-speed counters, the interrupt program size has to be much smaller.
When using the data link and interrupt inputs, select 19200 bps for the baud rate of the data link communication.
Make sure that the execution time of the interrupt program is shorter than interrupt intervals sufficiently.
Interrupt programs cannot use the following instructions: SOTU, SOTD, TML, TIM, TMH, TMS, CNT, CDP, CUD, SFR, SFRN,
ROOT, WKTIM, WKTBL, DISP, DGRD, TXD1/2, RXD1/2, DI, EI, XYFS, CVXTY, CVYTX, PULS1/2, PWM1/2, RAMP, ZRN1/2,
PID, DTML, DTIM, DTMH, DTMS, and TTIM.
The overhead from interrupt occurrence to interrupt program execution is approximately 60 µs. When using the high-speed
counter, the overhead may be extended.
D1 –
REP
0
D8032
END
LABEL
0
IOREF
S1
I0
Q0
IOREF
S1
Q0
LRET
Baud Rate (bps)
1200, 2400, 4800, 9600
« FC4A M
M8120 is the initialize pulse special internal relay.
D8032 stores 0 to designate jump destination label 0 for interrupt input
I2.
The interrupt program is separated from the main program by the END
instruction.
When input I2 is on, program execution jumps to label 0.
M8125 is the in-operation output special internal relay.
IOREF immediately reads input I0 status to internal relay M300.
M300 turns on or off the output Q0 internal memory.
Another IOREF immediately writes the output Q0 internal memory status
to actual output Q0.
Program execution returns to the main program.
Insert LRET at the end of the subroutine to return to the main program.
19200
S
U
'
M
ICRO
MART
SER
S
ANUAL
5: S
Executable Time of Interrupt Program (µs)
670 maximum
670 maximum
170 maximum
»
F
PECIAL
UNCTIONS
5-21

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents