Professional Documents
Culture Documents
Ppi 82c55a Interfacing PDF
Ppi 82c55a Interfacing PDF
Peripheral Interface
(PPI) – 8255A
CEN433
King Saud University
Dr. Mohammed Amer Arafah
1
Functional Diagram
A1 A0 Port
0 0 Port A
0 1 Port B
1 0 Port C
1 1 Control Word
CEN433 - King Saud University 4 Mohammed Amer Arafah
Interfacing 8255A to Buffered 8088 System
BD[0:7]
U1
BD0 34 4 PA0
BD1 33 D0 PA0 3 PA1
BD2 32 D1 PA1 2 PA2
BD3 31 D2 PA2 1 PA3
Port A
BD4 30 D3 PA3 40 PA4
D4 PA4
BD5 29
D5 PA5
39 PA5 0084H
BD6 28 38 PA6
BD7 27 D6 PA6 37 PA7
D7 PA7
IOR/ 5 18 PB0
36 RD PB0 19
IOW/ PB1
9 WR PB1 20
BA0 PB2
BA1 8 A0
A1
PB2
PB3
21 PB3 Port B
RESET 35 22 PB4
8255CS/ 6 RESET PB4 23
CS PB5 24
PB5
PB6
0085H
PB6 25 PB7
PB7
14 PC0
PC0 15 PC1
PC1 16
U2 PC2 17
PC2
PC3
Port C
1 15 PC3 13
BA2 PC4
2 A Y0 14 PC4 12 0086H
BA3 PC5
3 B Y1 13 PC5 11
BA4 PC6
C Y2 12 PC6 10 PC7
Y3 11 PC7
6 Y4 10
BA7 8255
4 G1 Y5 9
BA5
5 G2A Y6 7 PCW
BA6
G2B Y7
74LS138 0087H
BA15 BA14 BA13 BA12 BA11 BA10 BA9 BA8 BA7 BA6 BA5 BA4 BA3 BA2 BA1 BA0
x x x x x x x x 1 0 0 0 0 1 - -
Enable Y1 Ports
Signals
U1
BD0 34 4 PA0
33 D0 PA0 3
BD1 PA1
32 D1 PA1 2 Port A
BD2 PA2
31 D2 PA2 1
BD3 PA3
30 D3 PA3 40
BD4 PA4
BD5 29 D4 PA4 39 PA5
0048H
28 D5 PA5 38
BD6 PA6
27 D6 PA6 37
BD7 PA7
D7 PA7
IOR/ 5 18 PB0
36 RD PB0 19
IOW/ PB1
WR PB1
BA1
BA2
9
8 A0 PB2
20
21
PB2 Port B
PB3
35 A1 PB3 22
RESET PB4
8255CS/ 6 RESET PB4 23 PB5 004AH
CS PB5 24 PB6
PB6 25 PB7
PB7
14 PC0
PC0 15 PC1
PC1 16 PC2 Port C
U2 PC2 17 PC3
BA3 1 15 PC3 13
BA4 2 A Y0 14 PC4 12
PC4
PC5
004CH
BA5 3 B Y1 13 PC5 11 PC6
C Y2 12 PC6 10 PC7
Y3 11 PC7
BA6 6 Y4 10
G1 Y5 8255
BA7 4 9 PCW
5 G2A Y6 7
BA6
G2B Y7
74LS138
004EH
BA15 BA14 BA13 BA12 BA11 BA10 BA9 BA8 BA7 BA6 BA5 BA4 BA3 BA2 BA1 BA0
x x x x x x x x 0 1 0 0 1 - - 0
; Example
MOV DX, PCW
MOV AL, 10011001B
OUT DX, AL
; Set PC6
MOV DX, PCW
MOV AL, 00001101B
OUT DX, AL
; Reset PC6
MOV DX, PCW
MOV AL, 00001100B
OUT DX, AL
BA15
BA14
BA13
BA12
BA11
BA10
BA9
BA8
CEN433 - King Saud University 18 Mohammed Amer Arafah
Application 1: Basic Input/Output
VCC
BD[0:7] 10 KOhm
U1 S1
BD0 34 4 PA0 1 8
BD1 33 D0 PA0 3 PA1 2 7
BD2 32 D1 PA1 2 PA2 3 6
BD3 31 D2 PA2 1 PA3 4 5
BD4 30 D3 PA3 40
BD5 29 D4 PA4 39
D5 PA5 SW DIP-4
BD6 28 38
BD7 27 D6 PA6 37
D7 PA7 U3 R1
IOR/ 5 18 PB0 7 13 1 14
IOW/ 36 RD PB0 19 PB1 1 1 A 12 2 13
BA0 9 WR PB1 20 PB2 2 2 B 11 3 12
BA1 8 A0 PB2 21 PB3 6 4 C 10 4 11
RESET 35 A1 PB3 22 4 8 D 9 5 10
8255CS/ 6 RESET PB4 23 5 BI/RBO E 15 6 9
CS PB5 24 VCC 3 RBI F 14 7 8
PB6 25 LT G
PB7
74LS47 330 Ohm
14 7-Seg LED
PC0 15
PC1 16
U2 PC2 17
BA4 1 15 PC3 13
BA5 2 A Y0 14 PC4 12
BA6 3 B Y1 13 PC5 11
C Y2 12 PC6 10
Y3 11 PC7
BA15 6 Y4 10
G1 Y5 8255
BA13 4 9
BA14 5 G2A Y6 7
G2B Y7
74LS138
BA15 BA14 BA13 BA12 BA11 BA10 BA9 BA8 BA7 BA6 BA5 BA4 BA3 BA2 BA1 BA0
1 0 0 x x x x x x 0 0 0 x x - -
Enable Y1 Ports
Signals
CEN433 - King Saud University 19 Mohammed Amer Arafah
Application 1: Basic Input/Output
1 Turns
Segment ON MS LS
Digit Digit
BD0
BD1
BD2
BD3
BD4
BD5
BD6
BD7
IOR/
IOW/
BA0
BA1
RESET
Digit transistor
switch controlled
BA2 by Port B bit
BA3 0 Turns
BA4 Vcc
BA5
BA6
Digit ON
BA7
BA8
BA9
BA10
BA11
Segment 0 1 1 1 1 0 0 1 79H
Driver
0 0 1 1 1 1 1 1 3FH
dp
Common
0 1 0 0 0 0 0 0 40H
Two Types:
Common Anode (CA) Common Cathode (CC)
CA Control = Vcc CC Control = GND
Anode Cathode
Cathode Anode
PB0
PB1
PB2
PB3
PB4
PB5
PB6
PB7
Sequentially Turn ON one digit at a time
Recommended Rate: 100 – 1500 times/sec
CEN433 - King Saud University 23 Mohammed Amer Arafah
Application 2: 7-Segement Display
A1 A0 Address Port
PLD Program for Address Decoding
0 0 700H Port A
library ieee; 0 1 701H Port B
use ieee.std_logic_1164.all; 1 0 702H Port C
entity DECODER_11_21 is 1 1 703H Control Word
port (
A15, A14, A13, A12, A11, A10, A9, A8, A7, A6, A5, A4, A3, A2: in STD_LOGIC;
D0: out STD_LOGIC
);
end;
architecture V1 of DECODER_11_17 is
begin
D0 <= A15 or A14 or A13 or A12 or A11 or not A10
or not A9 or not A8 or A7 or A6 or A5 or A4 or A3 or A2;
end V1;
BA15 BA14 BA13 BA12 BA11 BA10 BA9 BA8 BA7 BA6 BA5 BA4 BA3 BA2 BA1 BA0
0 0 0 0 0 1 1 1 0 0 0 0 0 0 - -
DS 0050 500
501
502
503
SI = Offset
504
505
MEM - 506
MEM = 506
- 507
MOV SI, OFFSET MEM - 1 SI = (506 - 1) - 500 = 5
- 508
O 509 MOV AL, [BX + SI] DS = 0050 0
BX = 8 BX = 0008
L 50A
SI = 0005
L 50B 0050D
E 50C Content of the address 0050D is ‘H’.
H 50D
Loop execution time is calculated from instruction data and the clock frequency.
An 80486 executes “LOOP D1” in 7 clock cycles
With a 20 MHz clock, loop exec time = 7 x 50 = 350 ns
XXXX = 1ms/350ns
1 ms DISP Proc
DISP Proc
... ... ...
Digit Displayed 8 7 2 1 8 7 2 1
33H = 0 0 1 1 0 0 1 1 45º N
S
ROL AL, 1
66H = 0 1 1 0 0 1 1 0 135º N
S
ROL AL, 1
ROL AL, 1
CCH = 1 1 0 0 1 1 0 0 225º S
N
ROL AL, 1
99H = 1 0 0 1 1 0 0 1 315º S
N
33H = 0 0 1 1 0 0 1 1 45º N
S
ROR AL, 1
99H = 1 0 0 1 1 0 0 1 315º N
S
ROR AL, 1
ROR AL, 1
CCH = 1 1 0 0 1 1 0 0 225º S
N
ROR AL, 1
66H = 0 1 1 0 0 1 1 0 135º S
N
Column Outputs 0 0 0 0
BA12
• If key (X,Y) is pressed, it connects the scanning 0 from column X
BA13
BA14 output to row Y input. If no other key is pressed on the same column,
BA15
this allows the pressed key to be identified.
1 ms
Strobe data
Into Printer
Output Operations:
OBF - (Output Buffer Full). The OBF output will go “low” to indicate that the
CPU has written data out to port A.
ACK - (Acknowledge). A “low” on this input enables the three-state output
buffer of port A to send out the data. Otherwise, the output buffer will be in
the high impedance state.
INTE 1 - (The INTE flip-flop associated with OBF). Controlled by bit
set/reset of PC4.
Input Operations
STB - (Strobe Input). A “low” on this input loads data into the input latch.
IBF - (Input Buffer Full F/F). A “high” on this output indicates that data has
been loaded into the input latch.
INTE 2 - (The INTE flip-flop associated with IBF). Controlled by bit set/reset
of PC4.
CEN433 - King Saud University 48 Mohammed Amer Arafah
Mode 2 (Strobed Bi-Directional Bus I/O)
.REPEAT 1 5
3
IN AL,PORTC
TEST AL,BIT7 4 7
.UNTIL !ZERO?
Data in Port A latch, Port I/O bus
MOV AL,AH but not on its I/O bus yet Enable is normally HiZ
OUT PORTA,AL I/O Bus To allow use in
RET to carry 6 The other direction
latch data