Using The 74HC595 Shift Register To Drive 7-Segment Displays

Pinout of 74HC595

In a recent video our hacker [Electronic Wizard] introduces the 74HC595 shift register and explains how to use it to drive 7-segment displays.

[Electronic Wizard] explains that understanding how to apply the 74HC595 can increase the quality of your projects and also help keep the demands on the number of pins from your microcontroller to manageable levels. If you’re interested in the gory details you can find a PDF datasheet for the 74HC595 such as this one from Texas Instruments.

[Electronic Wizard] explains further that a shift register is like a small one byte memory where its data is directly available on its eight output pins, no input address required. When you pulse the clock pin (CLK) each bit in the eight bit memory shifts right one bit, making room for a new bit on the left. The bits that fall off the right hand side can daisy chain into another 74HC595 going out on pin 9 and coming in on pin 14.

[Electronic Wizard] goes on to extol the virtues of pin 13, the active-low Output Enable, which can be used to make sure junk doesn’t appear on your 7-segment displays during initialization. Also the 74HC595 can provide current itself which lessens the power demands on your micro.

[Electronic Wizard] covers how to use multiplexing to drive multiple 7-segment displays but notes the drawbacks of this method including large pin counts and high frequency flashing which, while invisible to the human eye, can become visible on some cameras and recording equipment making the 74HC595 a superior solution to multiplexing.

The bottom line is that using only three pins from the microcontroller you can drive one or more 7-segment displays. To learn more, including how to use the other pins and features of the 74HC595, be sure to click through to watch the video. If you’re interested in the 74HC595 you might like to read about how the Bus Pirate 5 used two of them to get an extra 16 pins on the board.

19 thoughts on “Using The 74HC595 Shift Register To Drive 7-Segment Displays

  1. I think this is the first time I saw the headline and knew what the chip was from the code. I used a three of these inline to use a single GPIO pin to program an 8-bit EEPROM.

  2. I have a circuit I designed using 74595 for driving a 10 digit 7 segment display, it cycles through all the digits but it does NOT do it sequentially, it effectively switches between them in a “random” (static) sequence, this effectively hides the flashing that occurred when it was left to right or right to left.

  3. Just 3 pins needed on a controller to control multiple LEDs (not just 7 segment LEDs). Usually fast enough for a lot of uses. I tested some code with two 595 daisy chained and even Kicad’ed a PCB but that was as far as it went. If had to do my StarTrek computer over again, I’d probably go the 595 route for the LEDs instead of having to have a pin for each LED (used an Adafruit Metro Grand Central M4 which did work ok). Go from 24+ pins to just 3.

  4. Along similar lines, in addition to using a shift register to drive many outputs, you can also use a shift register to manage a circuit with many inputs. It’s especially useful for bringing in a lot of signals that can’t easily be multiplexed, or just have to be sampled at the same time.

    In this case, pull out a 74×165.

    It’s got 8 inputs, serial in and out, and a parallel load pin.

    Strobing the the parallel load pin transfers the individual pin state to the internal shift register, then you can clock the signals into your microcontroller using the clock line and sampling the serial out. Like the ‘595 you can chain them and feed 8 inputs into each one, broadside.

    At the expense of some speed you can sample 8n signals, synchronously, with n chips and three microcontroller pins

  5. I wonder if anyone had the idea (a bad one, admittedly) to make an MCU with hardware support for SIPO and PISO shift registers entirely for its IO needs? I mean designed around the assumption, “the designer will put in as many shift registers as they want, no need for on package IOs”

      1. Yeah but y’know. A hardware peripheral built for the sole purpose of driving an unlimited number of 595 shift registers. So there’s no need to write the OE or RCLK or anything manually, and to the software all of them look like transparent pin outputs

  6. While shift register chips are great and there are many uses for them, I don’t think driving a 7-segment display is the best example. If you want to drive a 7-segment display, I think something like the CD4511B BCD-to-7-Segment Decoder chip would be a better option. Granted, it takes 4 input lines instead of the 1 that a shift register does, but it simplifies your logic for outputting the correct values. If your I/O pins are limited, then use a shift register and tie its outputs to a decoder. In fact, since the shift register is 8 bit, you could actually drive two decoders off of a single shift register.

    1. A CD4511 can only display the numbers 0-9. Using a shift register allows you to display some letters including A-F for hexadecimal values. If you are using a microcontroller, then it’s trivial to output the correct values to the shift register. You can also connect any output to any display segment to simplify the PCB layout.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.