lecture 7
lecture 7
•Programmable Interval
Timer - 8254
16 August 2023 1
❖ The Intel 8254 is a counter/timer device designed to solve the common timing
control problems in microcomputer system design.
❖It provides three independent 16-bit counters, each capable of handling clock
inputs up to 10 MHz.
❖ All modes are software programmable.
❖The 8254 is a superset of the 8253.
* N stands for an
undefined count.
✓OUT is initially (after loading CW) high. Also remain high when count
is written.
✓When gate is triggered, OUT goes low and will remain low until the
Counter reaches zero. On completion of count OUT goes high again.
Mode 2: RATE GENERATOR
✓Allows the counter to generate a series of continuous pulses that are
one clock pulse wide.
✓The separation between pulses is determined by the count.
✓If count N is loaded then, output will remain high for (N-1) clock
period and low for 1 clock period
✓If count of N is loaded, then OUT will be high for N clock cycles and low
for one clock cycle at the end.
✓The cycle does not begin until the counter is loaded again.
Mode 5: Hardware Triggered Mode.
Addres
A15 A14 A13 A12 A11…………A5 A4 A3 A2 A1 A0 s
1 0 1 1 0 0 0 0 B0H
Control
Load 16 bit Count in Word
Counter 2 count Mode 0 binary
1 0 0 0 0 0 0 0 80H
Counter latch Don’t
Counter 2 command care
Counter latch
command
Solution (b)
Subroutine:
COUNTER PROC NEAR
CNT2 EQU 8002H
CNTR EQU 8003H
MOV AL, B0H
OUT CNTR, AL
MOV AL, 50H
OUT CNTR2, AL
MOV AL, C3H
OUT CNTR2, AL
READ: MOV AL, 80H
OUT CNTR, AL
IN AL, CNT2
MOV DL, AL
IN AL, CNT2
OR AL, DL
JNZ READ
RET
COUNT ENDP
Thanks