Mitsubishi Electronics FX3G User Manual

Page of 964
106
FX
3S
/FX
3G
/FX
3GC
/FX
3U
/FX
3UC
 Series
Programming Manual - Basic & Applied Instruction Edition
4 Devices in Detail
4.6 Counter [C]
2. Examples in applied instructions
For the full use of counters as numeric devices, refer to the explanation of applied instructions later.
3. Caution on simultaneous instances of the ZRST instruction and a counter
The ZRST instruction resets also the last stage and reset state of T and C coils.
Accordingly, if the drive contact of X000 is ON in the following program, the counter executes counting after the ZRST
instruction is executed.
Program in the following way to disable counting after execution of the ZRST instruction:
FNC 12
MOV
C 20
D 10
FNC 10
CMP
K100
C 30
M  0
FNC 18
BCD
C 10 K2Y000
FNC 22
MUL
C  5
K  2
D4(D5)
FNC 12
DMOV
C200 D0(D1)
FNC 11
DZCP
K100 K20000 C200
M10
*1
C20 (current value) is transferred to D10.
*1. Make sure to use 32-bit operation instructions for 32-bit counters.
A decimal integer "100" is compared with C30
(current value), and the result is output to M0 to M2.
The contents of C10 (current value) are converted into
BCD, and output to Y000 to Y007.
(Seven-segment display unit is controlled.)
C5 (current value) is multiplied by 2, and transferred
to (D5, D4).
C 200 (current value) is transferred to (D1, D0).
C200 (current value) is compared with a decimal
integer zone 100 to 20000, and the result is output to
M10 and M12.
K10
C0
Circuit program
M0
M0
RST
C100
C0
Timing chart
one operation 
cycle
one operation 
cycle
one operation 
cycle
one operation 
cycle
ZRST instruction 
execution
OUT instruction 
execution
Counting is 
executed when 
X000 is ON.
OUT instruction 
execution
OUT instruction 
execution
X000
ON
OFF
ON
OFF
ON
2
1
0
4
3
OFF
Current 
value 
of C0
M0
FNC 40
ZRST
X000
K10
C0
Circuit program
M0
M0
RST
C100
C0
FNC 40
ZRST
X000