Professional Documents
Culture Documents
INSTITUTE OF ENGINEERING
HIMALAYA COLLEGE OF
ENGINEERING CHYASAL-6, LALITPUR
HCE077BEI022
TITLE: Programming in 8255 in Mode 0 and BSR mode.
OBJECTIVES: To configure 8255A and
INSTRUMENTS USED:
Dyna 85
Dyna log 8255 PPI
THEORY:
PPI 8255 is a general purpose programmable I/O device designed to interface the CPU with its outside
world such as ADC, DAC, keyboard etc. We can program it according to the given condition. It can be
used with almost any microprocessor. It is used to parallel data transfer between processor and slow
peripheral devices like ADC, DAC, keyboard.
Port-A (8-bit) - one 8-bit output latch/buffer and one 8-bit input buffer.
The Bit Set/Reset (BSR) mode is available on port C only. Each line of port C (PC7 - PC0) can be set or
reset by writing a suitable value to the control word register. BSR mode and I/O mode are independent
and selection of BSR mode does not affect the operation of other ports in I/O mode.
Input/Output mode :
This mode is selected when D7 bit of the Control Word Register is 1. There are three I/O modes
1. Mode 0
2. Mode 1
3. Mode 2
Mode 0: This mode is the simple input output mode of 8255 which allows the programming of each port
as either input or output port. The two halves of port C can be either used together as an additional 8-
bit port, or they can be used as individual 4-bit ports. Since the two halves of port C are independent,
they may be used such that one-half is initialized as an input port while the other half is initialized as an
output port. It does not support handshaking or interrupt capability and input ports are buffered while
outputs are latched.
Base 0 0 1 1 0 0 0 0 :30H PA Address:
0 1 :31H PB
1 0 :32H PB
1 1 :33H CR
D7 D6 D5 D4 D3 D2 D1 D0
1 0 0 0 X X X X X=0
D7 D6 D5 D4 D3 D2 D1 D0
1 0 0 0 X 0 1 X X=0
Addres Mnemonics Hex Code
s
PROGRAM
C000 MVI A, 82H 3E
MVI A, 82H
C001 82
OUT 33H
C002 OUT 33H D3 IN 31H
C003 33 OUT 30H
C004 IN 31H DB RST1
C005 31
C006 OUT 30H D3
C006 30
C007 RST1 FF
Data in P A : A2H
Data in PB : A2H
D7 D6 D5 D4 D3 D2 D1 D0
0 X X X 0 1 0 1 X=0
Hence, every bit except the D2 was reset and D 2 was set.
D7 D6 D5 D4 D3 D2 D1 D0
1 0 0 0 0 0 1 0 X=0
D7 D6 D5 D4 D3 D2 D1 D0
1 0 0 0 0 0 0 1 X=0
Program
MVI A, 81H
OUT 33H
IN 32H
ANI 0FH
RLC
RLC
RLC
RLC
OUT 32H
RST1
Before execution:
Pc :11001001
After execution:
Pc :10010000