Examples Of Program - Mitsubishi Electric MELSEC iQ-F FX5 User Manual

Hide thumbs Also See for MELSEC iQ-F FX5:
Table of Contents

Advertisement

Examples of program

An example of a program using the pulse width measurement function is explained below.
Outline of operation
A program for measuring the delay time between the rising edges of input signals X1 and X2 on the CPU module is explained
below.
Parameter setting
This program assumes that parameters are set as follows.
Input signals X1 and X2 are assigned to CH1 (X1) and CH2 (X2) by parameters. CH3 and CH4 need not be set.
Item
Input signal
Input logic switching
Measurement mode
Program
An operation diagram and program are shown below.
■Operation diagram
ON
CH1(X1)
OFF
ON
CH2(X2)
OFF
This duration is measured
■Program
Command
input
HIOEN
SM400
Interrupt
DHCMOV SD5020
pointer
I002
DHCMOV SD5040
CH to be used
CH1
X1
Positive logic
Always measurement mode
EI
K40
H3
H0
FEND
D0
K0
D2
K0
D-
D2
D0
D8
D/
D8
K2
D10
User program
IRET
END
CH2
X2
Positive logic
Always measurement mode
Measurement of the CH1 and CH2 pulse width starts
The latest rising edge value of CH1 is transferred to D1 and D0
The latest rising edge value of CH2 is transferred to D3 and D2
The value "Ring counter value at the rising edge of the input signal
from CH2 - Ring counter value at the rising edge of the input
signal from CH1 is stored in D9 and D8
Signals are converted to units of 1 μs and is stored in D11 and D10
Interrupt Return
19 HIGH-SPEED INPUT/OUTPUT FUNCTION
19.3 Pulse Width Measurement Function
19
205

Advertisement

Table of Contents
loading

Table of Contents