5: S
PECIAL
F
UNCTIONS
« FC4A M
ICRO
S
MART
U
SER
’
S
M
ANUAL
»
5-23
Example: Timer Interrupt
The following example demonstrates a program of using the timer interrupt function. The Function Area Settings must
also be completed to use the timer interrupt function as described on the preceding page.
Notes for Using Timer Interrupt and Interrupt Inputs:
•
When using a timer interrupt or interrupt input, 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 a timer interrupt or interrupt input, 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.
•
If the interrupt program is longer than the value listed above, the entire system per formance 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 shor ter than interrupt inter vals 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.
•
If the interrupt program execution time exceeds 670 µs when using the timer interrupt, a user program execution error
occurs, turning on special internal relay M8004 and the ERR LED.
•
The overhead from interrupt occurrence to interrupt program execution is approximately 60 µs. When using the high-speed
counter, the overhead may be extended.
Communication Function
Baud Rate (bps)
Executable Time of Interrupt Program (µs)
Not Used
—
670 maximum
Used
1200, 2400, 4800, 9600
670 maximum
Used
19200
170 maximum
M8120 is the initialize pulse special internal relay.
D8036 stores 0 to designate jump destination label 0 for timer interrupt.
The interrupt program is separated from the main program by the END
instruction.
While the CPU is running, program execution jumps to label 0 repeatedly
at inter vals selected in the Function Area Settings.
Each time the interrupt program is completed, program execution returns
to the main program at the address where timer interrupt occurred.
Inser t LRET at the end of the subroutine to return to the main program.
LABEL
0
M8120
END
Main Program
REP
S1 –
0
D1 –
D8036
MOV(W)
LRET
Interrupt Program
Summary of Contents for FC4A-C10R2
Page 1: ...FC4A SERIES Micro Programmable Logic Controller User s Manual FC9Y B812 ...
Page 6: ...PREFACE 4 FC4A MICROSMART USER S MANUAL ...
Page 94: ...2 MODULE SPECIFICATIONS 2 74 FC4A MICROSMART USER S MANUAL ...
Page 184: ...6 ALLOCATION NUMBERS 6 20 FC4A MICROSMART USER S MANUAL ...
Page 218: ...8 ADVANCED INSTRUCTIONS 8 8 FC4A MICROSMART USER S MANUAL ...
Page 240: ...11 BINARY ARITHMETIC INSTRUCTIONS 11 8 FC4A MICROSMART USER S MANUAL ...
Page 244: ...12 BOOLEAN COMPUTATION INSTRUCTIONS 12 4 FC4A MICROSMART USER S MANUAL ...
Page 252: ...13 SHIFT ROTATE INSTRUCTIONS 13 8 FC4A MICROSMART USER S MANUAL ...
Page 274: ...15 WEEK PROGRAMMER INSTRUCTIONS 15 8 FC4A MICROSMART USER S MANUAL ...
Page 378: ...22 DUAL TEACHING TIMER INSTRUCTIONS 22 4 FC4A MICROSMART USER S MANUAL ...
Page 386: ...23 INTELLIGENT MODULE ACCESS INSTRUCTIONS 23 8 FC4A MICROSMART USER S MANUAL ...
Page 408: ...24 ANALOG I O CONTROL 24 22 FC4A MICROSMART USER S MANUAL ...
Page 426: ...26 COMPUTER LINK COMMUNICATION 26 6 FC4A MICROSMART USER S MANUAL ...