Sunteți pe pagina 1din 4

Parallel Port Interfacing Applications

Background:

Parallel Part

A parallel port is a type of socket found on personal computers for interfacing with various peripherals.
It is also known as a printer port or Centronics port (this name came from a popular printer
manufacturing company 'Centronics' who devised some standards for parallel port). PC parallel port can
be very useful I/O channel for connecting your own circuits to PC.

PC parallel port is 25 pin D-shaped female connector in the back of the computer. Not all 25 are needed
always. Usually you can easily do with only 8 output pins (data lines) and signal ground.

The original IBM-PC’s parallel port had a total of 12 digital outputs and 5 digital inputs accessed via 3
consecu8ve 8-bit ports in the processor’s I/O space.
Lab Work:

Part1:

• Connect 8 LEDs to the data port of the parallel port as shown in the figure.

• Write an assembly language program that sends logic 1’s to the DATA port pins and test the program.

• Write an assembly language program that does the following

a. When user presses ‘1’ on the keyboard , the LEDs light from right to le>

b. When user presses ‘2’ on the keyboard , the LEDs light from le> to right

c. When user presses ESC the program exits


dosseg call delay
.model small jmp lop
.code left: mov al,01h
start: call test mov dx,378h
jmp start loop:out dx,al
test: rol al,1
push cx call test
push ax call delay
push dx jmp loop
mov ah,06
mov dl,0ffh off: mov al,0
int 21h mov dx,378h
cmp al,27 out dx,al
je exit jmp start
cmp al,'1' delay: push cx
je right push ax
cmp al,'2' push dx
je left mov cx, 10h
cmp al,'0' mov dx,0
je off mov ah,86h
pop dx int 15h
pop ax pop dx
pop cx pop ax
ret pop cx
right: mov al,80h ret
mov dx,378h exit: mov ah,4ch
lop : out dx,al int 21h
ror al,1 end
call test

Part2:

• Connect 8 LEDs as in part 1 and connect a switch as shown in the following figure

• Write an assembly language program that does the following

a. When switch is ON LEDs lights ON

b. When switch is OFF LEDs lights OFF


dosseg
.model small
.code
x1: mov dx,379h
in al,dx
and al,00001000b
cmp al,08H
je light
mov al,00000000b
jmp end1
light: mov al,11111111b
end1: mov dx,378H
out dx,al
jmp x1
end: mov ah,4ch
int 21h
END

S-ar putea să vă placă și