Sie sind auf Seite 1von 20

Programmable Timer 8254

8254 programmable interval timer/counter


It has 24 pins and requires +5v power
supply.
It generates accurate time delays.
8254 includes three identical 16-bit
counters that can operate independently
in any of the six modes.
The counters are fully independent. Each
counter may operate in different mode.

Programmable Timer 8254

The actual counter is Labeled as CE (Counting


Element)
It is a 16-bit presettable Counter
OLM and OLL are two 8-bit latches OL(output Latch)
Counter Latch command is sent to 8254, the latches
latch the present count until read by the CPU .
And then return to following the CE .
One Latch at a time is enabled by the counter control
logic to drive with 8 bit internal bus ( this is how the
16-bit counter communicates with 8-bit internal bus)
Whenever you read the count it is from the OL not
from the CE
CR( Count Register) New count value is loaded into
CR and then transferred to CE.

8254 Programming
Each counter may be programmed
with a count of 1 to FFFFH.
Minimum count is 1 all modes except 2
and 3 with minimum count of 2.

Each counter has a program control


word used to select the way the
counter operates.
If two bytes are programmed, then the
first byte (LSB) stops the count, and the
second byte (MSB) starts the counter
with the new count.
11-6

Operations on 8254
Write operations
For each counter the control word must
be written before the initial count is
written
Load the LSB of a count in the count
register
Load the MSB of a count in the count
register
The control word register and the three
counters have separate addresses.

Operations on 8254

Read Operations
There are three possible methods for
reading the counters.
A simple read operation,
The Counter Latch Command, and
The Read-Back Command

Mode Definitions
The following are defined for use in
describing the operation of the 82C54.
CLK PULSE: a rising edge, then a falling
edge, in
that order, of a Counter's CLK input.
TRIGGER: a rising edge of a Counter's GATE
input.
COUNTER LOADING: the transfer of a count
from
the CR to the CE

8254 Modes

Mode 0: An events counter enabled with G.

The output becomes a logic 0 when the control word is


written and remains there until N plus the number of
programmed counts.

Mode 1: One-shot mode.

The G input triggers the counter to output a 0 pulse for


`count' clocks.
Counter reloaded if G is pulsed again.
11-13

8254 Modes

Mode 2: Counter generates a series of pulses 1 clock pulse


wide.
The separation between pulses is determined by the count.
The cycle is repeated until reprogrammed or G pin set to 0.

Mode 3: Generates a continuous square-wave with G set to 1.

If count is even, 50% duty cycle otherwise OUT is high 1 cycle


longer.

11-14

8254 Modes
Mode 4: Software triggered one-shot
(G must be 1).

Mode 5: Hardware triggered oneshot. G controls similar to Mode 1.

11-15

Das könnte Ihnen auch gefallen