EEE-334 Experiment-4
Shahjalal University of Science and Technology
Department of Electrical & Electronic Engineering (EEE)
Experiment No. 04: Study on the programming of 8255 PIO controller by utilizing
the 7 segment display and the LEDs in the MDA-8086 module.
Objectives:
To load “machine code” containing program control instructions to MDA-8086,
execute the program of 8255 PIO controller by blinking a random character ‘1-9’
for random times (1-20) and verify the
results.
8255A:
The 8255A/82C55A interfaces peripheral
I/O devices to the microcomputer system
bus. It is programmable by the system
software. It has a 3-state bi-directional 8-
bit buffer which interfaces the 8255A /
82C55A to the system data bus. It reduces
the external logic normally needed to
interface peripheral devices. The 8255A /
82C55A replaces a significant percentage
of the logic required to support a variety of
byte oriented input/output interfaces.
8255A works with Printers, keyboards,
displays, floppy disk controllers, CRT
controllers, machine tools, D-to-A and A-
to-D converters, etc. Connections to these
peripheral devices are made via the 8255A
/82C55A Port Pins.
A port is designated as a standard port;
CPU uses the in instruction to read data from this port and out instruction to write
data into this port. A standard port with an 8-bit address is called a fixed port
Prepared by
Jibesh Kanti Saha
EEE-334 Experiment-4
(fport). Another standard port with 16 bit address is called a variable port (vport).
The port addresses are indirectly given in the instruction using DX register.
There are three I/O ports within 8255: PAR, PBR and PCR. The direction of these
ports can be set as input or output by writing control byte (Cbyte) into the control
register (CR). The CR is a port register but it is not attached with any I/O lines.
CA7SDD (Common Anode Seven Segment Type Display Device):
In CA configuration all anodes are
shorted to +5 Volt (logic high) state.
Therefore to turn on a specific LED
the cathode part of the diode must
be at 0 Volt (logic low) and vice
versa. The sequence of byte format
for this kind of 7 segment type
display is given below:
DP g f e d c b a
1(Off) 1(Off) 1(Off) 1(Off) 1(Off) 1(Off) 1(Off) 1(Off)
0(On) 0(On) 0(On) 0(On) 0(On) 0(On) 0(On) 0(On)
For example, to display ‘3’ on CA7SDD the numerical value 10110000b or B0h has
to be sent via port. All data movement from MPU to port is done via AL-register
(AX-register) and vice-versa.
Exercise 1: Write ASM code to blink each character ‘3’ on the CA7SDD for three
times in a sequence. Also convert the ASM code into MACHINE code.
Prepared by
Jibesh Kanti Saha
EEE-334 Experiment-4
code segment
assume cs:code, ds:code
org 1000h
CByte EQU 80h
CR EQU 1Fh
PAR EQU 19h
L1: mov al,CByte ; CByte = 80h
out CR, al ; CR = 1Fh
mov dl, 07h ; dl works as counter
L2: mov al, 0B0h ; for displaying '3'
out PAR, al ; PAR = 19j
mov cx, 0FFFFh
loop $
L3: mov al, 0FFh ; display blank
out 19h, al
mov cx, 0FFFFh
loop $
L4: dec dl
jnz L2
hlt
code ends
end
Find the Contents of AX, BX, DX, IP and Flag registers after each step and put
them in a tabular form.
Repeat the same but display the ‘dot’ after 3.
Prepared by
Jibesh Kanti Saha
EEE-334 Experiment-4
Assignment:
Write ASM code to blink each character ‘0’ to ‘9’ on the CA7SDD for three times in
a sequence. Also convert the ASM code into MACHINE code.
LED control:
8255 is also interfaced with the LEDs in the MDA-8086 module. PPIB is the output
register whose value determines which led should turn of or off.
Exercise 2: Execute the commands below (find machine code form emu8086
software) and turn on each LED light.
CODE SEGMENT
ASSUME CS:CODE,DS:CODE,ES:CODE,SS:CODE
;
PPIC_C EQU 1FH
PPIC EQU 1DH
PPIB EQU 1BH
PPIA EQU 19H
;
ORG 1000H
MOV AL,10000000B
OUT PPIC_C,AL
;
MOV AL,11111111B
OUT PPIA,AL
;
MOV AL,00000000B
OUT PPIC,AL
L1: MOV AL,11110001B ;Change the values of
L2: OUT PPIB,AL ; AL to light up different LEDs.
hlt
code ends
end
Prepared by
Jibesh Kanti Saha
EEE-334 Experiment-4
Find the Contents of AX, BX, DX, IP and Flag registers after each step and put
them in a tabular form.
Turn on the green and the yellow LED together.
Assignment:
Turn the LEDs on like the following figure below. Add a certain delay after each
LED lighting.
Procedure:
1. Write the assembly code (ASM code) in emulator (emu8086).
2. Save the file as ****.asm in the same folder where MASM execution is
present.
3. Open the MASM.exe.
4. MASM.exe is used create ****.LST and ****.OBJ files form ****.ASM file.
5. If there are errors or warnings of any kind, then ****.OBJ file will not be
generated.
6. The ****.LST file will show the desired MACHINE codes for any writtem ASM
codes. The machine codes found are to be typed via keyboard (input device)
of the MDA-8086 microprocessor trainer kit.
7. To go to address of a memory location press AD key. This command key
allows the user to set the 20 bit address of a memory location in the format
of [Segment:Offset].
8. To enter to the offset part we have to press the : key.
9. For exchanging the 8-bit data on a specific memory location press DA key.
10.When all data are in specific memory location press the RESET button.
11. Press STP (single step: this key allows executing one instruction at a time)
and + (increment by one: this key allows moving to the next memory location)
to see the step by step execution of the ASM code on the LCD unit.
12. Use REG and +,- to check the values of different register.
13. To execute the program fully press AD, : and then GO.
Prepared by
Jibesh Kanti Saha