4.2Timer/Counter Operation
4.2.1Introduction
One 8254 programmable timer/counter chip is installed in 48H/96H series. There are three counters in one 8254 chip and 6 possible operation modes for each counter. The block diagram of the timer/counter system is shown in Figure 4.2.
P1C4 | Trigger | 8254 Chip |
|
|
|
| |||
|
|
|
|
| |||||
|
| Edge |
|
| C |
|
| Event IRQ |
|
|
|
|
|
|
| ||||
|
| Control | Counter #0 | O |
|
|
| ||
|
|
|
|
| |||||
2 MHz Clock |
|
| 'H' | G |
|
|
|
| |
|
|
| C Timer #1 | O |
|
|
| ||
|
|
|
|
|
|
|
| ||
|
|
|
| 'H' |
|
|
| ||
|
|
|
|
|
|
| |||
|
|
|
| G |
|
|
|
| |
|
|
|
|
| C |
|
| Timer IRQ |
|
|
|
|
| 'H' | Timer #2 | O |
|
|
|
|
|
|
|
|
|
| |||
|
|
|
| G |
|
|
|
| |
|
|
|
|
|
|
|
|
|
|
Figure 4.2 Timer/counter system of 48H/96H series.
The timer #1 and timer #2 of the 8254 chip are cascaded as a
In software library, the counter #0 is used as an event counter, that is, interrupt on terminal count of 8254 mode 0 . Please refer to chapter 5 for programming the timer/counter functions.
4.2.2 General Purpose Timer/Counter
The counter 0 is a general purpose timer/counter for users applications. It can be used as an event counter, or used for measuring frequency, or other functions. The following Mode are provided by the 82C54 chip.
•Mode 0: Interrupt on Terminal Count
•Mode 1: Programmable
•Mode 2: Rate Generator.
•Mode 3: Square Wave Rate Generator.
•Mode 4: Software Triggered Strobe.
•Mode 5: Hardware Triggered Strobe.
Operation Theorem ∙ 25