Drive Seven Segment Display using Shift Register 74HCT595

Few days ago, I got a bunch of seven segment displays from a scrap shop (for me, scrap shops are like heaven). I had some projects that needed some of them. I first thought of using ordinary seven segment display drivers such as 7448, 74248, 4511 etc. But I found limitations using them as drivers. So I needed an alternative and found the shift registers good for my applications. It only needs 3 pins to transmit the data which saves pins when used with microcontrollers. We can display anything on the seven segments as we like and the serial input of the shift register also reduces the coding complexity if used with Arduino. The 74HCT595 is a Serial In Parallel Out (SIPO) shift register from 74XX family with storage register and 3-state output (High, Low and high Z). Shift registers are very useful when you want to expand the no. of outputs of your microcontrollers.

The shift register has 8+1 outputs which is enough to drive the eight segments of the seven segment display including the decimal point. Following is the pin configuration of the 595.


74hct595 pinout

74HCT595 shift register pinout

The Q0-Q7 are the parallel output pins and the Q7' is the serial output pin. The data bits are serially fed through DS (data serial) pin. ST_CP is the storage register clock and SH_CP is the shift register clock. OE is grounded to enable the outputs. The memory is cleared when the MR is tied to Low.


shift register seven segment schematic

Schematic for interfacing 74HCT595 with Arduino to drive seven segment displays

To use the shift register with Arduino, we first need to map the outputs of the shift register to the seven segment pins. Following is the mapping I used with my common cathode displays. For common anode displays, the bits are to be complemented. It uses the LSBFIRST scheme, that means the lowest significant bits (the right most bits) are transmitted first. The mapping let's you to enable the decimal point segment just by adding 1 to the value to display.

Segment Mapping

seven segment mapping

Seven segment mapping - View PDF

Sample Code

Following is a sample Arduino code to display all possible recognizable characters.

See this on GitHub

// Name : SevenSegment using 595 //
// Author : Vishnu M Aiea ( //
// Date : 15-06-2014 //
// Version : 1.0 //
// Notes : Code for using a 74HC595 Shift Register //
// to dispaly all possible characters on a //
// seven segment display (coommon cathode) //
int latchPin = 8; //Pin connected to ST_CP of 74HC595
int clockPin = 12; //Pin connected to SH_CP of 74HC595
int dataPin = 11; //Pin connected to DS of 74HC595
int segMap[19] = {252,96,218,242,102,182,190,224,254,
void setup() {
//set pins to output because they are addressed in the main loop
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
void loop() {
//count up routine
for (int j = 0; j<19; j++) {
//ground latchPin and hold low for as long as you are transmitting
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, segMap[j]);
//return the latch pin high to signal chip that it
//no longer needs to listen for information
digitalWrite(latchPin, HIGH);


driving seven segment with shift register

driving seven segment with shift register


  1. Arduino ShiftOut :
  2. 74HCT595 Datasheet [PDF]


Date published : 1:17 AM, 13-12-2014, Saturday
Last updated : 8:58 PM, 31-03-2016, Thursday


Made with for Open Source
Copyright © 2014 - 2021  Vishnu M Aiea
Site last updated : IST 11:38 PM 20-01-2020, Monday
Page rendered in 0.0017 seconds. Version 1.2.7