Mitsubishi Electronics FX3G User Manual

Page of 964
822
FX
3S
/FX
3G
/FX
3GC
/FX
3U
/FX
3UC
 Series
Programming Manual - Basic & Applied Instruction Edition
36 Interrupt Function and Pulse Catch Function
36.8 Pulse width/Pulse period measurement function [M8075 to M8079, D8074 to D8097]
3) Signal delay time measurement
The delay time from the rising edge of the input signal from X000 to the rising edge of the input signal from X001
is measured.
X000
This duration is measured.
X001
OFF
ON
OFF
ON
FNC 04
EI
M8076
Step
0
FNC 06
FEND
I101
interrupt
pointer
X001 Rising edge interrupt
Interrupts are enabled after the EI (FNC 04) instruction.
The main program is described.
X000 is used for the pulse width/pulse period
measurement function.
The ring counter value at the rising edge of the input
signal from X000 stored in D8074 and D8075 is
transferred to D1 and D0.
M8075
M8000
RUN
monitor
FNC 12
DMOV D8074
D0
M8077
FNC 12
DMOV D8080
D2
X001 is used for the pulse width/pulse period
measurement function.
The ring counter value at the rising edge of the input
signal from X001 stored in D8080 and D8081 is
transferred to D3 and D2.
The value "Ring counter value at the rising edge of
the input signal from X001 - Ring counter value at the
rising edge of the input signal from X000" is stored in
D9 and D8.
The interrupt routine is executed at the rising edge of
the input signal from X001.
Pulse width
/Pulse period
measurement
setting flag
FNC 03
IRET
END
User program
Interrupt return
User program (Interrupt at the rising edge(X001))
FNC230
LDD>=
D0
FNC234
ANDD<
D2
K0
FNC 21
DSUB
H7FFFFFFF
FNC 21
DSUB
D2
H80000000
D6
FNC 20
DADD
D4
D6
D8
FNC 24
DINC
D8
FNC226
LDD<
D0
FNC238
ANDD>=
D2
K0
FNC 21
DSUB
HFFFFFFFF
FNC 20
DADD
D2
D4
D8
FNC 24
DINC
D8
M8000
FNC 23
DDIV
D8
K60
D10
X000 Rising edge ring counter value:
                                                H0 to H7FFFFFFF
X001 Rising edge ring counter value:
                                                H80000000 to HFFFFFFFF
X000 Rising edge ring counter value:
                                                H80000000 to HFFFFFFFF
X001 Rising edge ring counter value:
                                                H0 to H7FFFFFFF
The obtained value is converted into a value in units
of 10 
µs.
K0
K0
When either one between the ring counter value at the rising edge of the input signal from X000 and
the ring counter value at the rising edge of the input signal from X001 is located ranging from
H80000000 to HFFFFFFFF, the following process is executed, and the value "Ring counter value
at the rising edge of the input signal from X001 - Ring counter value at the rising edge of the input
signal from X000" is stored in D9 and D8*
1
.
D2
D0
D8
FNC 21
DSUB
D0
D4
D0
D4