LED Matrix -- Single Character


Let's turn our attention now to seeing how to drive dot matrix LED displays. We'll begin simply, with a single 5 X 7 unit, driven directly by the Port B pins, with five transistors on Port A to sink the LED currents. The circuit is quite straightforward:

I suppose you could bring the package count down a bit with the ULN2003A seven-banger Darlington array chip, but the 2N2222 transistors here seem up to the task.

The thing to note is that seven of the Port B lines drive the columns, while each of the five columns sinks current by means of the transistors. Clearly, we're using multiplexing to make it seem as though all of the columns are lit simultaneously, but of course that's the old persistence-of-vision trick at play. Software interrupts are orchestrated by Timer0 to handle things in the background.

The only tricky business is to know how and when to light each element within the matrix to create recognizable characters. Not to worry; I've taken care of that for you! If you check out the source code, you'll see that I've written three include-files containing all of the character data: one for lower case letters, one for upper case letters and one for numeric digits. Also featured are punctuation marks, symbols, and a few graphic characters. These are all mapped to ASCII codes in the same way as what you'd find in Windows programs.

If it isn't clear, you can use these character data sets in your own programs.

The main loop of the program simply runs through the characters sequentially so that you can see them all. Nothing too exotic going on. But be sure to notice how neatly PIC Micro Pascal handles the character arrays stored in flash memory as constants. I really can't say enough about how elegant this language is.

By the way, I got the LED matrix array units surplus from All Electronics. But the circuit and software should be usable with any such devices, just rendering whatever pinout changes might be necessary.

Click to get the source code.
Click to get the schematic PDF.

Next Project: LED Matrix -- Two Characters

No comments:

Post a Comment