Programmable Interval Timer - 8254

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

Programmable Interval Timer

8254/8253
Prepared By,
Tanjum Rahi Akanto
Lecturer,Dept. of EEE
Daffodil International University
Outline:
• Basics of 8254/8253
• Control Signals of 8254/8253
• Block diagram of 8254/8253
• Control register
• Applications of 8254/8253
Basics of 8254/8253:

• 8254 functions like software designed timer/counter.


• It generates accurate time delay.
• 8254 includes 3 identical 16 bit counters that can operate in 6 different
mode independently.
• 8254 can operate with (DC to 8MHz) and 8253 can operate with DC to
2MHz.
• 8254 includes status back command that can latch the count and the
status of counter.
• 8253 can only latch count.
Working of 8254/8253:

• 16-bit count is loaded in it’s register. (At first lower byte, then higher
byte as the data bus is of 8 bit)
• On command ,it begins to decrement until it reaches 0.
• At the end of the count it generates a pulse that can be used to
interrupt MPU.
• The counter either in binary or BCD.
Control Signals of 8254/8253:

• It has RD,WR,CS ,A0 and A1 as control signal.

A1 A0 Selection
0 0 Counter 0
0 1 Counter 1
1 0 Counter 2
1 1 Control Register
Block Diagram:
8254 is consist of a total of 3 counters of 16-bit each and adequate programming is
performed so that each one operates properly in one of the six possible modes. It has 2
inputs namely clock and gate while 1 output i.e., counter. The counter operates in a way
that initially a count value is stored in the count register and at this time gate signal will
be high and input is provided through clock input. After each cycle of the clock input,
the counter decrements the value by 1, and output is obtained according to the mode
of operation.
Here overall 8 data lines are there through which 8254 communicates with the
processor. Through the data bus buffer, registers store the control words and count
values. The read and write operations are performed through control signals RD’ and
WR’. Out of the four internal devices i.e., the three counters and a control register,
anyone is selected using address lines A0 and A1.
It is to be noted here that there is another timer called Intel 8253 which offers a clock
frequency of 2.6 MHz. Thus is regarded as a low clock version of 8254. Both of these
function in a similar manner however, the only difference exists in their operating clock
frequency.
Control Word Selection Format:

D7 D6 D5 D4 D3 D2 D1 D0

SC1 SC0 RW1 RW0 M2 M1 Mo BCD

BCD:
If BCD=1; BCD counter
If BCD=0; Binary counter of 16 bit
M-mode:
M2 M1 Mo Selected Mode
0 0 0 Mode 0
0 0 1 Mode 1
1 0 Mode 2
×
1 1 Mode 3
×
1 0 0 Mode 4
1 0 1 Mode 5
SC-Select Counter:
SC1 SC0 Selected Counter
0 0 Counter 0
0 1 Counter 1
1 0 Counter 2
1 1 Read Back Command

RW—Read/Write

RW1 RW0 Selected Counter


0 0 Counter Latch
0 1 Read Write of least significant byte only
1 0 Read Write of most significant byte only
1 1 Read Write of least significant byte and then
most significant byte
***Write control word for using counter 0, read load LSB, mode 0, Binary
Counter.

Control Word for Read Back Command:

1 1 Count Status C2 C1 Co 0

Status after Read Back Command:

Out Null RW1 RW0 M2 M1 Mo BCD


HW: Write a program to generate a square wave of 1kHz from an input
frequency of 16.525MHz using 8254 counter 0.

Hints: Mode 3 produces square wave. Find count and control word first.
𝑰𝒏𝒑𝒖𝒕 𝑭𝒓𝒆𝒒𝒖𝒆𝒏𝒄𝒚
Count=
𝑶𝒖𝒕𝒑𝒖𝒕 𝑭𝒓𝒆𝒒𝒖𝒆𝒏𝒄𝒚

Applications:
• Real time clock
• Digital one shot
• Square wave generator
• Event counter
Thank You

You might also like