Activity No.
6
Parallel Port Interfacing
Course Code: EGR 27A Program:
Course Title: Computer Systems Organization with Assembly Language Date Performed:
Section: Date Submitted:
Name: Instructor:
1. Objective:
This activity aims to interface a circuit using a parallel port.
2. Intended Learning Outcomes (ILOs):
After completion of this activity the students should be able to:
2.1 Test the parallel port connectivity to a device
2.2 Design a circuit that can be interfaced using a parallel port
3. Discussion :
The Parallel Port
The parallel port is 25-pin, D-shaped socket found on personal computers. It is also called the
printer port because it is primary used to connect printers to computer. It is a simple and inexpensive tool
for building computer controlled devices and projects. Figure 9.1 shows the parallel port pin configuration.
Figure 9.1 – The Parallel Port
The parallel port has three types of port namely: data port, status port and control port. The data
port is also called the output port which comprises pins 2 to 9. The status port is also called the input port
which comprises pins 10, 11, 12, 13, and 15. The control port is also called the input/ output (I/O) port
which comprises pins 1,14,16, and 17. Pins 18 through 25 are the ground pins.
The data port, status port and control port have address designations which are 378h, 379h ( 379h
(Base + 1) and 37Ah (Base + 2) respectively.
4. Resources:
Computer with 32-bit Operating System
TASM
5. Procedure:
1. Type the following in Notepad.
TITLE int1.asm
COMMENT !
A program that used to send logic 1’s to the DATA port pins and test the program.
This program when executed must satisfy the following conditions:
a. When user presses ‘1’ on the keyboard , the LEDs light from left to right
b. When user presses ‘2’ on the keyboard , the LEDs light from right to left
c. When user presses ‘0’ on the keyboard , the LEDs light will turn OFF.
d. When user presses ESC the program exits.
!
dosseg
.model small
.code
start: call test
jmp start
test:
push cx
push ax
push dx
mov ah,06
mov dl,0ffh
int 21h
cmp al,27
je exit
cmp al,'1'
je left
cmp al,'2'
je right
cmp al,'0'
je off
pop dx
pop ax
pop cx
ret
left: mov al,80h
mov dx,378h
lop : out dx,al
rol al,1
call test
call delay
jmp lop
right: mov al,01h
mov dx,378h
loop:out dx,al
ror al,1
call test
call delay
jmp loop
off: mov al,0
mov dx,378h
out dx,al
jmp start
delay: push cx
push ax
push dx
mov cx, 10h
mov dx,0
mov ah,86h
int 15h
pop dx
pop ax
pop cx
ret
exit: mov ah,4ch
int 21h
end
2. Save the program as int1.asm.
3. Assemble the program.
4. Connect 8 LEDs to the data port of the parallel port as shown in the Figure 9.2.
Figure 9.2- Parallel Port Connection
5. Execute the program.
What happened to the LEDs?
________________________________________________________________________________
_
________________________________________________________________________________
_
_________________________________________________________________________________
6. Press 1 from the keyboard.
What happened to the LEDs?
________________________________________________________________________________
_
________________________________________________________________________________
_
_________________________________________________________________________________
7. Record the output in Table 9.1.
8. Press 2 from the keyboard.
What happened to the LEDs?
________________________________________________________________________________
_
________________________________________________________________________________
_
_________________________________________________________________________________
9. Record the output in Table 9.1.
10. Press 0 from the keyboard.
What happened to the LEDs?
________________________________________________________________________________
_
________________________________________________________________________________
_
_________________________________________________________________________________
11. Record the output in Table 9.1.
12. Press ESC from the keyboard.
What happened to the LEDs?
________________________________________________________________________________
_
________________________________________________________________________________
_
_________________________________________________________________________________
13. Record the output in Table 9.1.
6. DATA ANALYSIS:
Table 9.1- Result of Sample Problem A
Key Pressed LEDs ( 0-OFF) (1-ON)
D7 D6 D5 D4 D3 D2 D1 D0
1
2
Esc
PROBLEMS:
1. Connect a switch to any pin in the status port. Create a program that will light the LEDs “ON”
if the switch is ON , otherwise “OFF”.
2. Work with you’re a classmate and design a circuit that will let you apply parallel port
interfacing.
8. Assessment (Rubric for Laboratory Performance):