Omron SYSMAC C20K Operation Manual page 102

K-type programmable controllers
Hide thumbs Also See for SYSMAC C20K:
Table of Contents

Advertisement

Timer and Counter Instructions
Example 1:
Basic Application
0000
0001
0002
CNT 04
0000
0001
0002
1815
CNT 04
Example 2:
Extended Counter
In the following example, the PV will be decremented whenever both 0000
and 0001 are ON provided that 0002 is OFF and either 0000 or 0001 was
OFF the last time CNT 04 was executed. When 150 pulses have been
counted down (i.e., when PV reaches zero), 0205 will be turned ON.
CP
CNT 04
R
#0150
0205
Here, 0000 can be used to control when CNT is operative and 0001 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 SR area
(1815) to reset CNT as shown below.
CP
CNT 04
R
#0150
0205
Counters that can count past 9,999 can be programmed by using one CNT to
count the number of times another CNT has reached zero from SV.
In the following example, 0000 is used to control when CNT 01 operates and
CNT 01, when 0000 is ON, counts down the number of OFF to ON changes
in 0001. CNT 01 is reset by its completion flag, i.e., it starts counting again as
soon as its PV reaches zero. CNT 02 counts the number of times the com-
pletion flag for CNT 01 goes ON. Bit 0002 serves as a reset for the entire
extended counter, resetting both CNT 01 and CNT 02 when it is OFF. The
completion flag for CNT 02 is also used to reset CNT 01 to inhibit CNT 01
operation once PV for CNT 02 has been reached until the entire extended
counter is reset via 0002.
Section 5-11
Address Instruction
0000
LD
0001
AND
0002
LD
0003
CNT
0004
LD
0005
OUT
Address Instruction
0000
LD
0001
AND
0002
LD
0003
OR
0004
CNT
#
0005
LD
CNT
0006
OUT
Operands
0000
0001
0002
04
#
0150
CNT
04
0205
Operands
0000
0001
0002
1815
04
0150
04
0205
91

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sysmac c40kSysmac c60kSysmac c28k

Table of Contents