A1 A0 Port
0 0 Counter 0
0 1 Counter 1
1 0 Counter 2
1 1 Control register
The following code shows what we need to do:
Init8253 proc
push ax
mov al,70h ;select mode 0, counter 1, binary rep.
out 80h,al ;write to control register
mov al,80h ;set up LSB of count divisor
out 81h,al ;write it to counter 1
mov al,3eh ;set up MSB of count divisor
out 81h,al ;write it to counter 1
pop ax
ret
Init8253 endp
Of course, the programming requirements for different devices and for different processors will
vary. For example, some devices have a vector number register that allows the programmer to
specify a vector number for the device. When the device generates an interrupt, it sends this
number to the CPU during the exception processing state. In general, programming a device
always requires writing a specific value to its control register(s).
References
Intel. Microprocessor and Peripheral Handbook. Intel Corporation, 1983.
Mazidi, A.M. and J.G. Mazidi. The 80x86 IBM PC and Compatible Computers, Volumes I and
II: Assembly Language, Design and Interfacing. Englewood Cliffs, NJ: Prentice Hall, 1995.
Orejel, Jorge. Personal Communication.
Acknowledgement
Thanks go to Jorge Orejel for checking the correctness of my hardware interface design.