Figure 9.1 - The Parallel Port
Figure 9.1 - The Parallel Port
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.
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.
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.
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
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
mov dx,378h
rol al,1
call test
call delay
jmp lop
loop:out dx,al
ror al,1
call test
call delay
jmp loop
mov dx,378h
out dx,al
jmp start
delay: push cx
push ax
push dx
mov dx,0
mov ah,86h
int 15h
pop dx
pop ax
pop cx
ret
end
_________________________________________________________________________________
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?
________________________________________________________________________________
_
________________________________________________________________________________
_
_________________________________________________________________________________
_________________________________________________________________________________
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:
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.