0% found this document useful (0 votes)
44 views5 pages

Experiment2 8255 Interfacing

Detail of experiments

Uploaded by

Toufik Islam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views5 pages

Experiment2 8255 Interfacing

Detail of experiments

Uploaded by

Toufik Islam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

AL-Hussein Bin Talal University Dr.

Fadi Abu-Amara
College of Engineering Eng. Huda Saqallah
Department of Computer Engineering
Computer Interfacing and Peripherals Lab
Student Name: Student Number:

Lab2: 8255 Interfacing

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.

Figure 1: Pin-out diagram of the 8255 interfacing chip.

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.

3.1. Displaying two Hex-Digits on the LEDs


The 8086 microprocessor sends the information to be displayed to the 8255 and continues its
work (no need to wait!). The 8255 chip sends the information to the 74LS240 buffer and
from which to the LEDs as shown in the following figure.

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.

CNT3 EQU 3FD6H


BPORT3 EQU 3FD2H
CODE SEGMENT
ASSUME CS:CODE, DS:CODE
ORG 0
START: MOV SP, 4000H
MOV AL, XXH
MOV DX,CNT3
OUT DX,AL

Page 2 of 5
MOV AL, 95H
MOV DX,BPORT3
OUT DX,AL
HLT
CODE ENDS
END START

3.2. Blinking the LEDs


Upon executing the following code, the LEDs will display the following pattern repeatedly.

Figure 4: Results of the LEDs blinking exercise-1.

CNT3 EQU 3FD6H


BPORT3 EQU 3FD2H
CODE SEGMENT
ASSUME CS:CODE, DS:CODE
ORG 0
START: MOV SP, 4000H
MOV AL, XXH
MOV DX,CNT3
OUT DX, AL
MOV AL,0FH
MOV DX,BPORT3
J1: OUT DX,AL
MOV CX,0A000H
LOOP $
NOT AL
JMP J1
CODE ENDS
END START

On the other hand, when the following code is executed, the LEDs will show the following
pattern repeatedly.

Figure 5: Results of the LEDs blinking exercise-2.

CNT3 EQU 3FD6H


BPORT3 EQU 3FD2H

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

3.3. Controlling the LEDs through the TACT Switches


The information is sent from the TACT switches to the 8086 through the 8255 chip (port A).
Then, the same information is sent back from the 8086 microprocessor to the LEDs through
the 8255 chip (port B) as shown in the following figure.

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.

CNT3 EQU 3FD6H


APORT3 EQU 3FD0H
BPORT3 EQU 3FD2H
CODE SEGMENT
ASSUME CS:CODE, DS:CODE
ORG 0
START: MOV SP, 4000H
MOV AL, XXH
MOV DX,CNT3
OUT DX,AL
J1: MOV DX,APORT3
IN AL,DX
NOT AL
MOV DX,BPORT3
OUT DX,AL
JMP J1

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?

2. If the circuit of Figure 6 is to be programmed such port A is connected to the LEDS


while port B is connected to the TACT switches, find the new control word.

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

You might also like