Mitsubishi Electronics FX3G User Manual

Page of 964
104
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. General type and latched (battery backed) type 32-bit bi-directional counters 
The valid set range of 32-bit binary bi-directional counters is from 
−2,147,483,648 to +2,147,483,647 (decimal
constant). The counting direction (up or down) is specified by special auxiliary relays M8200 to M8234.
• When M8UUU is driven for CUUU, a counter executes down-counting. When M8UUU is not driven, a counter 
executes up-counting. (Refer to the previous page.)
• The set value (positive or negative) can be specified by a constant (K) or the contents of data registers (D).
When data registers are used, 32-bit data composed of paired serial devices are treated as set values.
For example, when D0 is specified, D1 and D0 provide a 32-bit set value.
• When the coil C200 is driven by the counting input X014, a counter starts up-counting or down-counting.
When the current value of a counter increases from "
−6" to "−5", the output contact is set. When the current value 
decreases from "
−5" to "−6", the output contact is reset.
• The current value increases or decreases regardless of the operation of the output contact. When a counter 
executes up-counting from "+2,147,483,647", the counter value becomes "
−2,147,483,648". In the same way, 
when a counter executes down-counting from "
−2,147,483,648", the counter value becomes "+2,147,483,647". 
(This type of counter is called ring counter.)
• When the reset input X013 turns ON and then RST instruction is executed, the current value of the counter is reset 
to "0" and the output contact returns.
• For latched (battery backed) type counters, the current value, output contact operation and reset status are backed 
up against power failure. 
In FX
3U
/FX
3UC
 PLCs, latched type counters are backed up by the battery built into the PLC.
In FX
3S
/FX
3G
/FX
3GC
 PLCs, latched type counters are backed up by the EEPROM built into the PLC.
→ For details on backup methods against power failure, refer to Section 2.6.
• A 32-bit counter can be used as a 32-bit data register. 32-bit counters cannot be handled as target devices in 16-bit 
applied instructions.
• If data beyond the set value is written to the current value register by DMOV instruction, etc., the counter continues 
counting and the contact does not change when the next counting input is received.
4.6.5
Set value specification method
1. 16-bit counter
1) Specification by constant (K) 
2) Indirect specification (D)
X013
RST
C200
X014
C200
C200
Y001
K-5
Set value (constant)
It can be specified
indirectly also.
X012
M8200
X012
X013
X014
Current
value
Y001
Up counting
Down counting
Up counting
0 1
2
3 4
5 4
3
2
1
0
−1−2
−3−4
−5−6
−7 −8
When output has
been already
activated.
−7−
6−5
−4−3
0
X003
C 0
K100
Constant (decimal constant): 1 to 32767
100 counts
X001
FNC 12
MOV
K100
D  5
X003
C 0
D 5
D5 = 100
100 counts
Counts to the indirectly specified value of the defined data
register, previously set by a digital switch.
Note that the set value of a latched (battery backed) type 
register is not held correctly sometimes when the battery 
voltage becomes low.