FX
/FX
/FX
Series Programmable Controllers
3G
3U
3UC
Programming Manual - Basic & Applied Instruction Edition
36.3.2
Examples of practical programs (programs to measure short pulse width)
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 1 ms or 0.1 ms units.
1. Example of program to measure the short pulse width using a retentive type 1ms timer
24V
0V
ex:FX
PLC(sink input)
3U
Step
0
Interrupt
pointer
M8000
I001
X010
Interrupt
pointer
X010
I100
M8000
810
SW
S/S X000 X001
When the rising edge of
X000 is detected
RST
T246
RST
RST
T246
K32767
FNC 03
IRET
When the falling edge of
X001 is detected
FNC 12
M0V
SET
M0
K1
T246
RST
T246
FNC 03
IRET
END
36.3 Input Interrupt (Interrupt Triggered by External Signal) [Without Delay Function]
X010:Preparation
for measurement
SW(X000,X001)
Interrupts are enabled by the EI instruction.
FNC 04
The main program is described.
EI
The main program is finished by the FEND
FNC 06
instruction.
FEND
The reset
When X000 turns ON, the 1 ms timer
status is
A
T246 is started up by the interrupt I001.
cleared
M0
D0
Timer is driven
Measurement data
When X001 turns OFF, the current value
T246
D0
of T246 is transferred to the data register
D0 for storing the measured value by the
interrupt I100, and M0 for the complete
Measurement
M0
signal is set to ON.
is completed
Timer is stopped
"T246" is set to OFF, and the timer is
stopped.
Timer is
B
reset
36 Interrupt Function and Pulse Catch Function
This period of time is measured.