Can't get M74HC595 to work

Hi!

I am trying to work with an Arduino Uno and M74HC595 Shift Register by ST. It does not work at all. I can’t get any response from the register that seems to be caused by my code. I abstracted a test circuit away from my actual project which you can see on the image below that behaves in the same way as my bigger build. What did I not understand that keeps me from using this register correctly?

This is some test code but I tried another library and even using buttons as a manual clock, data, latch so I think this problem might have to do with the hardware rather than the software?

Thank’s in advance!

int latchPin = 1;
int clockPin = 2;
int dataPin = 0;

void setup()
{
    pinMode(latchPin, OUTPUT);
    pinMode(clockPin, OUTPUT);
    pinMode(dataPin, OUTPUT);
}

void loop()
{
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, 0xFF);
    //return the latch pin high to signal chip that it
    //no longer needs to listen for information
    digitalWrite(latchPin, HIGH);
    delay(1000);
}

Tried to connect the LEDs to GND instead?

Just working on a board with 6 595 and 48 leds. My leds go to GND (using a resistor).

BTW, is this a RGB led you are using? If so, replace it with single LEDs in order to check if it works better when the LEDs are connectet to GND and not VCC.

Thank's for the quick answer! I had the same idea and just tested two regular LED's with the anode towards the 595. Still no luck. They are on no matter what. I also tested different digital pins on the Uno. The register seems to work though. When I touch the three communication wires randomly the LED's switch sometimes.

Is the voltage Vcc within tolerance for the devices ?

Your code repeatedly sets all the outputs high (writing 0xFF to the register), so no wonder the LEDs don’t change.

Replace the 0xFF in the shiftOut with a byte counter variable, and increment it each time…

You need a 100nF ceramic capacitor as decoupling right close to the chip, the 10uF cap is still useful
but it won’t handle high speed decoupling as well as 100nF ceramic.

All logic chips always need this high speed decoupling, whether the datasheet bothers to say so or not,
otherwise operation can be unreliable (lots of guides on the internet are poor quality and fail to mention
this, note).

VCC is 5V of the Uno. Of course, I changed the byte I am trying to send to the register from 0xFF to 0x00, for example, to see if anything changes and it doesn't. Is there a possibility that the chip get's destroyed on powerup by this circuit? I tried multiple chips and none worked. Could this "not working at all whatsoever" state really be caused by a badly chosen decoupling cap? I don't have any other lying around and saw a lot of people using a shift register without any caps.

Yea... Nevermind my IDE fucked up. I am using VS Code and uploaded the wrong sketch every time by accident. Sorry.

Hi,

int latchPin = 1;
int clockPin = 2;
int dataPin = 0;

You will find that using pins 0 and 1 will make your code malfunction/unstable as pins 0 and 1 are the programming pins of the UNO.
Try using other pins than 0 and 1.

Tom... :slight_smile:

Certainly a very bad idea to use pins 0 and 1, albeit it will only cause trouble if your program attempts to use the serial port.

(Note they are being used as inputs to a 74HC595 so it will not contend with the USB interface,)