Справочник Пользователя для Mitsubishi Electronics FXCPU

Скачать
Страница из 838
35 Interrupt Function and Pulse Catch Function
802
FXCPU Structured Programming Manual
[Basic & Applied Instruction]
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)
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 measuring short pulse width with retentive 1 ms timer
The sequence diagram below takes the FX
3U
 PLC (sink input) as an example.
0V
S/S
X000 X001
SW
PLC
This period of time is measured.
Preparation for 
measurement
SW(X000, X001)
24V
X010
EI
EN
ENO
M8000
TC246
Interrupts are enabled by EI instruction.
The main program is described.
RST
EN
ENO
d
RST
EN
ENO
d
RST
EN
ENO
d
OUT_T
EN
TCoil
TValue
TC246
K32767
X010
M0
D0
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.
MOV
EN
s
ENO
d
D0
T246
X010
SET
EN
ENO
d
M0
OUT_T
EN
TCoil
TValue
RST
EN
ENO
d
TC246
K32767
M0
TC246
M8000
When the rising edge 
of X000 is detected
[Main program]
[Interrupt program]
(Event: I001)
When the falling edge 
of X001 is detected
[Interrupt program]
(Event: I100)