Publication 1762-RM001C-EN-P
8-8 Timer and Counter Instructions
Addressing Modes and File Types can be used as shown in the following
table:
Using Counter File Control and Status Bits
Like the accumulated value, the counter status bits are also retentive until
reset, as described below.
NOTE
The counter continues to count when the accumulator is
greater than the CTU preset and when the accumulator is
less than the CTD preset.
Table 8.11 CTD and CTU Instructions Valid Addressing Modes and File Types
For definitions of the terms used in this table see Using the Instruction Descriptions on page4-2.
Parameter
Data Files
(1)
(1) Valid for Counter Files only.
Function Files
CS - Comms
IOS - I/O
Address
Mode
Address
Level
O
I
S
B
T, C, R
N
ST
L
MG, PD
RTC
HSC
PTO, PWM
STI
EII
BHI
MMI
DAT
TPI
Immediate
Direct
Indirect
Bit
Word
Long Word
Element
Counter • • •
Preset
• •
Accumulator
• •
Table 8.12 CTU Instruction Counter Control and Status Bits, Counter Word 0
(Data File 5 is configured as a timer file for this example.)
Bit Is Set When: And Remains Set Until One of the Following
Occurs:
bit 12 - C5:0/OV OV - overflow
indicator
the accumulated value wraps from +32,767
to -32,768 and continues to count up
a RES instruction with the same address as the CTU
instruction is enabled
bit 13 - C5:0/DN DN - done
indicator
accumulated value
≥
preset value
•
accumulated value <
preset value or,
•
a RES instruction with the same address as the CTU
instruction is enabled
bit 15 - C5:0/CU CU - count up
enable
rung state is true
•
rung state is false
•
a RES instruction with the same address as the CTU
instruction is enabled
Table 8.13 CTD Instruction Counter Control and Status Bits, Counter Word 0
(Data File 5 is configured as a timer file for this example.)
Bit Is Set When: And Remains Set Until One of the Following
Occurs:
bit 11 - C5:0/UN UN - underflow
indicator
the accumulated value wraps from -32,768
to +32,767 and continues to count down
a RES instruction with the same address as the CTD
instruction is enabled
bit 13 - C5:0/DN DN - done
indicator
accumulated value
≥
preset value
•
accumulated value
<
preset value or,
•
a RES instruction with the same address as the
CTU instruction is enabled
bit 14 - C5:0/CD CD - count down
enable
rung state is true
•
rung state is false
•
a RES instruction with the same address as the
CTD instruction is enabled