Programmable Timer 8254
Programmable Timer 8254
version of the 8254. The maximum input clock frequency to 8253 is 2.6
MHz. The 8253 and 8254 are pin to pin compatible and functionally
same except the clock frequency.
3. The timer can be used as a baud rate generator. (For e.g., the timer
can be used as a clock divider to divide the processor clock to
desired the frequency for TxC and RxC of USART-8251A.)
The 8254 has eight data lines which can be used for
communication with the processor. The control words and
count values are written into 8254 registers through the data
bus buffer.
The 𝐶𝑆 is used to select the chip. The address lines A0 and A1
are used to select any one of the four internal devices as
shown in Table-below. The control signals 𝑅𝐷 and 𝑊𝑅 are
used by the processor to perform read/write operation. The
processor can read the count value in the count register
with/without stopping the counter at any time.
select IOCS-5 is used to select 8254. The address line A0 and the control
signal M/𝐼𝑂 are used to enable the decoder.
The address lines A1 and A2 of 8086 are connected to A0 and A1 of
8254 to provide the internal addresses. The IO addresses allotted to
the internal devices of 8254 are listed in Table - 7.17. The data
lines D0 -D7 are connected to D0-D7 of the processor, and 𝑅𝐷 and
𝑊𝑅 signals of 8254 are connected to the 𝑅𝐷 and 𝑊𝑅 of the
processor respectively to achieve parallel data transfer.
TABLE: IO ADDRESSES OF 8254
The clock signals required for the counters can be obtained either
from the processor clock or from the Peripherals clock (PCLK)
supplied by the clock generator 8284. The clock signals from 8284
can also be divided to lower values by using clock divider circuits
and then applied to the clock input of counters
Programming 8254
The read-back control word can be used to latch one or all the
counters by sending a single control word. This control word is
also used to latch the status register to the output latch of the
counters, so that the status registers can be read by using the
respective counter address. At any one time, we can latch either the
count value by programming the bit B5 as zero or latch the status
register by programming the bit B4 as zero.
The initialization procedure for each mode is almost same, but the
output of each mode will be different. To initialize a counter, the
following steps are necessary:
1. Write a control word into the control register.
2. Write a count value in the count register
The writing of count value depends on the control word. There may be
three possible choices :
1. If the control word is framed for writing LSB only then write LSB
alone.
2. If the control word is framed for writing MSB only then write
MSB alone.
3. If the control word is framed for writing LSB first and MSB next,
then write LSB first and write MSB next.
In all the modes, the GATE signal act as a control signal to start,
stop or maintain the counting process. In modes 0, 2, 3 and 4 once
the count value is loaded in the counter, the timer starts
decrementing the count value if the GATE is high. Whenever the
GATE signal goes low, the counter stops counting and will resume
counting only when the GATE is made high again
ADC INTERFACE