154
Counter numbers are as shown in the following table. Each counter number can
be used to define only one counter instruction unless the counters are never ac-
tive simultaneously.
PC Counter numbers
CV500 or CVM1-CPU01-EV2 C0000 through C0511
CV1000, CV2000, or CVM1-CPU11/21-EV2 C0000 through C1023
Note: Refer to page 115 for general precautions on operand data areas.
Flags ER (A50003): Content of *DM word is not BCD when set for BCD.
Content of S (SV) is not BCD.
In the following example, the PV will be decremented whenever both 000000
and 000001 are ON provided that 000002 is OFF and either 000000 or 000001
was OFF the last time C0004 was executed. When 150 pulses have been
counted down (i.e., when PV reaches zero), 000205 will be turned ON.
Address Instruction
00000 LD 000000
00001 AND 000001
00002 LD 000002
00003 CNT 0004
#0150
00004 LD C0004
00005 OUT 000205
Operands
0000
00
0002
05
0000
01
0000
02
C0004
CNT 0004 #0150
CP
R
Here, 000000 can be used to control when CNT is operative and 000001 can be
used as the bit whose OFF to ON changes are being counted.
The above CNT can be modified to restart from SV each time power is turned ON
to the PC. This is done by using the First Cycle Flag in the Auxiliary Area
(A50015) to reset CNT as shown below.
Address Instruction
00000 LD 000000
00001 AND 000001
00002 LD 000002
00003 OR A50015
00004 CNT 0004
#0150
00005 LD C0004
00006 OUT 000205
Operands
0000
00
0002
05
0000
01
0000
02
A500
15
CNT 0004 #0150
CP
R
C0004
Counters that can count past 9,999 can be programmed by using one CNT to
count the number of times another CNT has counted to zero from SV.
In the following example, 000000 is used to control when C0001 operates.
When 000000 is ON, C0001 counts down the number of OFF to ON changes in
000001. C0001 is reset by its Completion Flag, i.e., it starts counting again as
soon as its PV reaches zero. C0002 counts the number of times the Completion
Flag for C0001 goes ON. Bit 000002 serves as a reset for the entire extended
counter, resetting both C0001 and C0002 when it is OFF. The Completion Flag
for C0002 is also used to reset C0001 to inhibit C0001 operation once the SV for
C0002 has been reached and until the entire extended counter is reset via
000002.
Because in this example the SV for C0001 is 100 and the SV for C0002 is 200,
the Completion Flag for C0002 turns ON when 100 x 200 or 20,000 OFF to ON
changes have been counted in 000001. This would result in 000203 being
turned ON.
Example 1:
Basic Application
Example 2: Extended
Counter
Timer and Counter Instructions Section 5-13