Shift Registers and AVR'S

Hi everbody. I recently got my order from sparkfun and was super excited to start messing with everything it came with. :slight_smile: One of the things I ordered was a shift register (specifically the Shift Register 8-Bit - 74HC595) Now I was just trying to mess around with it, by getting it light up 8 leds in a pattern. The problem is that I cant even seem to get it to work. I have Vcc and ground hooked up to power and ground respectively. I have the serial input pin hooked up to the avr as well as the clock pin and the latch pin. Now I thought that you made the serial input pin either high or low(to represent a 1 or a 0) and then you set the clock pin high. That shifts in the first bit. You would do that 8 times and then set the latch pin high and it would light up the leds, but i cant seem to get that to work.

Well, the obvious suspects are:

a) OE# has to be low, or you won’t see anything on Qn, ever, at all.

b) MR# has to be high, or the shift register will stay in reset (all zero).

c) Don’t forget to set the clock (SH_CP) pin low again after you set it to 1 (“then you set the clock pin high”–better remember the low, too).

d) Similarly, don’t forget to set the latch (ST_CP) pin low again after you set it to 1.

e) Don’t forget to set all of these pins to be outputs on the AVR.

lot of pins going on with that chip

Vcc: 5V

input logic levels: per spec sheet.

*OE - low, to enable output pins when desired, or low all the time.

*MR - high, no reset

after shifting bits as need be, pulse ST_CP to copy shift register to output parallel bit register.

Be sure to leave the data line unchanged just before and after the rising edge of SH_CP; the setup time is about 50nSec, per one data sheet I saw. Don’t clock until data has been stable for the spec’d hold time.

hope that helps.

The '595 is SPI-compatible, just connect it to the SPI pins on the AVR.

Man you guys are super amazing! Or i think the truth is I am super stupid… I wasn’t setting the latch pin back low so it would cycle the leds the first time really quick and then just stay there. Now I have it all figured out. Thanks so much guys. :slight_smile:

TabbyArtifact:
I wasn’t setting the latch pin back low…

I had a feeling. Of course, I have NEVER made this mistake, ever at all. No. Not ever.

Hahahaha. :slight_smile: Ya I still cant believe I didn’t think about that. I guess having other people to talk to really does help out.