
Applications
A-4
High Speed Counter Encoder Module User Manual
A.2
Using Counters 2, 3, 5, and 6
The 16-bit counters can be configured as binary counters. The count value
wraps about the count value of zero and continues counting in the upward
or downward direction. You select the count direction in bit WY20.07 for
counters 2 and 3, or WY20.08 for counters 5 and 6.
Configure the counter as follows:
•
Count Format:
Up counting.
•
Internal Trigger/Gate:
Reset Flags WY19.03, .04,
.07, and .08.
•
External Trigger/Gate:
Input jumpered to the
counter trigger input.
•
Initial Output:
Off
In applications that require simple counting, where the count is equal to the
number of clock pulses since a reset or trigger, the following description will
help you configure the module.
During each internal module scan period, the current count value is read
from each of the counter registers and written to the respective WX3, WX4,
WX7 and WX8 word locations. The count loads the preset value on the first
valid clock. The count is incremented or decremented on each subsequent
clock pulse. For simple counting, bits WY20.07 and .08 set the incrementing
count (Up Count) format.
Configure the counter for Retriggerable one-shot mode as follows:
•
Preset:
1
The Retriggerable one-shot mode sets the output On at the first valid clock
pulse and presets the count value to one. The count value equals the
number of pulses since a reset or trigger. The clock increments the count
value until counter rollover at zero. At rollover, the output turns Off (high)
and remains Off. Counting continues. Setting the Reset Counter flag,
WY19.03, .04, .07, or .08 for the corresponding counter 2, 3, 5, or 6, or an
external trigger, repeats the count cycle. The counting does not stop while
the trigger is active.
Using Binary Up or
Down Counting
Using Retriggerable
One-Shot Mode