8254 micro processor

16
Advanced Microprocessor 1 I/O Interface Programmable Interval Timer: 8254 Three independent 16-bit programmable counters (timers). Each capable in counting in binary or BCD with a maximum frequency of 10MHz. Used for controlling real-time events such as real- time clock, events counter, and motor speed and direction control. The timer usually decoded at port address 40H-43H and has following functions: - Generates a basic timer interrupt that occurs at approximately 18.2Hz. Interrupts the micro at interrupt vector 8 for a clock tick. -Causes DRAM memory system to be refreshed. - Provides a timing source to the internal speaker and other devices.

description

praveen kaushal RD6702B433060070082

Transcript of 8254 micro processor

Page 1: 8254 micro processor

Advanced Microprocessor 1

I/O Interface

Programmable Interval Timer: 8254

•Three independent 16-bit programmable counters (timers).

Each capable in counting in binary or BCD with a maximum frequency of 10MHz.

•Used for controlling real-time events such as real-time clock, events counter, and motor speed and direction control.

The timer usually decoded at port address 40H-43H and has following functions:

- Generates a basic timer interrupt that occurs at approximately 18.2Hz. Interrupts the micro at interrupt vector 8 for a clock tick.

-Causes DRAM memory system to be refreshed.

- Provides a timing source to the internal speaker and other devices.

Page 2: 8254 micro processor

Advanced Microprocessor 2

I/O Interface

8254 Functional Description

Page 3: 8254 micro processor

Advanced Microprocessor 3

I/O Interface

8254 Functional Description

•Timer 0 is programmed to generate an 18.2Hz signal that interrupt the microprocessor at interrupt vector 8 for a clock tick

• Timer 1 is programmed for 15µs, used in PC’s to request a DMA action used to refresh DRAM

• Timer 2 is programmed to generate tone on the PC’s speaker

• D0 to D7, read, write, Chip select & Address pins A1 and A0are connected to Microprocessor • the address inputs used to select any of the internal register for programming, reading, or writing to a counter

Tick is used for time program or events

Page 4: 8254 micro processor

Advanced Microprocessor 4

I/O Interface

8254 Functional Description

A1, A0:The address inputs select one of the four internal registers with the 8254 as follows:

CLK: The clock input is the timing source for each of the internal counters. It is often connected to the PCLK signal from the bus controller.

Page 5: 8254 micro processor

Advanced Microprocessor 5

I/O Interface

8254 Functional Description

CS: Chip Select enables the 8254 for programming, and reading and writing.

G: The gate input controls the operation of the counter in some modes.

OUT: A counter output is where the wave-form generated by the timer is available.

: Read/Write causes data to be read/written from the 8254 and often connects to the

Page 6: 8254 micro processor

Advanced Microprocessor 6

I/O Interface

Each counter is individually programmed by writing a control word, followed by the initial count.

The control word allows the programmer to select the counter, model of operation, binary or BCD count and type of operation (read/write).

Page 7: 8254 micro processor

Advanced Microprocessor 7

I/O Interface

Programming the 8254

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.

There are 6 modes of operation for each counter:

Mode0, Mode1, Mode2, MOde3, Mode4, Mode5

Page 8: 8254 micro processor

Advanced Microprocessor 8

I/O Interface

Programming the 8254

Modes of operation 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.

Page 9: 8254 micro processor

Advanced Microprocessor 9

I/O Interface

Programming the 8254

Modes of operation

Mode 2: This is used to generate a pulse equal to the clock period at a given interval. When a count is loaded, the OUT stays high until the count reaches to 1 and then out goes low for one clock.

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. When the count is loaded OUT goes to high, the count is de decremented by 2 for every clock cycle

Page 10: 8254 micro processor

10

I/O Interface

Programming the 8254

Modes of operation

Mode 4: Software triggered one-shot (G must be 1). In this mode out is goes to low for one clock period at the end of the count.

Mode 5: Hardware triggered one-shot. G controls similar to Mode 1. In this the tiggered by rising pulse.

Trigger with count of 5

Page 11: 8254 micro processor

Advanced Microprocessor 11

I/O Interface

Page 12: 8254 micro processor

Advanced Microprocessor 12

I/O Interface

Read Operations

There are three possible methods for reading the counters:

• a simple read operation

• the Counter Latch Command

• the Read-Back Command

Simple read operation :

• The Counter which is selected with the A1, A0 inputs, the CLK input of the selected Counter must be inhibited by using either the GATE input or external logic.

• Otherwise, the count may be in the process of changing when it is read, giving an undefined result.

Page 13: 8254 micro processor

Advanced Microprocessor 13

I/O Interface

Counter Latch Command:

• SC0, SC1 bits select one of the three Counters• two other bits, D5 and D4, distinguish this command from a Control Word

• If a Counter is latched and then, some time later, latched again before the count is read, the second Counter Latch Command is ignored. The count read will be the count at the time the first Counter Latch Command was issued.

Page 14: 8254 micro processor

Advanced Microprocessor 14

I/O Interface

Read-back control command:

• The read-back control, word is used When it is necessary for the contents of more than one counter to be read at a same time.

Count : logic 0, select one of the Counter to be latchedStatus : logic 0, Status must be latched to be read status of a counter is accessed by a read fromthat counter

Page 15: 8254 micro processor

Advanced Microprocessor 15

I/O Interface

Status register:• shows the state of the output pin• check the counter is in NULL state (0) or not• how the the counter is programmed

Page 16: 8254 micro processor

Advanced Microprocessor 16

I/O Interface

•Here port F3H accesses the line control register

•F0H & F1H access the baud rate divisor register

• after the line control register & baud rate divisor are programmed , still it is not ready to function

• program the FIFO control register, at port F2H