The Intel 8254 is a Programmable Interval Timer (PTI) designed to address common timing control problems in microcomputers. It provides three independent 16-bit counters. The programmer configures the 8254 according to his requirements and programs one of the counters for the desired delay. On command, it starts decrementing the counter until it reaches 0, then generates a pulse that can be used to interrupt the CPU.
Programming is carried out through two I/O ports:
Control Port 0x43 - command and channel selection (in example, channel 0)
Data Port 0x40 - command data (each channel has its own Data Port.0x40 is used for the 0th)
Mode 0 - Interrupt on Timer Count. Allows 8254 to be used as an events counter.
CW = 00 11 000 0
00 Select Counter 0
11 Read/Write least significant byte first, then most significant byte
000 Mode 0
0 Binary counter
OUT 0x43, 00110000b ; CW - Control Word
OUT 0x40, 12 ; Write least significant byte first
OUT 0x40, 34 ; then most significant byte
Control Word Format:
D7 D6 D5 D4 D3 D2 D1 D0
SC1 SC0 RW1 RW0 M2 M1 M0 BCD
SC - Select Counter M - Mode BCD
SC1 SC2 M2 M1 M0 0 Binary counter
0 0 Select Counter 0 0 0 0 Mode 0
RW - Read/Write
RW1 RW2
1 1 Read/Write least significant byte first, then most significant byte
Comments
Leave a comment