Download Print this page

Program Example - Mitsubishi Electric FX2N-2AD User Manual

Melsec fx2n series
Hide thumbs Also See for FX2N-2AD:

Advertisement

8. Program example

The following program examples (8.1 and 8.3) are formula circuits.
The device numbers that have been underlined can be assigned by the user during programming.
8.1 Example of programming analog input
X000
0
*1
X001
33
*1
Analog to digital conversion execution input of CH1:X000
Analog to digital conversion execution input of CH2:X001
At the same time X000 and X001 can be turned ON.
A/D input data CH1 :D100 (Replace with auxiliary relay M100 to M115. Assign these numbers only once)
A/D input data CH2 :D102 (Replace with auxiliary relay M100 to M115. Assign these numbers only once)
Processing time: 2.5ms / 1 channel
(Time from turning on X000 and X001 to storage of analog to digital conversion value in
data register of main unit.)
*1 Change the circuit of "*1" as follows when using an FX
8.2 Connection to FX
or FX
series PLC
3UC
Please use FNC 176 (RD3A).
Refer to FX Series Programming Manual ΙΙ or FX
8.3 Example of programming making average value data
Add the undermentioned program after "8.1 Example of programming analog input" and use the average
value data when you can not read a stable digital value.
M8002
0
M133
M8000
39
M133
84
A/D input data of CH1 :D100
A/D input data of CH2 :D102
Sampling frequency
Agreement flag of sampling frequency and average frequency :M133
Average value of CH1 :D111, D110
Average value of CH2 :D113, D112
*1 The above program example has an average sampling frequency of 20. Make the average frequency
within the range of 2 to 262143.
9. Notes in drive
1) Confirm whether the input wiring of FX
done.
2) Confirm whether the "4. Connection with programmable controller" condition is satisfied.
3) When shipped from the factory, the input characteristic is adjusted to 0 to 10V DC.
If a different input characteristic is desired, please adjust as required.
When the input characteristic is adjusted, the input characteristics of CH1 and CH2 are changed.
4) The coexistence use for the current and voltage input cannot be done with two channels.
[TO
K0
[TO
K0
[FROM K0
[TO
K0
[TO
K0
[FROM K0
[FROM K0 K0
K4M100 K2
[MOV K2M116 K2M108]
FX
(V3.00 or later), FX
1N,
2N
[DMOV
K0
[DMOV
K0
[DMOV
K0
[MOV
K0
[MOV
K0
[DINC
[DADD
D114
D100
[DADD
D116
D102
[DCMP
D118
K20
[DDIV
D114
D118
[DDIV
D116
D118
:D118
K17
H0000
K1
K17
H0002
K1
K0
K2M100 K2
[MOV
K3M100 D100 ]
K17
H0001
K1
K17
H0003
K1
K0
K2M100 K2
[MOV
K3M100 D102 ]
PLC
0N
]
Reading of digital value
The higher 4 bits are synthesized
to the lower 8 bits.
(V3.00 or later), FX
2NC
/FX
/FX
3S
3G
3GC
D114
]
D116
]
D118
]
D101
]
D103
]
D118
]
b
D114
]
c
D116
]
d
*1
M132
]
e
D110
]
f
D112
]
g
-2AD and the connection of the extension cable is correctly
2N
]
a)
Selecting A/D input channel 1.
]
b)
A/D conversion beginning of CH1.
c)
]
Reading of digital value of CH1.
d)
The higher 4 bits of CH1 are
moved to the lower 8 bits, and it is
stored in D100.
]
e)
Selecting A/D input channel 2.
f)
]
A/D conversion beginning of CH2.
g)
]
Reading of digital value of CH2.
h)
The higher 4 bits of CH2 are
moved to the lower 8 bits, and it is
stored in D102.
/FX
/FX
Programming Manual.
3U
3UC
a
a)
Initialization of data
b)
Count of sampling frequency
c)
Total of input data of CH1
d)
Total of input data of CH2
e)
Comparison of sampling frequencies
K20 is an average frequency
f)
The average value of CH1 is calculated,
and the result is stored in D111, D110
g)
The average value of CH2 is calculated,
and the result is stored in D113, D112
FX
FX
3G,
3GC,
3U

Advertisement

loading