Experiment2 8255 Interfacing
Experiment2 8255 Interfacing
Fadi Abu-Amara
College of Engineering Eng. Huda Saqallah
Department of Computer Engineering
Computer Interfacing and Peripherals Lab
Student Name: Student Number:
1. Objectives
The objective of this lab is to show how the 8255 chip can be used as an interface between
the 8086 microprocessor, the LEDs, and the TACT switches.
2. Introduction
The 82C55 is a popular interfacing component, that can interface any TTL-compatible I/O
device to the MP. It has 24 pins for I/O that are programmable in groups of 12 pins and has
three distinct modes of operation. The following figure shows the pin-out diagram of the
82C55.
The 82C55 is programmed through the two internal command registers as shown in figure 2.
- Group B operation:
o Mode 0: the basic input/output mode that allows the pins of group B to be
programmed as a buffered input or latched output connections.
o Mode 1: data are transferred through port B and handshaking signals are provided
by port C.
- Group A operation:
o Mode 2: port A becomes bi-directional allowing data to be transmitted and
received over the same eight wires.
o When the command byte bit-7 is reset, any bit of port C can be set or reset; if the
82C55 is operated in either mode 1 or mode 2.
o The bit set/reset: often used to control a system via setting/resetting control pins.
3. Procedure
In this section different exercises will be performed such as: Controlling the LEDs directly
from the 8086 microprocessor and controlling the LEDs through the TACT switches.
Figure 2: The 8255 programming diagram.
Figure 3: Functional circuit description of the 8086 interfacing with LEDs via 8255.
The following code is used to program the 8255 to transfer the data from the accumulator
register to the LEDs through the buffer. For this experiment, answer the following:
- What the 3FD6H and 3FD2H represent?
- Find the control word that must be written to the 8255 (the seventh line in the
following code).
- Modify the code to display 77H, waits for 2s, display 55H, waits for 2s, and exit.
Page 2 of 5
MOV AL, 95H
MOV DX,BPORT3
OUT DX,AL
HLT
CODE ENDS
END START
On the other hand, when the following code is executed, the LEDs will show the following
pattern repeatedly.
Page 3 of 5
CODE SEGMENT
ASSUME CS:CODE, DS:CODE
ORG 0
START: MOV SP, 4000H
MOV AL, XXH
MOV DX,CNT3
OUT DX,AL
J0: MOV AH,6
MOV AL,0FH
MAIN: CALL OUTPUT
NOT AL
DEC AH
JNZ MAIN
MOV AH,8
MOV AL,1
J1: CALL OUTPUT
ROL AL,1
DEC AH
JNZ J1
MOV AH,8
MOV AL,1
J2: CALL OUTPUT
ROL AL,1
ADD AL,1
DEC AH
JNZ J2
JMP J0
OUTPUT: MOV DX,BPORT3
OUT DX,AL
MOV CX,9000H
LOOP $
RET
CODE ENDS
END START
Figure 6: Functional circuit description of the TACT switches interfacing with LEDs.
Page 4 of 5
When the following code is executed, the information input by the TACT switches will be
displayed on the LEDs.
CODE ENDS
END START
Exercises
1. Referring to the circuit of Figure 3, why the information is not sent directly from the
8086 to the LEDs. Why the 8255 and the 74LS240 chips are used?
3. Write and execute a program that displays a bouncing ball on the LEDs. Use a TACT
switch to start and stop the program execution.
4. Write and execute a program that make the LEDs show the following pattern.
Page 5 of 5