Can two 595 Shift registers be driven together?

Hi,

I have 2 display devices driven with 74HC595 shift registers.
They will be about 8 feet from the Arduino.

1: Can two 595 shift registers share the Latch and Clock?
2: Will the distance of 8 feet cause noise or other issues?

Thanks

Yes.
You need to operate the OE pins of the registers also.

Railroader:
Yes.
You need to operate the OE pins of the registers also.

OE is connected to ground, and MR to VCC.
My plan was to shift out both devices at the same time.
I understand that I will have to write a custom shift out function.

Better choice for driving displays is TPIC6B595 or TPIC6C595. B has can sink 150mA thru it’s open drain outputs, C can sink 100mA. (there are also 250 and 350mA versions). Otherwise they function the same as 74HC595.

74HC595 is only rated for 70mA Total, so 8-9mA per output. Not really the right choice.

You must control MR/ also - at a minimum, connect it to VCC.
A 0.1uF cap from VCC to Gnd is needed for stable operation, on each device.

Two devices can also be daisychained. Connect pin 9 of device 1 to pin 14 of device 2.

Some folks use shiftOut() to send data to the two of them, I prefer SPI.transfer(). 6-8 feet away may be an issue, requiring slower clock speeds, or shielded wiring.

// at top of the sketch
#include <SPI.h>
byte ssPin = 10;
byte data1;
byte data2;

// in setup()
pinMode (ssPin, OUTPUT);
digitalWrite (ssPIN, HIGH);
SPI.begin(); // SPI Mode 0, 4 MHz clock, MSBFIRST are the default setting

// in loop, when an output change is needed
digitalWrite (ssPin, LOW); // D10, does to RCLK (12)
SPI.transfer (data1);  // SCK-D13 goes to SRCLK (11), MOSI-11 goes to Serial Data in (14)
SPI.transfer (data2);
digitalWrite (ssPin, HIGH); // outputs update on this rising edge

Not much custom there!

Qsilverrdc:
OE is connected to ground,
Not the best

and MR to VCC.
Okey

My plan was to shift out both devices at the same time.
In order to output both register at the same time connect both OE together and let the Arduino send them the activating active LOW signal.

I understand that I will have to write a custom shift out function.
You can do that or use a ready made library.

I thought I would do something like…

void DshiftOut(uint8_t dataPin_0, uint8_t clockPin, uint8_t bitOrder, uint8_t val_0, uint8_t dataPin_1, uint8_t val_1)
{
     uint8_t i;

     for (i = 0; i < 8; i++)  {
           if (bitOrder == LSBFIRST)
                 digitalWrite(dataPin_0, !!(val_0 & (1 << i)));
                 digitalWrite(dataPin_1, !!(val_1 & (1 << i)));
           else      
                 digitalWrite(dataPin_0, !!(val_0 & (1 << (7 - i))));
                 digitalWrite(dataPin_1, !!(val_1 & (1 << (7 - i))));                 
           digitalWrite(clockPin, HIGH);
           digitalWrite(clockPin, LOW);            
     }
}

Or like this:

void DshiftOut(uint8_t dataPin_0, uint8_t clockPin, uint8_t bitOrder, uint8_t val_0, uint8_t dataPin_1, uint8_t val_1)
{
  uint8_t i;

  for (i = 0; i < 8; i++)  {
    if (bitOrder == LSBFIRST)
    {
      digitalWrite(dataPin_0, !!(val_0 & (1 << i)));
      digitalWrite(dataPin_1, !!(val_1 & (1 << i)));
    }
    else
    {
      digitalWrite(dataPin_0, !!(val_0 & (1 << (7 - i))));
      digitalWrite(dataPin_1, !!(val_1 & (1 << (7 - i))));
    }
    digitalWrite(clockPin, HIGH);
    digitalWrite(clockPin, LOW);
  }
}

CrossRoads:
Better choice for driving displays is TPIC6B595 or TPIC6C595. B has can sink 150mA thru it's open drain outputs, C can sink 100mA. (there are also 250 and 350mA versions). Otherwise they function the same as 74HC595.

The 595 is connected to 4 - 4511N 7seg BCD drivers, each attach to a NLN2003's to the 12V LED segments.
It works good. In code I must double write the 595 with the latch enable bit on once and then off. 4 bits BCD and 4 bits device latch.

I like the idea of using 5 - 595's cascaded direct conected to the 4 - ULN2003's, and some other points. As I could play with the segments directly. More than just 0-9 with the BCD's...

