Manual USB-DIO24-CTR6
18
Appendix A: 8254 Counter/Timer
These boards ship standard with two 82C54 counter(s) that each include three 16-bit
counter/timers. Each counter can be programmed to any count as low as 1 or 2, and up to
65,536, depending on the mode chosen. For those interested in more detailed information, a
full description can be found in the Intel (or equivalent manufacturer's) data sheet, provided
in the /chipdocs directory on the Software Master CD.
Refer to Chapter 5: Programming, and the .html Driver Manual document installed by the
Software Master CD for information on using the installed software driver for this board. The
following data is provided only for reference, as it is unlikely to be needed when using the
provided driver. Please note the block diagram description of how the 9 pins associated with
8254 counters are all independently brought to the I/O connector on this board.
Operational Modes
The 8254 modes of operation are described in the following paragraphs to familiarize you
with the versatility and power of this device. For those interested in more detailed
information, a full description of the 8254 programmable interval timer can be found in the
Intel (or equivalent manufacturers') data sheets. The following conventions apply for use in
describing operation of the 8254 :
Clock:
A positive pulse into the counter's clock input
Trigger:
A rising edge input to the counter's gate input
Counter Loading:
Programming a binary count into the counter
Mode 0: Pulse on Terminal Count
After the counter is loaded, the output is set low and will remain low until the counter
decrements to zero. The output then goes high and remains high until a new count is loaded
into the counter. A trigger enables the counter to start decrementing.
Mode 1: Retriggerable One-Shot
The output goes low on the clock pulse following a trigger to begin the one-shot pulse and
goes high when the counter reaches zero. Additional triggers result in reloading the count
and starting the cycle over. If a trigger occurs before the counter decrements to zero, a new
count is loaded. This forms a retriggerable one-shot. In mode 1, a low output pulse is
provided with a period equal to the counter count-down time.
Mode 2: Rate Generator
This mode provides a divide-by-N capability where N is the count loaded into the counter.
When triggered, the counter output goes low for one clock period after N counts, reloads the
initial count, and the cycle starts over. This mode is periodic, the same sequence is
repeated indefinitely until the gate input is brought low. This mode also works well as an
alternative to mode 0 for event counting.