I always wanted to make one of these. I keep it "real" by figuring out how to design and program the project without any outside help, although the concept is nothing new (think calculators and hand-held games developed starting in the 70's).
The problem. The micro controller has only 8 output pins, but I need it to control 15 or more LEDs to display numbers, characters, or even motion display.
The solution is to multiplex the output pins so more LEDs can be used.
How it works: The screen is made by making a grid of horizontal and vertical wires with a LED bridging each intersection. Each column is turned on and back off in sequence with the appropriate row(s) turned on to make the pattern for the displayed character. (Technically, the column is on when it is low (0 bit) so the LED is on when its row is 1) The scanning happens so fast that it seems like several LEDs are on to create the number letter or graphic.
The programming.
I wrote the program so that I could change the displayed graphics without having to rewrite the thing much. Just new data added.
First, I have to define the shape of the characters to display. For example the letter "A" or number "1" dot patterns must be defined and stored in memory.
Second, There is an area in memory called the "frame buffer" where the character or graphics pattern is placed so that so that the next part of the program reads the buffer and puts it on to the screen.
Third, As stated, the buffer is read one column at a time and output to the screen. This scanning or mutliplexing section of code loops fast so the display seems solid. You can see the strobing effect if you turn your head quickly. You might have noticed this on LED or fluorescent displays.
The program loops and advances a counter to grab the next character to display.
The program I have running counts through the hexadecimal code 0-9, A-F. It is set up using a 3x5 LED grid. The program is only 192 bytes long and most of that is defining the characters. The frame buffer and multiplexing routines are only about 25 lines of code total.
Expanding. To make a larger display, say 20 columns x 6 rows for scrolling messages, I would use a shift register on one output pin and clock out a bit for the columns and increase the size of the frame buffer accordingly.
Okay, well I'm nerdy and just wanted to show how this is done, or at least how I did it. I hope to play some more with these ever fun microcontollers.
The problem. The micro controller has only 8 output pins, but I need it to control 15 or more LEDs to display numbers, characters, or even motion display.
The solution is to multiplex the output pins so more LEDs can be used.
How it works: The screen is made by making a grid of horizontal and vertical wires with a LED bridging each intersection. Each column is turned on and back off in sequence with the appropriate row(s) turned on to make the pattern for the displayed character. (Technically, the column is on when it is low (0 bit) so the LED is on when its row is 1) The scanning happens so fast that it seems like several LEDs are on to create the number letter or graphic.
The programming.
I wrote the program so that I could change the displayed graphics without having to rewrite the thing much. Just new data added.
First, I have to define the shape of the characters to display. For example the letter "A" or number "1" dot patterns must be defined and stored in memory.
Second, There is an area in memory called the "frame buffer" where the character or graphics pattern is placed so that so that the next part of the program reads the buffer and puts it on to the screen.
Third, As stated, the buffer is read one column at a time and output to the screen. This scanning or mutliplexing section of code loops fast so the display seems solid. You can see the strobing effect if you turn your head quickly. You might have noticed this on LED or fluorescent displays.
The program loops and advances a counter to grab the next character to display.
The program I have running counts through the hexadecimal code 0-9, A-F. It is set up using a 3x5 LED grid. The program is only 192 bytes long and most of that is defining the characters. The frame buffer and multiplexing routines are only about 25 lines of code total.
Expanding. To make a larger display, say 20 columns x 6 rows for scrolling messages, I would use a shift register on one output pin and clock out a bit for the columns and increase the size of the frame buffer accordingly.
Okay, well I'm nerdy and just wanted to show how this is done, or at least how I did it. I hope to play some more with these ever fun microcontollers.