4″ 7-segment/More than one digit/11. DATAOUT to DATAIN
More than one digit · 11 of 15

DATAOUT to DATAIN

A byte does not go to a module. It goes through one. Send a second byte and the first is pushed along into the next module, and every other wire on the edge, PWM included, is one net straight across.

The queue

The shift register has eight stages and a bit enters at one end. Clock in a ninth bit and something has to happen to the first one: it falls out of the far end, onto the pin printed (QH) DATAOUT. That is the chip's serial output, which TI writes QH′ in the datasheet.

Wire that pin to the next module's DATAIN and nothing is lost. The bit carries on into the next register, which is eight stages of exactly the same thing.

A byte goes through a module, not to it
step 0 of 4
The PWM net, shared by every module
First module holds
-
Second module holds
-
Latch pulses
0
Both digits
dimmed together
One wire, one byte at a time, in the order you send them. Each module’s shift register spills out of its last stage into the next module’s first, so sending a second byte does not address the second module: it pushes the first byte along into it. Everything else at the joint is one net straight across the board.

Watch the byte for the 7 land in the first module and then get pushed out of it by the byte for the 3. Two shiftOut calls and two modules are loaded; the first byte travelled twice as far as the second. The same figure has a control at the foot for the PWM wire, which the last section comes back to.

What crosses the joint

Each edge has six signal pins and two power pins, and the OUT edge repeats the IN edge's list. One pair is different. Every other pin is the same copper on both edges, straight across the board.

First module, OUT edgeSecond module, IN edgeAcross the board
GNDGNDone net
3V3/5V3V3/5Vone net
(QH) DATAOUTDATAIN (SER)through the shift register
(RCLK) LATCHLATCH (RCLK)one net
(SRCLK) CLOCKCLOCK (SRCLK)one net
PWMPWMone net
GND, 12V (two-pin row)GND, 12Vone net each

That is why a chain needs one supply and one set of wires from your microcontroller however long it gets, and why the code for a chain is barely different from the code for one module:

void updateDisplay(const uint8_t *buf) {
  digitalWrite(LAT, LOW);
  for (int i = 0; i < NUM_DIGITS; i++)
    shiftOut(SER, CLK, MSBFIRST, buf[i]);
  digitalWrite(LAT, HIGH);
}

One more module is one more turn of the loop. The latch stays outside it, pulsed once, and every digit changes at the same instant.

Plugging them together

The boards are meant to sit edge to edge. In the picture, the first module's OUT edge is against the second module's IN edge, and the same eight connections line up pin for pin across the seam. The headers from the bag, the male strips and the female sockets, are what you join them with; short jumper wires do the same job if you want the digits spaced apart.

Two display modules seen from the back, side by side. The left one's OUT edge, with its two-pin GND and 12V header and its six-pin signal header ending in PWM, sits against the right one's IN edge, which carries the same two headers, ending in PWM, with DATAIN where the left one prints DATAOUT.
Two backs, butted. Only the left-hand board has wires to a microcontroller; the right-hand one is fed through the join.

Turn the pair over and the two digits sit at their natural spacing with no gap, which is the point of joining at the edge rather than with flying leads.

One PWM wire dims all of them

The brightness pin crosses the joint like the clock does, so one PWM wire from your board sets every digit's brightness together, and the module count does not matter. It cuts the other way too. The pad beside the PWM pin, when soldered shut, ties that module's PWM net to the logic rail, and the joint carries that to every other module.

So in a chain there are two ways to use PWM, and they do not mix:

  • Leave every pad open and drive PWM from your board. One wire, one duty cycle, every digit.
  • Short one pad and wire nothing to PWM. Every digit is full on, always.

A pad shorted on one module and a PWM pin wired to the chain means your pin is driving a wire that is held high. The pad ships open, so a new chain with nothing on PWM is dark: the PWM pad is the article for that.

How long can it get

Nothing in the protocol has a limit. Every extra module is one more shiftOut before the same single latch.

The limits are ordinary ones. The 12 V supply has to carry every module in the chain, since they all draw through the join. And the wires between your microcontroller and the first module carry a clock, which is the one signal here that would rather be short.

When it does not work

Only the module my wires go to lights up

The link between the two boards is not made. Data leaves on (QH) DATAOUT and enters the next board on DATAIN; it does not go back to your microcontroller. With everything off, check continuity from the first module's DATAOUT pin to the second module's DATAIN pin, and look at the joints on both rows.

The second module shows what the first should

It is doing what it is built to do: the bytes are going out in the wrong order. The byte sent first ends up furthest down the chain, so the leftmost digit has to go out first. The next article is about nothing else.

Do I need a second 12 V supply for the second module?

No. The 12 V and its ground are one net from the IN edge to the OUT edge, so joining two modules feeds the second from the first. What a long chain needs is a supply that can deliver the current of every lit digit at once. That current was not measured for this board, so size the supply by adding the modules up and leaving room.

I dim the chain and only one module dims, or none do

PWM is one net across every module, so a dimming wire acts on all of them or on none, and one module cannot be dimmed on its own. If nothing responds, check whether a PWM pad is shorted on any module: that ties the whole chain's PWM net to the logic rail and holds every digit full on.

Can I chain modules with wires instead of plugging them together?

Yes, and it is how you space digits apart or bend a display round a corner. Carry all eight connections across: both grounds, the logic rail, the 12 V, clock, latch, PWM, and DATAOUT to the next DATAIN. Keep the runs short, because a clock edge on a long wire is the signal here most likely to mind.

Where this goes next

The module wired to your board is the right-hand one, and it holds the byte you sent last. That surprises everybody once.

Which module shows the ones →

Edit this page — content/books/seg4/data-out-data-in.mdx

Community

Questions about this product

See what other owners have asked, and read their solutions.

Ask a question ↗

4″ 7-Segment LED Display with 74HC595

Loading discussions…

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Modules and blocks on the forum →