3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

How to use a 74HC595 Shift Register with a AVR ATtiny13

How to use a 74HC595 Shift Register with a AVR ATtiny13
If you have been playing with microcontrollers and electronics then you have likely seen LED dot matrix displays and other projects that use shift registers like 7-segment displays and more. This instructable goes over a quick intro to the 74HC595 8-Bit Serail to Parallel Shift Register with Latch and how to interface it to an AVR ATtiny13 to flash some LEDs.

What you need:
1 - Breadboard
1 - Power Source - 7805 or some other 5v source
1 - ATtiny13 and a way to program it ( I'm using the AVRISP mkII with AVRStudio 4.17 w/ WinAVR)
1 - 74HC595 Shift Register
1 - 100uF cap
1 - 0.1uF cap
1 - 10K resistor
8 - LEDs
8 - 470ohm resistors
~15 - hookup wires


What is a Shift Register?

Serial to Parallel Shift Registers are ICs that allow "serial" data to be clocked in on 1 pin and stack up in a register which is output on 8 parallel pins (in the case of a 8-bit shift register). As data is clocked in, it shifts all the other bits over one position with the end one falling off. Common shift registers are 74HC164 and 74HC595.
There's a couple of good online tutorials about these with animations.

www.eelab.usyd.edu.au/digital_tutorial/part2/register01.html

The 595 has another feature which is cool. It's called a latch. It allows the outputs to show the current bits which have been latched in the Latch Register while new data is shifted into the Shift Register. Then toggle the latch pin and the new data is copied into the Latch Register.

Here's a link to the 74HC595 Datasheet:

www.onsemi.com/pub_link/Collateral/MC74HC595A-D.PDF


Check Out a Youtube Video of the Circuit in Action


 
Remove these adsRemove these ads by Signing Up
 

Step 1Get Familiar with the 595

Get Familiar with the 595
The 74HC595 is a pretty cool little package. We are going to hook it up to shift in a pattern of leds

The pin out  goes like this:

Pin 1 - Output B - source for LED (+)
Pin 2 - Output C - source for LED (+)
Pin 3 - Output D - source for LED (+)
Pin 4 - Output E - source for LED (+)
Pin 5 - Output F - source for LED (+)
Pin 6 - Output G - source for LED (+)
Pin 7 - Output H - source for LED (+)
Pin 8 - GND
Pin 9 - Serial Output - Carries Value from Output H to Data Pin (pin 14) of another 74HC595 to create a chain of SR's.
Pin 10 - Shift Register RESET -  Active LOW clears data in Shift Register, Latch Register is no affected.
Pin 11 - Shift Clock - LOW to HI transition shifts in data (0 or 1) from the Data Pin (pin 14). This can be toggled very fast in applications where you want a fast refresh rate like displays. I think you can toggle it on the order of 1000Hz +
Pin 12 - Latch Clock - LOW to HI transition latches the SR data to the outputs - The latch in our case will be triggered after every 8th bit is shifted in.
Pin 13 - Output Enable - Active LOW - Allows data in the Latch Register to show on the display. Typically this will be kept low, so you could just hard-wire it, but I have the AVR setup to control it.
Pin 14 - Serial Data In (Data Pin) - Don't be scared by the word "serial". It just means digital 1 or 0 on a single pin. This is where the AVR will feed in the bits
Pin 15 - Output A - source for LED (+)  - It's a weird spot for it but it works
Pin 16 - VCC 2.0-7.0 VDC

« Previous StepDownload PDFView All StepsNext Step »
10 comments
Jan 19, 2011. 9:16 AMlefam says:
what is the total amount of current that the 595 shift register can sink and source?
Jan 23, 2011. 10:08 PMlefam says:
thanks. it helped a lot...
Dec 30, 2010. 8:10 PMarthur92710 says:
Hi, this code is very helpful. I have a question, it uses a for loop to fill the register from an array, how can I send a binary or hex code. I am using this to build a 10 x 10 matrix.
Thanks!
Jan 1, 2011. 9:30 PMarthur92710 says:
Thanks! This will help me a lot!
Oct 22, 2010. 7:25 AMSuperFlyGT says:
Thanks for the quick tutorial. I was looking at using this part for a personal project and this helped to clear up some questions I had.

Out of curiosity, why ground Pin 9 (serial data out / QH')? If the output is of QH is high (and by extension Pin 9), you're shorting a high output to ground.

Another version of the datasheet (for HC595, not HC595A, http://focus.ti.com/lit/ds/symlink/sn74hc595.pdf) lists a clamping current of +/- 20 mA max which I suspect is saving the chip from blowing. It would be safer to either leave this output floating in this application or put a resistor to ground.
Aug 11, 2010. 8:27 AMtissit says:
avrdude is not a compiler.
Jul 23, 2010. 12:49 AMju1ce says:
Thanks for this tutorial - I really like your clear way of presenting things.

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
14
Followers
4
Author:roznerd(Launchpad Electronics)
Mechanical Engineer