| ctime: | 2009-11-10 14:06:19 |
| mtime: | 2009-11-10 14:06:19 |
One day I came up with an idea of making a 4x4 LED matrix which would connect to LPT port. This is my first self-made, real device. Before that, I only assembeled various little thingies, like binary counters, on a breadboard, which weren't intended for usage but rather for one-time demonstration.
One thing that served as an additional impulse for making the device, was the fact that I finally found out how to work with the input/output ports on OpenBSD: to enable access to I/O ports, use i386_set_ioperm(2) or i386_iopl(2) system calls, to read/write the ports use the C wrappers for in and out machine instructions (#include ).
Components I used: standard logic integreted circuits, namely, two 74HC373 (a latch) and one 74HC04 (the NOT gate); sixteen 220 Ohm resistors and sixteen LEDs.
The principles behind it are as follows: since the LPT port has only 8 data lines, we cannot obviously operate on all the 16 LEDs at the same time. So we need to either switch between them very fast, or we need to find a way to preserve the information on the one half of the LEDs while we are working with the other half. I chose the second option, because it is easier to program, and because with the first method — the computer would need to run in an endless loop and that would consume CPU power and... Well, I just felt like the second method would be more appropriate.
Soldering time: around... 10 hours. Those small wires were a real nuisance :-D
Programming time: around 4 hours.
Planning how to arrange elements:

The plastic coating on wires melted ofcourse:

Consturction complete:


The back:

Schematics:

Here is a video of the device, demonsrating a scrolling "HELLO WORLD" string:
Source code of the program that does that: 4x4_led_matrix.tar.gz.
usage: ./ledmtrx [-t delay] [-s || -b || -d || -r || -D] data
-t delay -- delay for scrolling or substituting display modes, see below
-s -- default mode, scroll text; 'data' is the text to scroll
-b -- display text by substituting chars; 'data' is the text to display
-d -- display an individual char; gedatati is the char
-r -- raw; 'data' is an unsigned short value to write to the matrix
-D -- display a demo; 'data' is ignored
Making this device was really fun! I will use it for at least two other programming projects I have in mind ;-)