Mitsubishi Electronics FXCPU Video Game Controller User Manual


 
35 Interrupt Function and Pulse Catch Function
800
FXCPU Structured Programming Manual
[Basic & Applied Instruction]
35.3 Input Interrupt (Interrupt Triggered by External Signal) [Without Delay Function]
7. Program example
1) When using both an external input interrupt at the rising edge and the output refresh (REF instruction)
In the program example shown below, the output Y000 immediately turns ON when the rising edge of the
external input X000 is detected.
*1. Be sure to specify a multiple of "8" for the number of inputs/outputs to be refreshed by REF instruction.
If any value other than a multiple of "8" is specified, an operation error occurs and REF instruction is
not executed.
2) When using both an input interrupt and the input refresh (REF instruction)
In the program example shown below, an interrupt is executed using the latest input information.
*1. Be sure to specify a multiple of "8" for the number of inputs/outputs to be refreshed by REF instruction.
If any value other than a multiple of "8" is specified, an operation error occurs and REF instruction is
not executed.
EI
EN ENO
M8000
Y000
REF
EN
d
n
ENO
RUN
monitor
Y000
K8
*1
Interrupts are enabled by EI instruction.
The main program is described.
When an interrupt routine is executed by turning
ON of X000, Y000 is reset unconditionally.
The outputs Y000 to Y007 are overwritten with the
latest information by the output refresh instruction.
If the output refresh instruction is not provided, Y000
turns ON after END instruction after the program
execution returned to the main routine.
If "SET Y000" is changed to "RST Y000", Y000 is
immediately set to OFF by turning ON of X000.
SET
EN ENO
d
When the rising edge
of X000 is detected
[Main program]
[Interrupt program]
(Event: I001)
EI
EN ENO
M8000
Y001
REF
EN
d
n
ENO
RUN
monitor
X010
K8
*1
Interrupts are enabled by EI instruction.
The main program is described.
When an interrupt routine is executed by turning X001
to ON, the input refresh is executed unconditionally,
and the ON/OFF information of X010 to X017 at the
current time is received.
SET
EN ENO
d
RST
EN ENO
d
X010
X010
Y001
Y001 is set to ON or OFF according to the ON/OFF
status of X010.
When the rising edge
of X001 is detected
[Main program]
[Interrupt program]
(Event: I101)