Anda di halaman 1dari 6

Islamic University of Gaza

Computer Engineering Department

2009

Assembly Language Lab #9

Eng. Tahani Z. Fourah


Islamic University of Gaza

Assembly Language Lab #9 Lab 9 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-PCs parallel port had a total of 12 digital outputs and 5 digital inputs accessed via 3 consecuve 8-bit ports in the processors I/O space.

66

Assembly Language Lab #9

D.

67

Assembly Language Lab #9 Lab Work:


Part1: Connect 8 LEDs to the data port of the parallel port as shown in the gure. Write an assembly language program that sends logic 1s 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 .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 right cmp al,'2' je left cmp al,'0' je off pop dx

68

Assembly Language Lab #9


pop ax pop cx ret right: mov al,80h mov dx,378h lop : out dx,al ror al,1 call test call delay jmp lop left: mov al,01h mov dx,378h loop:out dx,al rol 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

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

69

Assembly Language Lab #9

x1:

light: end1:

end:

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

70

Anda mungkin juga menyukai