Mitsubishi Electronics FX3G User Manual

Page of 964
815
FX
3S
/FX
3G
/FX
3GC
/FX
3U
/FX
3UC
 Series
Programming Manual - Basic & Applied Instruction Edition
36 Interrupt Function and Pulse Catch Function
36.5 Timer Interrupt (Interrupt in Constant Cycle)
31
FNC277
-F
NC2
79
Da
ta
 
Trans
fer 3
32
FNC28
0-F
NC
289
H
igh-Speed 
Process
ing 2
33
FNC2
90-
FNC299
Ex
tensi
on Fi
le
 
Register C
ontrol
34
FN
C300-
FNC30
5
FX
3U
-C
F-
AD
P
35
SFC
•STL
Programming
36
Interrupt 
Function
37
Sp
ec
ia
l D
evi
ce
38
E
rror Code
A
Ve
rsi
on U
Inform
ati
on
B
Ex
ecuti
on
 T
imes
6. Program example
→ For program examples in which RAMP (FNC 67) or HKY (FNC 71) instructions are combined,
refer to Subsection 36.5.2.
In the program example shown below, data is added and the addition result is compared with the set value every 10
ms.
1) Program example
36.5.2 Examples of practical program (timer interrupt programs using applied instruction)
RAMP (FNC 67), HKY (FNC 71), SEGL (FNC 74), ARWS (FNC 75) and PR (FNC 77) instructions execute a series of
operations in synchronization with the scan time.
Because the total time may be too long or time fluctuation may cause a problem in these instructions, it is
recommended to execute these instructions at a constant time interval using the timer interrupt function.
When not using the timer interrupt function, use the constant scan mode.
1. Timer interrupt processing of HKY (FNC 71) instruction
→ For HKY (FNC 71) instruction, refer to Section 15.2.
Step
0
I610
Interrupt
pointer
When interrupt is
given at every 10 ms
M3
X001
FNC 04
EI
FNC 06
FEND
FNC 24
INC
FNC224
LD=
FNC 03
IRET
END
SET
M3
D0
K1000
D0
RST
M3
Interrupts are enabled by EI instruction.
The main program is described.
When M3 is set to ON, INC (FNC 24)
instruction becomes valid.
The main program is finished by FEND
instruction.
"1" is added to the current value of D0 at
every 10 ms.
When the current value of D0 reaches
"1000", M3 is reset.
The current value of D0 is ramp data 
which changes from "0" to "1000" in 10
seconds.
In the program example using RAMP 
(FNC 67) instruction shown later, the ramp 
data is made using a dedicated applied 
instruction.
Step
0
I620
Interrupt
pointer
When interrupt is given every 20 ms
M8000
RUN
monitor
FNC 04
EI
FNC 06
FEND
FNC 50
REF
FNC 71
HKY
FNC 03
IRET
FNC 50
REF
END
Y000
K8
X000
Y000
D0
M0
K8
X000
Interrupts are enabled by EI instruction.
The main program is described.
The main program is finished by FEND
instruction.
The latest input information is received
from X000 to X007.
HKY (FNC 71) is executed in one scan.
Y000 to Y007 are refreshed to the latest
output information.