Circuit 05 – Shift Register

Shift Registers are a type of Integrated Circuit (IC) or chip.  The Shift Register is a serial to parallel convertor that allows us to control eight additional output pins with just three on the Arduino.  You can link them together to give you even more (unlimited) outputs!

A Shift Register works by clocking in the data and then locking (or latching) it.  This is achieved by setting the data pin to high or low and then pulsing the clock.  This is repeated until you have shifted out eight bits of data and set all the pins.  Now you can pulse the latch and all eight bits are output to their representative pins.

Quick Facts about the 74HC959N

  • Pins run anti-clockwise from top left (notch up).
  • Pin 8 = Gnd & Pin 16 = +Vcc.
  • Data = 15, 1, 2, 3, 4, 5, 6, 7.
  • Pin 10 = Reset (Vcc?).
  • Pin 11 = Clear, goes to Arduino Pin.
  • Pin 12 = Latch, goes to Arduino Pin.
  • Pin 13 = Output Enable (Gnd?).
  • Pin 14 = Data, goes to Arduino Pin.
  • Datasheet for the 74HC959N

Here is the code for this circuit using a function called ShiftOut which sends a single byte of data to the chip.

It’s possible to achieve the same effect without using the shiftout function.  The following code uses a bit shift to pass values into the chip one at a time.

It is possible to control the shift register one bit or output at a time and this would be useful when output pins were at a premium due to the complexity of your design.

In this example we are switching on each LED before turning it off again.  Notice how there are now only eight pins.

Leave a Reply

Your email address will not be published. Required fields are marked *

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