The bare board itself just has 25 offset holes that the parallel connector solders into, and 26 holes in 0.10" centers, for a breakout. I soldered an LED into each of the data pins, connected all the ground lines, and connected those to each other with a big current-limiting resistor. (If you build this, the resistor is essential and should be at least the rating shown: 1 kohm. If you scrimp, you run the very real risk of burning out a chip on your motherboard, which is a Bad Thing.)
The positive lead of each LED connects into a data line. I put insulation (stripped off slightly larger-gauge wire) onto each LED lead where it connects into the proto board. The negative leads are all tied to one lead of a ½ watt resistor, which connects them to ground. The maximum current drain on any leg should be about a milliamp. A motherboard should be able to source at least 6 milliamps, giving plenty of margin. If you're nervous, use a bigger resistor yet. I prefer colored-body LED's rather than water-clear ones because the on-state is much more distinct and omnidirectional.
Microsoft qbasic isn't a particularly pretty language but it's quick. Go to
start, programs, MS-DOS prompt, and type 'qbasic' to start it. If this doesn't
work, you need to install qbasic from an msdos source. If it does, but these
programs don't work, try shutting the system down and rebooting in msdos mode.
In any case, from qbasic you can easily dump stuff on the parallel port by the
'out' command, like 'out &h378, 0' which will turn all your LED's off. The
first argument is the address. Many computers have their parallel ports located
at address h378; if not, try h278. The second argument is the bytecode, ie it
should be a number between 0 and 255, which will specify in binary which pins to
turn on and which to turn off.
A simple program, then, would look like:
port% = &h378 For x% = 0 to 255 Out port%, x% Next x% Out port%, 0
This will count to 256 in binary, which appears as if each pin is
toggling at half the speed of the pin to its left. Nice effect.
Another neat effect is a random output, like so:
Randomize timer port% = &h378 Print "hit ESC to exit (exit may not be immediate)" Do Out port%, random*255 loop until inkey$ = chr$(27) Out port%, 0This uses an interrupt: the system will randomly blink until you hit the ESC key, which will trigger the interrupt and exit the program.
Print "hit ESC to exit (exit may not be immediate)" Pi% = 3141 Waittime% = 5000 ' arbitrary delay port%= &h378 do For x% = pi% * 2 Out port%, 81 For killtime% = 1 to waittime% * cos(x%/100) Next killtime% Out port%, 170 For killtime% = 1 to waittime% * cos(x%/100) Next killtime% Next x% loop until inkey$ = chr$(27) Out port%, 0
This alternates turning pins 0,2,4,6 on and 1,3,5,7 off, waiting a variable amount of time, and then reversing the lights. It cycles so quickly, however, that we can't see the individual on-off transitions, but only the ratio of off-to-on, so to our eyes it looks like the LED's are smoothly varying in intensity. This is similar to a digital-to-analog (D/A) converter. If done in a real-time operating system (ie not under Windows) you can use this sort of technique to control newer servos used on radio control equipment.
On to part two: input via the parallel port!
This page created 3/15/02, last modified 8/16/02
comments, suggestions, questions, email me!
Back to the main page