Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Parallel port interfacing

Status
Not open for further replies.

burhanmz

Member
hello,
can someone help me with this.. (i didn't know which forum/section to post this in, so here it is)
i'm trying to blink leds using parallel port.. 8 leds using turbo assember TASM... but i can't seem to get the desired output.
since i'm using a p4 intel D 2.8GHz, x486, the 'loop' command takes 6 machine cycles right.. so i did this basic calc to determine a second delay between blinking leds.

Time = [loop machine cycles (6) x operand (CX) ]/processor speed
so for 1 sec, CX = 2.8e10 / 6
CX = 466.67e6

since CX is a 16 bit register, can hold FFFF max or 65k
so 466.67e6 / 65k = 7180 in decimal.. in hexa 1c0ch

here is the program code

STSEG SEGMENT STACK 'STACK'
DB 64 DUP(?)
STSEG ENDS

DTSEG SEGMENT

VAL1 db 01H, 02H, 04H, 08H, 10H, 20H, 40H, 80H, 40H, 20H, 10H, 08H, 04H, 02H
VAL2 db 0FEH, 0FDH, 0FCH, 0FBH, 0EFH, 0DFH, 0CFH, 0BFH, 0CFH, 0DFH, 0EFH, 0FBH, 0FCH, 0FDH

DTSEG ENDS

CDSEG SEGMENT
MAIN PROC
ASSUME CS:CDSEG, DS:DTSEG, SS:STSEG
MOV AX,DTSEG
MOV DS,AX


LEA SI,VAL2

MOV CX,20
ORDER: MOV DX,03BCH
MOV AL,[SI]
OUT DX,AL
PUSH CX
CALL DELAY
MOV AL,00h
OUT DX,AL
CALL DELAY
POP CX
INC SI
LOOP ORDER
JCXZ EXIT



DELAY: MOV CX,1CFCH
OUTER: PUSH CX
MOV CX,0FFFFH
INNER: LOOP INNER
POP CX
LOOP OUTER
RET


EXIT: MOV AH,4CH
INT 21H


MAIN ENDP
CDSEG ENDS
END MAIN



the output of this program is comming to be flashing of all leds twice... and then they stay off...
where i have i gone wrong..


parallel port pins
1, 10-25 ground
2-9 are my data pins connected to a octal buffer ULN2803 inputs, and outputs to a 220ohm and a led. i am giving ULN2803 5V regulated supply at pin 10 and ground at 9
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top