Академический Документы
Профессиональный Документы
Культура Документы
Port B
The architecture of
8255
PA7 – PA0
Group A Group A
Control Port A
D0-
D7 Data Bus PC7 – PC4
Buffer Group A
Port C
upper
PC3 – PC0
RD Group B
Port C
AO
Lower
Read/
WR Write
PB7 – PB0
Control Group B
A1 Logic Group B
Control
Port B
CS
CONTROL WORD
Group B
Port CLSB
0 – output
1 – input
Port B
0 – output
1 – input
Mode of
operation
0 - Mode 0
1 - Mode 1
CONTROL WORD
Group A
Port CUSB
0 – output
1 – input
Port A
0 – output
1 – input
Mode of
operation
00 – Mode 0
01 – Mode 1
10 – Mode 2
11 - Nop
CONTROL WORD
1 – i/0 mode
0 – BSR mode
• In i/o mode all the three ports can be
defined as i/p or o/p or bidirectional ports.
In mode 1 and mode 2 ‘Port C’ carries the
handshaking signals.
Mode 0
PC4 STBA
PC3 INTRA
PC2 STBA
PC0 INTRA
PC7 OBFA
PC3 INTRA
PC1 OBFB
PC0 INTRB
Mode 2
• This is a Strobed bidirectional mode. In
this mode 8-bit port A and 5 bits of port C
(PC3 – PC7) are available.
PC3 INTR
PA0 – PA7
PC7 OBF
INTE1 PC6 ACK
1 – Set
0 0 0 PC0
0 - Reset
0 0 1 PC1
0 1 0 PC2
0 1 1 PC3
1 0 0 PC4
1 0 1 PC5
1 1 0 PC6
1 1 1 PC7
0 – BSR mode
1 – I/O mode
Checking of the port status
Ex : Write a program to initialize port A and
port C as output to send the data to
external devices and port B as input to
receive the data from input device.
Ans :
3. Define Control word
1 0 0 0 0 0 1 0 = 82 H
2. Designing
A0
PAO – PA7
A1
D0 – D7 8255
PBO – PB7
8086
A15 IO/M
PCO – PC7
A2
CS
A14
To access i/o devices IO/M must be set. CS must be zero to enable the PPI
8255.A0 and A1 are used to select the ports and control registers
3. Identify the Port Addresses and program
A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 = 8000H PortA
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 = 8001H PortB
1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 = 8002H PortC
1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 = 8003H CReg
Program
MOV AL , 82H
MOV DX , 8003 ; Control register
OUT DX , AL ; load control word in control register
MOV AL , DATA
MOV DX , 8000 ; port A
OUT DX , AL ; load a data into port A
MOV DX , 8002 ; port B
OUT DX , AL ; load a data into port B
MOV DX , 8001 ; port B
IN AL , DX ;read data from port B and store in AL
INT 3 ;Vector interrupt for break
Applications of 8255
• Interfacing of Stepper motor
• Interfacing of ADC and DAC
• Interfacing of matrix Key board
• Interfacing of Seven segment LED
• Interfacing of sensors
• Interfacing of various home appliances
and Industrial control elements
Interfacing of stepper motor