| The Parallel Port |
[May. 3rd, 2008|05:23 pm] |
| [ | mood |
| | nerdy | ] | When I took EE478, also known as the Digital Systems Course of Doom, we were given a deceptively difficult assignment: get information from the PC serial port. Seemed straightforward enough, write a program to send bits, read bits, easy. But reading the serial packets meant synchronizing a timing circuit to the stream of bits, shifting them into a register, then reading them out in serial, a task that took about a whole breadboard, and I'm not talking about the little ones. I'm talking about the four strips tied together, make sure all the power lines are connected, mammer-jammer breadboards.
So, when I started looking into using the parallel port, I steeled myself for the worst. I was expecting signals that appeared, then disappeared. I was expecting the libraries to control the thing to be pages of impossible navigations just to get a single bit to flip. I was ready for agony.
Thing is, however, the parallel port is remarkably straightforward. Pins 2 through 9 can be rigged, rather cleanly, to direct output bits, which, and this is the really neat part, just stay there. Like, even if the program exits.
The bit rate's also pretty respectable, provided you don't want to send large files over it. Run at "full rate," that is, without any wait statements between one number and the next, my scope tracks a bit at 1.5us, for a bit rate of almost 700kbaud.
What can I do with this? Well, it'd be easier to list what I couldn't do with it. The first thing I did was make a cheap-ass LED counter where, instead of wiring up flipflops, I just hooked three outputs of the parallel port to some LEDs and wrote a for loop. Next I discovered something delightful: connect a speaker between bit zero and ground, and you can program sounds. SO AWESOME.
So my linux lappy and me are nearly ready to start off into that deliciously murky area between software and hardware-- all that I need now is some more software for programming microcontrollers.. aaaaaaaand some actual microcontrollers.
Well maybe I'll work out some way to muck with those Z80's I have lying around.
Edit: You know what I can't do? PULSE WIDTH MODULATION. Yyeah, whenever the OS thinks to itself, "well, that byte can go to the parallel port NEXT cycle," the PWM sputters. My PWM LED *tries* to do that cool Macintosh fade-in-fade-out thing, but ends up looking kind of sad and pathetic as it sputters uuuUUuUUUuuuUUuuUUuup and dddDooOOoOOoOOoOoooOOoown in brightness. |
|
|
| Comments: |
What does it say about me that I eagerly read each one of these entries about EE-type projects, but that I never get the idea to start something myself? =(
That you need to read more Make: Magazine?
blog.makezine.com
I do indeed!! Thank you for the link!! | |