Yeah, nah, aye

Main categories:

8-Digit 7-segment Shift Register Bits

There is a fairly common multiplexed 8-digit 7-segment display that is sold on the usual websites. They use two 74HC595 shift registers to drive the segments and the digits. They looked pretty handy so I grabbed a couple, but I had to work out the register bits myself.

Wiring

A mode 0 SPI bus can drive this display. They also work happily on 3.3 volts, just a little dimmer. Connect:

  1. MOSI to DIO
  2. SCK to SCK
  3. CS/SS to RCK

Serial protocol

Two bytes must be sent:

  1. LSB: Digit selection (active high)
  2. MSB: Segment selection (active low)

The descriptions here assume the following digit layout:

 ___   ___   ___   ___   ___   ___   ___   ___
|   | |   | |   | |   | |   | |   | |   | |   |
 ---   ---   ---   ---   ---   ---   ---   ---
|   | |   | |   | |   | |   | |   | |   | |   |
 --- . --- . --- . --- . --- . --- . --- . --- .
  d1    d2    d3    d4    d5    d6    d7    d8

It also assumes this segment layout is repeated for each digit:

  _a_
f|   |b
  -g-
e|   |c
  -d- dp

Digit selection:

The common anode of each digit is mapped onto a different bit in this register. These are of course active high.

Bit | 7  | 6  | 5  | 4  | 3  | 2  | 1  | 0  |
----+----+----+----+----+----+----+----+----+
    | d4 | d3 | d2 | d1 | d8 | d7 | d6 | d5 |

For example, a value of 0x40 selects digit 3. A value of 0x05 would select digits 5 and 7.

Segment selection:

All segment cathodes (A-G, plus decimal point) of all digits are mapped onto eight different bits in this register. Remember these are active low.

Bit | 7  | 6  | 5  | 4  | 3  | 2  | 1  | 0  |
----+----+----+----+----+----+----+----+----+
    | dp | g  | f  | e  | d  | c  | b  | a  |

For example, a value of 0xa4 would select segments A, B, D, E, and G, drawing a numeral 2.

Protocol capture

Here is a sample capture of the numeral 1 being put onto the left-most display digit. RCK/CS edges are out of view in this screenshot, but they are necessary in order for the data to be latched onto the HC595 outputs:

Logic analyser capture of serial protocol