Programmable Peripheral Interface Devices: Support Chips
Programmable Peripheral Interface Devices: Support Chips
Programmable Peripheral Interface Devices: Support Chips
Interface Devices
256 X 8 A 8 PA0-7
AD0-7 8
Static
I/O Devices
IO/M RAM Port B
8085
RD B 8 PB0-7
WR
ALE Port C
CE Timer C 6 PC0-5
RESET
Port A
AD0-7 8 256 X 8 A 8
Static
CE RAM Port B
A15 8085
B 8
IO/M
RD
Port C
WR
Timer C 6
ALE
8085 8155
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 0, Input D3 D2 PORT C
0 0 ALT1
D1 Port B 1, Output
0 1 ALT2
D2 1 0 ALT3
Port C 1 1 ALT4
D3
D4 Interrupt Enable Port A D7 D6 Timer
0, Disable
0 0 NOP
D5 Interrupt Enable Port B 1, Enable 0 1 Stop
D6 1 0 Stop
after TC
Timer
D7
1 0 Start
I/O functions of Port C
I= O = Output
Input
STB = Strobe 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
8155 P Digital
8085 A/D
Input
IO/M o Converter
r
ALE
t
RD A
WR PC5
SOC
RESET P P
o o BFA
r r OE
CE t t
STBA
B C EOC
A15 E 2 O7 O2 O0
A14 E1
A13 A2
A12 A1 LED Analog
A11 A0 3-to-8 Decoder Display Input
Port Addresses of 8155
Chip Selection
A7 A6 A5 A4 A3 A2 A1 A0 Port
0 0 0 1 0 0 0 0 Control/Status
Register = 10H
0 0 1 Port A = 11H
0 1 0 Port B = 12H
0 1 1 Port C = 13H
1 0 0 LSB Timer = 14H
1 0 1 MSB Timer = 15H
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
SOC EOC OE
Control Word for configuration
D0 0 0, Input D3 D2 PORT C
Port A
D1 1 1, Output 0 0 ALT1
Port B
0 1 ALT2
D2 0 1 0 ALT3
Port C
D3 1 1 1 ALT4
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
ALT D3 D2 PC5 PC4 PC3 PC2 PC1 PC0
ALT3 1 0 O O O STBA BFA INTRA
1 0 0 0 0 0
SOC
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 PC5 PC4 PC3 PC2 PC1 PC0
ALT3 1 0 O O O 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
Status: IN 10H
ANI 02H
JZ Status
IN 11H ;Step -4 Reads temperature value
OUT 12H ; Step –5 display on LED’s
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 Configure 8155
Start: MVI A, 20H
OUT 13H Start Conversion
MVI A, 00H
OUT 13H
Status: IN 10H Read Status register
ANI 02H
JZ Status Wait till BFA = 1
IN 11H Read temperature value
OUT 12H Display on LED
Again: IN 10H Read status register
ANI 02H
JNZ Again Wait till BFA = 0
JMP Start Start Conversion again