of course more code work, and I'm not planning another board (yet)

Railroader:
Or like this:

 if 

{
      True;
    }
 else
   {
     Other;
   }

Ha ha, My code copy skills are not so good.

You are making it more complicated than it needs to be.
TPIC6B595 has high current, 50V capable outputs. No ULNs or 7-segment decoders needed. Do that mapping in an array, and shift out the segments needed.
If you need to Source current (High output into common cathode display) instead of Sink current (Low output with common anode display) then use MIC5891, which is also a high voltage/high current part.

For example:

byte fontArray[] = {
0b00111111, // 0  where the bits are DP-g-f-e-d-c-b-a
0b00000110, // 1
:
:
0b01111111, // 8
0b01101111, // 9
};

Then per the SPI.transfer code above
SPI.transfer (fontArray[data1]);
SPI.transfer (fontArray[data2]);

or
shiftOut (dataPin, clockPin, MSBFIRST, fontArray[data1]);
shiftOut (dataPin, clockPin, MSBFIRST, fontArray[data2]);

    a
f       b
    g
e      c 
    d      DP

This project used TPIC6B595s to control 12V LED strings to make the digits

http://www.crossroadsfencing.com/BobuinoRev17/
This board has 12 of them for up to 12 digits, plus a '328P bootloaded as an Uno to control them all.

3 LED and 6 LED segment digits.JPG

3 LED and 6 LED segment digits.JPG

CrossRoads:
6-8 feet away may be an issue, requiring slower clock speeds, or shielded wiring.

I was just thinking of using a CAT 5 type cable. Any thoughts.
Any pairs better to combine? Like VCC and Gnd.

Cat5 is shielded, with 4 twisted pairs?
So connect the shield to Gnd at one end,
use one pair for 5V/Gnd,
and then clock/Gnd, data/Gnd, and latch/Gnd would be as good a combo as any.

CrossRoads:
You are making it more complicated than it needs to be.
TPIC6B595 has high current, 50V capable outputs. No ULNs or 7-segment decoders needed.

I may just have to give this a go.
Down to 8 chips. 4 resistor array, 4 shifts.

Thanks, the example in data sheet is very close..

It works!

Everything goes except for small children we say here.
Congrats.

So you didn't get the TPIC6B595s in order to simplify it?

Paul__B:
So you didn't get the TPIC6B595s in order to simplify it?

No, I used them. See the enhanced image. Thank you very much for the suggestion. The code is also a little more strait forward. The display is plenty bright at 9vdc, which is also used to power the Arduino.

The TPIC data sheet shows a .1uF cap to ground and a 10K to SRCLR. Are either of these needed?
If needed can one 10k resistor work for all 4 chips?
Is the capacitor really needed? What does it do? Is this what is called a decoupling capacitor?

Again, thanks for the great thought.

Qsilverrdc:
No, I used them. See the enhanced image. Thank you very much for the suggestion.

Ah! Octal DIP resistor arrays. I was tricked! :grinning:

Qsilverrdc:
The display is plenty bright at 9vdc, which is also used to power the Arduino.

I prefer to power the Arduino with the proper 5 V but presumably you are powering it via the "barrel jack". This will work as long as what you connect to it requires no more than 50 or 100 mA drawn from the "5V" pin plus all the output pins. Since the TPICs only require 5 V for their CMOS logic, you are so far getting away with it. :roll_eyes:

Qsilverrdc:
The TPIC data sheet shows a .1uF cap to ground and a 10K to SRCLR. Are either of these needed?

Why would it show them if they were not? :astonished: Actually, SRCLR can connect directly to Vcc, the resistor is only in case you later decide you need to control that pin. As such it is a good idea to provide for it if you design a PCB even if the default is to jumper it. Possibly similarly for the output enable which also you rarely use.

Now I recall, there is an argument for a capacitor from SRCLR to ground simply to clear the register on power-up however this only clears the shift register, not the latch register which actually drives the outputs.

Qsilverrdc:
If needed can one 10k resistor work for all 4 chips?

Indeed.

Qsilverrdc:
Is the capacitor really needed? What does it do? Is this what is called a decoupling capacitor?

Yes, and it is very important, one per chip. Omitting it may still work, but people have occasionally reported quite bizarre faults when it is not present.

Paul__B:
Yes, and it is very important, one per chip. Omitting it may still work, but people have occasionally reported quite bizarre faults when it is not present.

I understand. How physically close in the circuit should the cap be to the vcc pin on the TPIC?