790
FX
3U
/FX
3UC
Series Programmable Controllers
Programming Manual - Basic & Applied Instruction Edition
35 Interrupt Function and Pulse Catch Function
35.3 Input Interrupt (Interrupt Triggered by External Signal) [Without Delay Function]
35.3.2
Examples of practical programs (programs to measure short pulse width)
1. Example of program to measure the short pulse width using input interrupt
By using a 1 ms retentive type timer or the special data register D8099 (high speed ring counter), the short
pulse width can be measured in units of 1 ms or 0.1 ms.
The figure below shows an example of FX
3U
PLC (sink input).
0V
S/S
X000 X001
SW
PLC
This period of time is measured.
X010: Preparation
for measurement
SW(X000,X001)
24V
Step
0
I001
Interrupt
pointer
M8000
X010
K32767
I100
Interrupt
pointer
When the falling edge of
X001 is detected
X010
M0
K1
M8000
Reset image
is reset
Timer is driven
Measurement
is completed
Timer is stopped
Timer is
reset
Measurement data
When the rising edge of
X000 is detected
FNC 04
EI
FNC 06
FEND
T246
FNC 03
IRET
FNC 12
M0V
T246
FNC 03
IRET
END
T246
D0
SET
M0
RST
T246
RST
T246
RST
M0
RST
D0
Interrupts are enabled by EI instruction.
The main program is described.
The main program is finished by FEND
instruction.
When X000 turns ON, the 1 ms timer
T246 is started up by the interrupt I001.
When X001 turns OFF, the current value
of T246 is transferred to the data register
D0 for storing the measured value by the
interrupt I100, and M0 for the complete
signal is set to ON.