Timers. The 8254 Programmable Interval Timer 3 independent 16-bit programmable counters Counting in...
-
Upload
garry-brooks -
Category
Documents
-
view
222 -
download
0
Transcript of Timers. The 8254 Programmable Interval Timer 3 independent 16-bit programmable counters Counting in...
![Page 1: Timers. The 8254 Programmable Interval Timer 3 independent 16-bit programmable counters Counting in binary/BCD Applications –Real-time clock –Event counter.](https://reader036.fdocuments.net/reader036/viewer/2022082518/56649ec95503460f94bd71ba/html5/thumbnails/1.jpg)
Timers
![Page 2: Timers. The 8254 Programmable Interval Timer 3 independent 16-bit programmable counters Counting in binary/BCD Applications –Real-time clock –Event counter.](https://reader036.fdocuments.net/reader036/viewer/2022082518/56649ec95503460f94bd71ba/html5/thumbnails/2.jpg)
The 8254 Programmable Interval Timer
• 3 independent 16-bit programmable counters
• Counting in binary/BCD
• Applications– Real-time clock– Event counter
![Page 3: Timers. The 8254 Programmable Interval Timer 3 independent 16-bit programmable counters Counting in binary/BCD Applications –Real-time clock –Event counter.](https://reader036.fdocuments.net/reader036/viewer/2022082518/56649ec95503460f94bd71ba/html5/thumbnails/3.jpg)
8254 I/O• D7-D0: System data bus• CLK0: Clock for counter 0• Gate0: Gate for counter 0• CLK1: Clock for counter 1• Gate1: Gate for counter 1• CLK2: Clock for counter 2• Gate2: Gate for counter 2• A1-A0: Address select
– 00: Counter 0– 01: Counter 1– 10: Counter 2– 11: Control Register
• Vcc: Power (+5V) • Ground: • RD: Read enable• WR: Write enable• CS: Chip select signal• OUT0: Output of counter0• OUT1: Output of counter1• OUT2: Output of counter2
![Page 4: Timers. The 8254 Programmable Interval Timer 3 independent 16-bit programmable counters Counting in binary/BCD Applications –Real-time clock –Event counter.](https://reader036.fdocuments.net/reader036/viewer/2022082518/56649ec95503460f94bd71ba/html5/thumbnails/4.jpg)
8254 Block Diagram
![Page 5: Timers. The 8254 Programmable Interval Timer 3 independent 16-bit programmable counters Counting in binary/BCD Applications –Real-time clock –Event counter.](https://reader036.fdocuments.net/reader036/viewer/2022082518/56649ec95503460f94bd71ba/html5/thumbnails/5.jpg)
Control Register
![Page 6: Timers. The 8254 Programmable Interval Timer 3 independent 16-bit programmable counters Counting in binary/BCD Applications –Real-time clock –Event counter.](https://reader036.fdocuments.net/reader036/viewer/2022082518/56649ec95503460f94bd71ba/html5/thumbnails/6.jpg)
Programming the 8254• Each counter is programmed individually by writing
– A control word– The initial count
• Control word selects– Counter– Mode of operation– Type of operation (read/write)– Type of count (binary/BCD)
• Program sequence 1:– PROGRAM CONTROL WORD 1– PROGRAM CONTROL WORD 2– PROGRAM LSB 1– PROGRAM LSB 2– PROGRAM MSB 1– PROGRAM MSB 2
• Program sequence 2:– PROGRAM CONTROL WORD 1– PROGRAM LSB 1– PROGRAM MSB 1– PROGRAM CONTROL WORD 2– PROGRAM LSB 2– PROGRAM MSB 2
![Page 7: Timers. The 8254 Programmable Interval Timer 3 independent 16-bit programmable counters Counting in binary/BCD Applications –Real-time clock –Event counter.](https://reader036.fdocuments.net/reader036/viewer/2022082518/56649ec95503460f94bd71ba/html5/thumbnails/7.jpg)
8254 Modes of Operation
• Mode 0: Events counter. • Mode 1: One shot pulse• Mode 2: Continuous pulses, one clock
pulse wide• Mode 3: Continuous square-wave as long
as Gate is 1• Mode 4: Software triggered one-shot pulse• Mode 5: Hardware triggered one-shot
pulse
![Page 8: Timers. The 8254 Programmable Interval Timer 3 independent 16-bit programmable counters Counting in binary/BCD Applications –Real-time clock –Event counter.](https://reader036.fdocuments.net/reader036/viewer/2022082518/56649ec95503460f94bd71ba/html5/thumbnails/8.jpg)
Modes of Operation
• Mode 0: Events counter
(used for system time)
• Mode 1: One shot pulse
![Page 9: Timers. The 8254 Programmable Interval Timer 3 independent 16-bit programmable counters Counting in binary/BCD Applications –Real-time clock –Event counter.](https://reader036.fdocuments.net/reader036/viewer/2022082518/56649ec95503460f94bd71ba/html5/thumbnails/9.jpg)
Modes of Operation
• Mode 2: Continuous pulses
• Mode 3: Continuous square-wave
![Page 10: Timers. The 8254 Programmable Interval Timer 3 independent 16-bit programmable counters Counting in binary/BCD Applications –Real-time clock –Event counter.](https://reader036.fdocuments.net/reader036/viewer/2022082518/56649ec95503460f94bd71ba/html5/thumbnails/10.jpg)
Modes of Operation
• Mode 4: Software triggered one-shot pulse
• Mode 5: Hardware triggered one-shot pulse
![Page 11: Timers. The 8254 Programmable Interval Timer 3 independent 16-bit programmable counters Counting in binary/BCD Applications –Real-time clock –Event counter.](https://reader036.fdocuments.net/reader036/viewer/2022082518/56649ec95503460f94bd71ba/html5/thumbnails/11.jpg)
Example
• Connect an 8254 in a 8088 processor system so that it occupies the address range 4CH-4FH
• Program counter 0 in mode 0 with a count of ABCD12H and counter 1 in mode 3 and a count of 345678H
• Program counter 0 to generate an interrupt every 10 ms using a 10MHz oscillator– Write an interrupt service routine that calls a sleep
function every 1 min• Program counter 1 to produce a 1.25 MHz clock
output with 50% duty cycle
![Page 12: Timers. The 8254 Programmable Interval Timer 3 independent 16-bit programmable counters Counting in binary/BCD Applications –Real-time clock –Event counter.](https://reader036.fdocuments.net/reader036/viewer/2022082518/56649ec95503460f94bd71ba/html5/thumbnails/12.jpg)
Example 2
• Connect an 8254 in a 8088 processor system so that it occupies the address range 4CH-4FH through a PIC in the address range 6EH-6FH at IRQ1
• Configure the PIC for vector 43H and unmask IRQ1 masking all others
• Configure the timer to use one counter to count events on Gate0 and another to count time.
• Write an ISR at vector 43H that reads the values of the two timers each time there is an interrupt.