52708INTEL
52708INTEL
52708INTEL
www.Jameco.com ✦ 1-800-831-4242
The content and copyrights of the attached
material are the property of its owner.
The Intel 8254 is a counter/timer device designed to solve the common timing control problems in microcom-
puter system design. It provides three independent 16-bit counters, each capable of handling clock inputs up
to 10 MHz. All modes are software programmable. The 8254 is a superset of the 8253.
The 8254 uses HMOS technology and comes in a 24-pin plastic or CERDIP package.
231164 – 2
Figure 2. Pin Configuration
231164 – 1
Figure 1. 8254 Block Diagram
2
8254
231164 – 3
Figure 3. Block Diagram Showing Data Bus Buffer and Read/Write Logic Functions
3
8254
231164 – 4
Figure 4. Block Diagram Showing Control Word Register and Counter Functions
231164 – 5
4
8254
respectively. Both are normally referred to as one other peripherals of the family. It is treated by the
unit and called just OL. These latches normally ‘‘fol- system’s software as an array of peripheral I/O
low’’ the CE, but if a suitable Counter Latch Com- ports; three are counters and the fourth is a control
mand is sent to the 8254, the latches ‘‘latch’’ the register for MODE programming.
present count until read by the CPU and then return
to ‘‘following’’ the CE. One latch at a time is enabled Basically, the select inputs A0,A1 connect to the A0,
by the counter’s Control Logic to drive the internal A1 address bus signals of the CPU. The CS can be
bus. This is how the 16-bit Counter communicates derived directly from the address bus using a linear
over the 8-bit internal bus. Note that the CE itself select method. Or it can be connected to the output
cannot be read; whenever you read the count, it is of a decoder, such as an Intel 8205 for larger sys-
the OL that is being read. tems.
231164 – 6
5
8254
D7 D6 D5 D4 D3 D2 D1 D0
SC1 SC0 RW1 RW0 M2 M1 M0 BCD
By contrast, initial counts are written into the Coun- Since the Control Word Register and the three
ters, not the Control Word Register. The A1,A0 in- Counters have separate addresses (selected by the
puts are used to select the Counter to be written A1,A0 inputs), and each Control Word specifies the
into. The format of the initial count is determined by Counter it applies to (SC0,SC1 bits), no special in-
the Control Word used. struction sequence is required. Any programming
sequence that follows the conventions in Figure 7 is
acceptable.
Write Operations
A new initial count may be written to a Counter at
The programming procedure for the 8254 is very any time without affecting the Counter’s pro-
flexible. Only two conventions need to be remem- grammed Mode in any way. Counting will be affected
bered: as described in the Mode definitions. The new count
1) For each Counter, the Control Word must be writ- must follow the programmed count format.
ten before the initial count is written.
If a Counter is programmed to read/write two-byte
2) The initial count must follow the count format counts, the following precaution applies: A program
specified in the Control Word (least significant must not transfer control between writing the first
byte only, most significant byte only, or least sig- and second byte to another routine which also writes
nificant byte and then most significant byte). into that same Counter. Otherwise, the Counter will
be loaded with an incorrect count.
6
8254
A1 A0 A1 A0
Control WordÐCounter 0 1 1 Control WordÐCounter 2 1 1
LSB of countÐCounter 0 0 0 Control WordÐCounter 1 1 1
MSB of countÐCounter 0 0 0 Control WordÐCounter 0 1 1
Control WordÐCounter 1 1 1 LSB of countÐCounter 2 1 0
LSB of countÐCounter 1 0 1 MSB of countÐCounter 2 1 0
MSB of countÐCounter 1 0 1 LSB of countÐCounter 1 0 1
Control WordÐCounter 2 1 1 MSB of countÐCounter 1 0 1
LSB of countÐCounter 2 1 0 LSB of countÐCounter 0 0 0
MSB of countÐCounter 2 1 0 MSB of countÐCounter 0 0 0
A1 A0 A1 A0
Control WordÐCounter 0 1 1 Control WordÐCounter 1 1 1
Control WordÐCounter 1 1 1 Control WordÐCounter 0 1 1
Control WordÐCounter 2 1 1 LSB of countÐCounter 1 0 1
LSB of countÐCounter 2 1 0 Control WordÐCounter 2 1 1
LSB of countÐCounter 1 0 1 LSB of countÐCounter 0 0 0
LSB of countÐCounter 0 0 0 MSB of countÐCounter 1 0 1
MSB of countÐCounter 0 0 0 LSB of countÐCounter 2 1 0
MSB of countÐCounter 1 0 1 MSB of countÐCounter 0 0 0
MSB of countÐCounter 2 1 0 MSB of countÐCounter 2 1 0
NOTE:
In all four examples, all Counters are programmed to read/write two-byte counts. These are only four of many possible
programming sequences.
7
8254
8
8254
NULL COUNT bit D6 indicates when the last count COUNT and STATUS bits D5,D4 e 0. This is func-
written to the counter register (CR) has been loaded tionally the same as issuing two separate read-back
into the counting element (CE). The exact time this commands at once, and the above discussions ap-
happens depends on the Mode of the counter and is ply here also. Specifically, if multiple count and/or
described in the Mode Definitions, but until the count status read-back commands are issued to the same
is loaded into the counting element (CE), it can’t be counter(s) without any intervening reads, all but the
read from the counter. If the count is latched or read first are ignored. This is illustrated in Figure 13.
before this time, the count value will not reflect the
new count just written. The operation of Null Count If both count and status of a counter are latched, the
is shown in Figure 12. first read operation of that counter will return latched
status, regardless of which was latched first. The
next one or two reads (depending on whether the
This Action Causes counter is programmed for one or two type counts)
A. Write to the control word register;(1) Null Count e 1 return latched count. Subsequent reads return un-
B. Write to the count register (CR);(2) Null Count e 1 latched count.
C. New Count is loaded into Null Count e 0
CE (CR x CE);
CS RD WR A1 A0
NOTE:
1. Only the counter specified by the control word will 0 1 0 0 0 Write into Counter 0
have its Null Count set to 1. Null count bits of other
counters are unaffected. 0 1 0 0 1 Write into Counter 1
2. If the counter is programmed for two-byte counts 0 1 0 1 0 Write into Counter 2
(least significant byte then most significant byte) Null
Count goes to 1 when the second byte is written. 0 1 0 1 1 Write Control Word
Figure 12. Null Count Operation 0 0 1 0 0 Read from Counter 0
0 0 1 0 1 Read from Counter 1
If multiple status latch operations of the counter(s)
are performed without reading the status, all but the 0 0 1 1 0 Read from Counter 2
first are ignored; i.e., the status that will be read is
the status of the counter at the time the first status 0 0 1 1 1 No-Operation (3-State)
read-back command was issued. 1 X X X X No-Operation (3-State)
Command
Description Result
D7 D6 D5 D4 D3 D2 D1 D0
1 1 0 0 0 0 1 0 Read back count and status of Count and status latched
Counter 0 for Counter 0
1 1 1 0 0 1 0 0 Read back status of Counter 1 Status latched for Counter 1
1 1 1 0 1 1 0 0 Read back status of Counters 2, 1 Status latched for Counter
2, but not Counter 1
1 1 0 1 1 0 0 0 Read back count of Counter 2 Count latched for Counter 2
1 1 0 0 0 1 0 0 Read back count and status of Count latched for Counter 1,
Counter 1 but not status
1 1 1 0 0 0 1 0 Read back status of Counter 1 Command ignored, status
already latched for Counter 1
9
8254
Mode Definitions OUT will then go high and remain high until the CLK
pulse after the next trigger.
The following are defined for use in describing the
operation of the 8254. After writing the Control Word and initial count, the
CLK Pulse: a rising edge, then a falling edge, in Counter is armed. A trigger results in loading the
that order, of a Counter’s CLK in- Counter and setting OUT low on the next CLK pulse,
put. thus starting the one-shot pulse. An initial count of N
will result in a one-shot pulse N CLK cycles in dura-
Trigger: a rising edge of a Counter’s GATE tion. The one-shot is retriggerable, hence OUT will
input. remain low for N CLK pulses after any trigger. The
Counter loading: the transfer of a count from the CR one-shot pulse can be repeated without rewriting the
to the CE (refer to the ‘‘Functional same count into the counter. GATE has no effect on
Description’’) OUT.
10
8254
231164 – 7
NOTE:
The following conventions apply to all mode timing diagrams:
1. Counters are programmed for binary (not BCD) counting and for reading/writing least significant byte (LSB) only.
2. The counter is always selected (CS always low).
3. CW stands for ‘‘Control Word’’; CW e 10 means a control word of 10 HEX is written to the counter.
4. LSB stands for ‘‘Least Significant Byte’’ of count.
5. Numbers below diagrams are count values. The lower number is the least significant byte. The upper number is the
most significant byte. Since the counter is programmed to read/write LSB only, the most significant byte cannot be read.
N stands for an undefined count.
Vertical lines show transitions between count values.
11
8254
231164 – 8
initial count has expired, OUT goes low for the re- After writing a Control Word and initial count, the
mainder of the count. Mode 3 is periodic; the se- Counter will be loaded on the next CLK pulse. This
quence above is repeated indefinitely. An initial allows the Counter to be synchronized by software
count of N results in a square wave with a period of also.
N CLK cycles.
Writing a new count while counting does not affect
GATE e 1 enables counting; GATE e 0 disables the current counting sequence. If a trigger is re-
counting. If GATE goes low while OUT is low, OUT is ceived after writing a new count but before the end
set high immediately; no CLK pulse is required. A of the current half-cycle of the square wave, the
trigger reloads the Counter with the initial count on Counter will be loaded with the new count on the
the next CLK pulse. Thus the GATE input can be next CLK pulse and counting will continue from the
used to synchronize the Counter.
12
8254
231164 – 9
NOTE:
A GATE transition should not occur one clock prior to terminal count.
new count. Otherwise, the new count will be loaded Odd counts: OUT is initially high. The initial count
at the end of the current half-cycle. minus one (an even number) is loaded on one CLK
pulse and then is decremented by two on succeed-
Mode 3 is implemented as follows: ing CLK pulses. One CLK pulse after the count ex-
pires, OUT goes low and the Counter is reloaded
Even counts: OUT is initially high. The initial count is with the initial count minus one. Succeeding CLK
loaded on one CLK pulse and then is decremented pulses decrement the count by two. When the count
by two on succeeding CLK pulses. When the count expires, OUT goes high again and the Counter is
expires OUT changes value and the Counter is re- reloaded with the initial count minus one. The above
loaded with the initial count. The above process is process is repeated indefinitely. So for odd counts,
repeated indefinitely. OUT will be high for (N a 1)/2 counts and low for
(N b 1)/2 counts.
13
8254
231164 – 10
NOTE:
A GATE transition should not occur one clock prior to terminal count.
14
8254
MODE 4: SOFTWARE TRIGGERED STROBE initial count of N, OUT does not strobe low until N a
1 CLK pulses after the initial count is written.
OUT will be initially high. When the initial count ex-
pires, OUT will go low for one CLK pulse and then If a new count is written during counting, it will be
go high again. The counting sequence is ‘‘triggered’’ loaded on the next CLK pulse and counting will con-
by writing the initial count. tinue from the new count. If a two-byte count is writ-
ten, the following happens:
GATE e 1 enables counting; GATE e 0 disables 1) Writing the first byte has no effect on counting.
counting. GATE has no effect on OUT.
2) Writing the second byte allows the new count to
After writing a Control Word and initial count, the be loaded on the next CLK pulse.
Counter will be loaded on the next CLK pulse. This
CLK pulse does not decrement the count, so for an This allows the sequence to be ‘‘retriggered’’ by
software. OUT strobes low N a 1 CLK pulses after
the new count of N is written.
231164 – 11
15
8254
MODE 5: HARDWARE TRIGGERED STROBE A trigger results in the Counter being loaded with the
(RETRIGGERABLE) initial count on the next CLK pulse. The counting
sequence is retriggerable. OUT will not strobe low
OUT will initially be high. Counting is triggered by a for N a 1 CLK pulses after any trigger. GATE has
rising edge of GATE. When the initial count has ex- no effect on OUT.
pired, OUT will go low for one CLK pulse and then
go high again. If a new count is written during counting, the current
counting sequence will not be affected. If a trigger
After writing the Control Word and initial count, the occurs after the new count is written but before the
counter will not be loaded until the CLK pulse after a current count expires, the Counter will be loaded
trigger. This CLK pulse does not decrement the with the new count on the next CLK pulse and
count, so for an initial count of N, OUT does not counting will continue from there.
strobe low until N a 1 CLK pulses after a trigger.
231164 – 12
16
8254
17
8254
ABSOLUTE MAXIMUM RATINGS* NOTICE: This is a production data sheet. The specifi-
cations are subject to change without notice.
Ambient Temperature Under Bias ÀÀÀÀÀÀ0§ C to 70§ C
*WARNING: Stressing the device beyond the ‘‘Absolute
Storage Temperature ÀÀÀÀÀÀÀÀÀÀ b 65§ C to a 150§ C Maximum Ratings’’ may cause permanent damage.
Voltage on Any Pin with These are stress ratings only. Operation beyond the
Respect to GroundÀÀÀÀÀÀÀÀÀÀÀÀÀÀ b 0.5V to a 7V ‘‘Operating Conditions’’ is not recommended and ex-
tended exposure beyond the ‘‘Operating Conditions’’
Power Dissipation ÀÀÀÀÀÀÀÀÀÀÀÀÀÀÀÀÀÀÀÀÀÀÀÀÀÀÀ1W may affect device reliability.
Bus Parameters(1)
READ CYCLE
8254 8254-2
Symbol Parameter Unit
Min Max Min Max
tAR Address Stable Before RD v 45 30 ns
tSR CS Stable Before RD v 0 0 ns
tRA Address Hold Time After RD u 0 0 ns
tRR RD Pulse Width 150 95 ns
tRD Data Delay from RD v 120 85 ns
tAD Data Delay from Address 220 185 ns
tDF RD u to Data Floating 5 90 5 65 ns
tRV Command Recovery Time 200 165 ns
NOTE:
1. AC timings measured at VOH e 2.0V, VOL e 0.8V.
18
8254
WRITE CYCLE
8254 8254-2
Symbol Parameter Unit
Min Max Min Max
tAW Address Stable Before WR v 0 0 ns
tSW CS Stable Before WR v 0 0 ns
tWA Address Hold Time After WR v 0 0 ns
tWW WR Pulse Width 150 95 ns
tDW Data Setup Time Before WR u 120 95 ns
tWD Data Hold Time After WR u 0 0 ns
tRV Command Recovery Time 200 165 ns
NOTES:
2. In Modes 1 and 5 triggers are sampled on each rising clock edge. A second trigger within 120 ns (70 ns for the 8254-2) of
the rising clock edge may not be detected.
3. Low-going glitches that violate tPWH, tPWL may cause errors requiring counter reprogramming.
4. Sampled, not 100% tested. TA e 25§ C.
5. If CLK present at TWC min then Count equals N a 2 CLK pulses, TWC max equals Count N a 1 CLK pulse. TWC min to
TWC max, count will be either N a 1 or N a 2 CLK pulses.
6. In Modes 1 and 5, if GATE is present when writing a new Count value, at TWG min Counter will not be triggered, at TWG
max Counter will be triggered.
7. If CLK present when writing a Counter Latch or ReadBack Command, at TCL min CLK will be reflected in count value
latched, at TCL max CLK will not be reflected in the count value latched.
19
8254
WAVEFORMS
WRITE
231164 – 13
READ
231164 – 14
20
8254
WAVEFORMS (Continued)
RECOVERY
231164 – 15
231164 – 16
*Last byte of count being written.
231164 – 17
A.C. Testing: Inputs are driven at 2.4V for a Logic ‘‘1’’ and 0.45V
for a Logic ‘‘0.’’ Timing measurements are made at 2.0V for a
Logic ‘‘1’’ and 0.8V for a Logic ‘‘0’’. 231164 – 18
CL e 150 pF
CL Includes Jig Capacitance
REVISION SUMMARY
The following list represents the key differences be-
tween Rev. 004 and Rev. 005 of the 8254 Data
Sheet.
1. References to and specifications for the 5 MHz
8254-5 are removed. Only the 8 MHz 8254 and
the 10 MHz 8254-2 remain in production.
21