Programmable Peripheral Interface Devices
Support chips: 8155, 8255, 8279, 8254, DMA Controller, Interrupt Controller, USART
Programmable Interface Devices
used to interface a I/O device to the
microprocessor
System Bus
8085
Programmable I/O Interface
I/O Devices
8155 A multipurpose programmable
interface
Designed to be compatible with 8085
It includes
256 bytes of Read/Write memory Three I/O ports
Port A Port B Port C
A 14-bit timer
Block Diagram - 8155
RESET AD0-7 IO/M 8
Port A
256 X 8 Static RAM
8 Port B
PA0-7
I/O Devices
8085
RD
WR ALE CE Timer CLK TIMER OUT
8 Port C
PB0-7
Timer
PC0-5
Vcc (+5 V) Vss (0 V)
Application design with 8155
Objectives
Interfacing 8155 with 8085 Programming 8155
Interfacing 8085 with 8155
RESET
AD0-7 A15 IO/M RD WR ALE Port C 8 CE Port A
256 X 8 Static RAM 8085
8 Port B
Timer
8155
8085
Programming 8155
8155 is a Programmable Peripheral Interface
8085 can send data to 8155 using data bus
This data can be
For I/O devices connected to 8155 Timer registers of 8155 Instruction/Command word for 8155
Commands for 8155 are stored in a 8-bit
Control Register inside 8155
What type of Commands can be given to 8155?
To configure the I/O ports as Input or Output
To start/stop timer etc.
To use handshake mode or not
Control word for 8155
A command/instruction for 8155 is also called
control word This control word is written to control register of 8155 Control word of 8155 is of 8-bits
Control Word Definition for 8155
D0 Port A D1 Port B D2 D3
Port C 0, Input D3 D2 PORT C
1, Output
0
0 1 1
0
1 0 1
ALT1
ALT2 ALT3 ALT4
D4 Interrupt Enable Port A D5 Interrupt Enable Port B D6 D7
Timer
0, Disable 1, Enable
D7 D6 Timer 0 0 0 1 1 0 1 0 NOP Stop Stop after TC Start
I/O functions of Port C
ALT D3 D2 PC5 PC4 PC3 PC2 PC1 PC0
0 I 1 O 0 O 1
STBB
ALT1 0 ALT2 0 ALT3 1 ALT4 1
I O O
BFB
I O O
I O
I O
I O
INTRA INTRA
STBA BFA
INTRB STBA BFA
I = Input STB = Strobe
O = Output BF = Buffer Full INTR = Interrupt Request
Design an interfacing circuit to read data from an A/D converter using the 8155A in the peripheral mapped I/O.
AD0-AD7
8085 IO/M ALE RD WR RESET CE A15 A14 A13 A12 A11 8155 P
o r t A P o r t B P o r t C
Digital Input
A/D Converter
PC5
BFA STBA
SOC OE EOC
O2 O 0 E2 O7 E1 A2 A1 A0 3-to-8 Decoder
LED Display
Analog Input
Port Addresses of 8155
Chip Selection
A7 A6 A5 A4 A3
A2 A1 A0 Port 0 0 0 0 0 0 1 1 0 1 0 1 Control/Status Register Port A Port B Port C
0 0 0 1 0
= 10H = 11H = 12H = 13H = 14H = 15H
1
1
0
0
0
1
LSB Timer
MSB Timer
Application Programming Logic
1. Configure 8155
2. 8085 sends SOC command to ADC
3. 8085 communicates with ADC using
PortC in handshake mode 4. 8085 reads 8-bit temperature value from port A 5. 8085 displays the temperature value on the LED display
1. Configure 8155 I/O Ports
Port A as INPUT port
Port B as OUTPUT
port Port C in ALT3 mode
ALT D3 D2 ALT3 1 0
PC5 O
PC4 PC3 O O
PC2 PC1 PC0
STBA BFA INTRA
SOC
EOC
OE
Control Word for configuration
D0 D1 D2 D3 D4 D5 D6 D7 0 1 0 1 0 0 0 0
Timer 1 0 Port C Port A Port B 0, Input
D3 D2 PORT C
0 0 1 1 0 1 0 1 ALT1 ALT2 ALT3 ALT4
1, Output
IE Port A IE Port B
0, Disable 1, Enable
D7 D6 Timer
0 0 0 1 1 0 NOP Stop Stop after TC Start
Program Instructions for configuration
Data
Control word : 0AH
Address of Control register : 10H
Port Address
Instructions
MVI A, 0AH OUT 10H
2. 8085 sends SOC command to ADC
A small duration pulse on SOC input of ADC
will start conversion process SOC input of ADC is connected to port pin PC5 of Port C (Port address 13H) Data
Data value 20H followed by 00H
PC5 O 1
SOC
ALT
D3 D2 0
PC4 PC3 O 0 O 0
PC2 PC1 PC0
STBA BFA INTRA
ALT3 1
Instructions
Start: MVI A, 20H OUT 13H MVI A, 00H OUT 13H
3. 8085 communicates with ADC using Port C in handshake mode
Port A used to input 8-bit data from ADC
Port C used for handshaking
ALT D3 D2 ALT3 1 0 PC5 O PC4 PC3 O O PC2 PC1 PC0
STBA BFA INTRA
EOC
OE
ADC resets EOC to LOW at end of
conversion 8155 sets BF to 1 to enable ADC output latch 8085 is waiting for BF to be SET to 1 and
Reads port A by making RD signal active (0)
At the end of read cycle RD goes HIGH (1) This resets BF signal to 0.
8085 waits for BF signal to be RESET and
starts conversion process again
8085 is waiting for BF
To know the status of BF signal 8085 reads
status register of 8155
D7 D6 D5 D4 D3 D2 D1 D0
X Timer INTEB BFB INTRB INTEA BFA INTRA
Status Word Definition
Status register shares same address as
control register
Program Instructions
8085 reads status register
Address of status register : 10H Reads port A if BFA = 1 Output temperature on port B
Status: IN 10H ANI 02H JZ Status IN 11H ;Step -4 Reads temperature value OUT 12H ; Step 5 display on LEDs
8085 reads status register
Address of status register : 10H Starts conversion again if BFA = 0
Again: IN 10H ANI 02H JNZ Again JMP Start
Complete Program
MVI A, 0AH OUT 10H Start: MVI A, 20H
OUT 13H MVI A, 00H OUT 13H
Configure 8155 Start Conversion
Status: IN 10H ANI 02H JZ Status IN 11H OUT 12H Again: IN 10H ANI 02H JNZ Again JMP Start
Read Status register Wait till BFA = 1 Read temperature value Display on LED Read status register
Wait till BFA = 0
Start Conversion again