Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi, I'm a newbie here.
Anyway, I was just wondering if you guys can help me out with this decorational problem I'm facing. I have this circuit board. Attached to it are 8 LEDs (light emitting diodes), and I attached it to my printer port. They all blink. Here's my problem: Do any of you know or have the code to make the LEDs blink in increasing order? I want them all to blink from 1 to 255. Since there are 8 LEDs, the 1st LED has the value of 1, the 2nd is 2, the 3rd is 4th, the 4th is 8, and so on. So when I run the program, it will be 1st LED on, then off, then, 2nd LED on, then off, then 1st and 2nd LED on , then off, then 3rd LED on , then off . Here's an illustration:
1 2 4 8 16 32 64 128
0 0 0 0 0 0 0 0so that by 255, all LEDs will light up, then off, and by 254, all but #1 LED will light up, then off. Since I like to be in a dark place while in my computer, and since it looks kinda cool to watch those LEDs go, I wanted it. I don't know much about debugging, but I know it is by debugging that this works. Could someone help me please? I'd really appreciate it if you do. :) Thank you, and God bless you
Yes, I'm confirming that me, from 210.213.81.182.pldtvibe.com, want the message posted on computing.net :)

In order to debug the code running the printer port, you need to HAVE the code.
Do you?
If at first you don't succeed, you're about average.M2

No no, you see that's the thing. I don't know the code for the LEDs. All I know is that it's done in the ms dos environment, and you type in DEBUG, press enter, and then you do some stuff that seems confusing. That's what I know. Thank you :)

DEBUG is a machine code editor/debugger. In order to use it you need to have more than a passing knowledge of machine code.
In order to do what you want you need to write some code that outputs each ASCII character for numbers 1-255 in sequence. You will need to introduce a delay between each number as machine code will run so fast that all the LEDs with appear to be permanently lit.
You would be better of using something like BASIC and outputting direct to the printer port from there.
Stuart

Look for asm code to address a parallel printer port.
Here's a list of which bits go to which pins:
PIN # 9 8 7 6 5 4 3 2
BIT # 7 6 5 4 3 2 1 0
If at first you don't succeed, you're about average.M2

"In order to use it you need to have more than a passing knowledge of machine code."
I'll drink to that; gender confusion not withstanding.
;)
If at first you don't succeed, you're about average.M2

That sounds like an interesting way to test the output of parrallel and serial ports, and a good way to learn how to interact between software and hardware.
One way to do this may be to use the print command from dos. maybe attach a loop of 1s.. then 2s then 3s ( the loop would repeat the number being printed because as stated above it would go on and of to fast if just sent once)
Basic programing could do the print and loop command , I dont know about a batch file but it is probably possible.
although all that said the computer would look for a printer at the end of the cable so i dont know what would happen there eitherand then again im sure someone here probably knows how to use an open com command that might work (Not Me)

G'day,
The previous posts are quite correct; you would require some knowledge of the system, especially debug, to achieve your aims.
You can use debug to produce "com" files that will do this sort of stuff. You would enter assembler code in debug and write it to a com file.
However, without sufficient knowledge it will be difficult.
A much easier approach would be to use something like QBasic and use the INP and OUT commands to write to the printer port's data register ( I assume that's where you have connected the LEDs as per M2GO's post).
Basically, what you need is a variable to write to the data port. You initialise it to zero, write to the port, wait a bit (you decide that) , increment it again, write to the port, wait....you get the idea. You then need some control structure to start and stop it (ie enter a key code) That's just a basic idea of a simple loop: you can expand on that to suit your own needs.
Your code could look something like this:declare x% as int (or byte?)
x%=0
for n=1 to 256
out data_port,x%
pause z (or whatever the BASIC command is)
x%=x%+1
next n
You would then add your control loop to start and stop it as you require.
Sorry about the sloppy code, but my choice would be to use C as it is more flexible.
Another option would be to post this on the DOS (or whatever they are calling themselves these days...) forum and they would have some answers for you too.
regards,
Elric

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |