Functions And Operation Examples - Mitsubishi Electric MELSEC-Q Structured Programming Manual

Hide thumbs Also See for MELSEC-Q:
Table of Contents

Advertisement

FXCPU Structured Programming Manual
[Device & Common]
2.6.4

Functions and operation examples

1. General type and latched (backed-up) type 16-bit counters
• The valid setting rage of 16-bit binary up-counter is from K1 to K32767 (decimal constant).
K0 causes the same operation as K1, and the output contact turns ON at the first counting.
• In general type counters, the count value is cleared when the PLC is turned OFF.
In latched (backed-up) type counters, the count value just before power interruption is stored. The count
value in the subsequent operation can be added to the previous last count value.
• Every time the coil C0 is driven by the counting input X011, the current value of the counter increases.
When a coil instruction is executed 10 times, the output contact turns ON. After that, the current value of
the counter does not change even if the counting input X011 turns ON.
When the reset input X010 turns ON and then the RST instruction is executed, the current value of the
counter is reset to "0" and the output contact turns OFF.
X010
X011
CC0
K10
CS0
• The counter set value can be set directly by a constant (K) as shown above, or specified indirectly by a
data register number.
For example, when D10 is specified and the contents of D10 are "123", it is equivalent to "K123".
• If data beyond the set value is written to the current value register by the MOV instruction, etc., the OUT
coil turns ON and the current value register becomes the set value when the next counting input is
received.
• In a latched (backed-up) type counter, the current value, output contact operation status and reset status of
the counter are latched (backed up) by a battery, EEPROM, etc. built in the PLC.
2. General type and latched (backed-up) type 32-bit bidirectional counters
The valid setting range of 32-bit binary bidirectional 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 M8
When M8
previous page.)
• The (positive or negative) set value can be specified by a constant (K) or the contents of data registers (D).
When data registers are used, 32-bit data composed of a pair of serial data registers is handled as the set
value.
However, when handling 32-bit data in structured programs, it is not allowed to specify 16-bit data registers
directly, different from simple projects. (Because 32-bit counters have 32-bit length, it is allowed to specify
32-bit data directly.) Use a label when handling 32-bit data.
For example, when specifying 32-bit data using two data registers D1 and D0, define D0 using a global
label.
RST
EN
ENO
d
C0
OUT_C
EN
ENO
CCoil
CValue
Set value (constant)
The set value can be
indirectly specified instead.
Y000
→ For details on backup methods against power interruption, refer to Section 2.6.
is driven for the counter C
is not driven for the counter C
X010
X011
Current
6
value
5
4
3
2
1
0
Y000
, the counter executes down-counting.
, the counter executes up-counting. (Refer to the
2 Devices in Detail
2.6 Counter [C]
10
9
8
7
1
2
3
4
5
6
7
57

Advertisement

Table of Contents
loading

This manual is also suitable for:

Melsec-lMelsec-fFx3sFx3gFx3gcFx3u ... Show all

Table of Contents