Mitsubishi Electronics FXCPU Video Game Controller User Manual


 
35 Interrupt Function and Pulse Catch Function
806
FXCPU Structured Programming Manual
[Basic & Applied Instruction]
35.5 Timer Interrupt (Interrupt in Constant Cycle)
6. Program example
In the program example shown below, data is added and addition result is compared with the set value at
every 10 ms.
1) Program example
35.5.2 Example of practical program (timer interrupt program using instruction)
RAMP, HKY, SEGL, ARWS and PR 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 instruction
EI
EN ENO
M3
Interrupts are enabled by EI instruction.
The main program is described.
When the current value of D0 reaches "1000", M3 is reset.
M3
SET
EN ENO
d
X001
INC
EN ENO
d
LD-EQ
EN
s1
s2
ENO
RST
EN ENO
d
K1000
D0
M3
D0
When M3 is set to ON, INC instruction becomes valid.
"1" is added to the current value of D0 at every 10 ms.
The current value of D0 is ramp data which changes from
"0" to "1000" in 10 seconds.
In the program example using RAMP instruction shown
later, the ramp data is made using a dedicated instruction.
When interrupt is
given at every 10 ms
[Main program]
[Interrupt program]
(Event: I610)
EI
EN ENO
Interrupts are enabled by EI instruction.
The main program is described.
M8000
HKY
EN
s
ENO
d1
d3
d2
Y000
D0
M0
X000
REF
EN
d
n
ENO
X000
K8
REF
EN
d
n
ENO
Y000
K8
[Main program]
[Interrupt program]
(Event: I620)