Jpantoga:
Hey everybody!
I recently purchased a tri-color LED matrix controller to help me learn programming with an AVR microcontroller. Because I do not have a full understanding of using the backpack via SPI at the moment, I would like to first try programming the onboard ATmega8 myself in order to display a set pattern on the LEDs to verify that I have learned the architecture of the board. However, before I set out to program, I would first like to understand how to use the 74HC595 first.
Joseph,
I’m not familiar with the matrix controller (not sure if it’s a chip or a module or a commercial product that you have…)
To get started with the AVR you will need to buy (or borrow) development tools. At a minimum you’ll need the AVR ATAVRISP Kit or the STK500 ATSTK500 kit. There are non-Atmel alternatives including building your own parallel port adapter. Next you’ll need a PC running Atmel AVR Studio.
For the actual hardware you’ll need a prototype ‘block board’ or equivalent to connect several parts together, and a regulated power supply.
Perhaps you have these? Or, access to them through your school?
For the 74HC595 start with the DIP version and a datasheet. Alternatively, look for the Texas Instruments Power Logic version, which can drive much greater current to the load (if you want to connect multiple LEDs or small lamps to the outputs). TI part number:
TPIC6C596D
So far all of these items can be found at Digikey.
The '595 (and TI '596) devices are shift registers (SRs), that require serial data and a clock to shift the data through the 8 shift registers. More than one device can be cascaded, by carrying the QH (DOUT) signal to the SER (SER IN) of the next stage.
Data in the SRs is loaded to separate latches upon another clock signal, RCLK, and provided the outputs (OE) are enabled the data will appear at the outputs.
To know if the device is doing anything you could attach eight LEDs (with current limit resistors) to the outputs, such that a low output turns on the LED. Next you need to feed serial data, SRCLK, and RCLK to the IC, from your AVR. The SRCLR and OE lines can be tied off as they are not needed in a simple experiment, and they should not be left to float either.
For a quick test of the design you could set the SER data, clock the SRCLK once, reset the SER data, wait a quarter second and clock the SRCLK with similar quarter second pauses for seven more times. Nothing will be seen unless the RCLK is also clocked after each SRCLK, so that fresh data from the SR is transfered to the outputs. This will give a single flash passing from one LED to the next.
At this point you will be well on the way to creating your own patterns.
Instead of descrete LEDs you could try a seven segment LED display, eight if you count the decimal point. For this to make any sense you will need to send bit patterns to the LED that create numbers (and limited alphabet) symbols. The AVR can be programmed with a LUT (Look Up Table) to translate data (a byte) in to a pattern (different byte) for display.
Good Luck, Let us know what you invent!
Peter