Omron FQM1-CM001 User Manual

Page of 414
145
Input Interrupts
Section 7-3
7-3-6
Application Example
This example shows input interrupt 0 and input interrupt 1 used in interrupt
input mode and counter mode, respectively.
Before executing the program, verify that the following System Setup settings
have been made: input 0 and input 1 both set to Interruption (up). The other
System Setup settings are set to their default settings.
P_On (Always ON)
P_First_Cycle
0002.00
END
CLC
END
0002.00
MOV
#000A
A521
@CLI
#0000
#0001
@CLI
#0001
#0001
@MSKS
#0000      
#0000
@MSKS
#0001       
#0002
@MSKS
#0001       
#0001
@MSKS
#0000       
#0001
ADB
       A521
     #000A
       A521
MSKS
       #0001
     #0002
Interrupt 
task 0
Interrupt 
task 1
(ON for the first cycle)
The SV of input interrupt 1 counter 
mode operation is set to 10 in 4-digit 
hexadecimal (000A).
When CIO 0002.00 is ON, the 
following instructions are executed.
When CIO 0002.00 is OFF, MSKS(690) 
masks input interrupts 0 and 1 and 
disables those interrupts.
Interrupt task 000 is called when 
there is an interrupt from input 
interrupt 0, 10 is added to the 
counter SV for input interrupt 1 (the 
SV increases to 20), and the 
counter is refreshed.
(1) Clears any masked interrupts 
for input interrupts 0 and 1.
(2) Enables interrupts by input 
interrupt 0 in Input interrupt 
mode.
(3) Enables interrupts by input 
interrupt 1 in counter mode. 
(The counter SV is 10 decimal.)
When input interrupt 1 counts down 
to 0, interrupt task 001 is called and 
executed.