Professional Documents
Culture Documents
8254
BY
FAHIMA AKTER ANNI
ID: 181120012
WHY WE USE 8254?
In 8254,
Facilitates:
In 8086, Accurate Time Delays
It is not possible to Minimizes Load On mp
Real Time Clock
generate accurate Event Counter
time delays using Digital One Shot
Square Wave Generator
delay routines Complex Waveform
Generator
INTRODUCTION
OUT 0 10 O OUTPUT0:OutputofCounter0.
GATE 0 11 I GATE0:GateinputofCounter0.
GND 12 - GROUND:Powersupplyconnection.
WR 23 I WRITECONTROL:ThisinputislowduringCPUwriteoperations.
RD 22 I READCONTROL:ThisinputislowduringCPUreadoperations.
CS 21 I CHIP SELECT : A low on this input enables the 8254 to respond to RD and WR signals. RD
andWRareignored otherwise.
PIN DESCRIPTION
Symbol Pin Type Name and Function
No.
A1, A0 20 –29 ADDRESS : Used to select one of the three Counters or the Control Word Register for read or
I writeoperations. Normally connected tothesystemaddressbus.
A1 A0 Selects
0 0 Counter 0
0 1 Counter 1
1 0 Counter 2
1 1 Control Word Register
CLK 2 18 I CLOCK2:Clock inputofCounter2.
OUT 2 17 O OUT2:OutputofCounter 2.
GATE 2 16 I GATE2:GateinputofCounter2.
CLK 1 15 I CLOCK1:Clock inputofCounter1.
GATE 1 14 I GATE1:GateinputofCounter1.
OUT 1 13 O OUT1:OutputofCounter 1.
COUNTERS:
• Three Counters – C1,C2 & C3
• Each 16 Bit Identical Presentable
• Each counters has two input signals (CLK & GATE) and one output signal (OUT)
• Down Counter Operates In BCD /Hex
• Control word registers and counters are selected using A1 and A0
• Programmed by writing a Control Word
CONTROL LOGIC:
• CS – Logic 0 – Enables 8254
• RD – Logic 0 – Tells Microprocessor Reads Count From 8254
• WR – Logic 0 – Tells Microprocessor Writes Count/ Command Into 8254
• A1,A0 – Address Input Pins To Select Modes And Counters
BLOCK DIAGRAM
6MHz/4 = 1.5MHz
READ
WRITE
DATA LINES
Selecting
Counter 0
Counter 1
Counter 2
CWR
Generating
Chip Select
Address Mapping:
A7 A6 A5 A4 A3 A2 A1 A0
0 1 0 0 0 0 0 0 = 40H Counter 0
0 1 0 0 0 0 1 0 = 42H Counter 1
0 1 0 0 0 1 0 0 = 44H Counter 2
0 1 0 0 0 1 1 0 = 46H CWR
• Selecting counter 0 of this section of the
solution
1. To generate a square
wave of period 1ms.
• Selecting counter 0 of this section of the
solution
1. To generate a square
• Will be operating the counter in BCD Mode
wave of period 1ms.
(can also be HEX)
• Given,
f = 1.5MHz
1
T= = 0.66𝜇𝑠
1.5×10−6
M2 M1 M0
0 0 0 Mode 0
0 0 1 Mode 1
X 1 0 Mode 2
X 1 1 Mode 3
1 0 0 Mode 4
1 0 1 Mode 5
• T = 0.66µs
1. To generate a square • N = 1500 states
wave of period 1ms. • Control word register
BCD Operation
0 Hexadecimal Count
1 BCD Count
• T = 0.66µs CODE SEGMENT
ASSUME CS:CODE
1. To generate a • N = 1500 states
START: MOV AL,37H
square wave of • Control word register OUT 46H,AL
period 1ms. • CWR = 37H MOV AL,00
• Program: OUT 40H,AL
MOV AL,15
MOV 40H,AL
MOV AH,4CH
CODE INT 21H
ENDS END
START
• To generate an interrupt we will have to operate
8254 in Mode 0.
2. To interrupt the
• We use timer 1 for this part of the solution.
processor after 10ms.
• Gate 1 of 8254 is connected to interrupt input
of microprocessor.
• To generate an interrupt we will have to operate 8254 in
Mode 0.
2. To interrupt the • We use timer 1 for this part of the solution.
processor after 10ms. • Gate 1 of 8254 is connected to interrupt input of
microprocessor.
• Number of T states required for 10ms delay
10×10−3
= = 15 × 103 = 15000 = 3A98H
0.66×10−6
𝟏
From solution part 1 : T = = 𝟎. 𝟔𝟔𝝁𝒔
𝟏.𝟓×𝟏𝟎−𝟔