How to use TI CD74HC164 shift-register

Thread Starter

Andres-CH

Joined Mar 21, 2017
3
Hi i want to use shift-registers to control several 8x5 dot-matrix led-displays.

I bought a TI CD74HC164E and found a datasheet here but it doesn't work as expected.

When i put HIGH (5V) to MR (MasterReset) all my Leds light up, when putting it to LOW all turn off.
When i touch the wire connected to CP (Clock) it changes the registers at random from the induction caused, so
it's realy sensitive. When pressing the buttons connected to CP or DS1 / 2 (Serial Data) nothing happens.

Thanks for any help.

(Picture: the display is connected correctly, i did the pin allocation, the 8 Anode pins are connected to the shift-register and the Cathode of the right most column to GRD)
 

Attachments

Your MasterReset is active LOW, i.e. the chip resets when you put a LOW into it, not a HIGH. That is what is indicated by the bar over the MR on the datasheet.

The clock is really sensitive because it needs to be "debounced." Each time you press the clock button it will activate the clock multiple times. Adding a pull-up, or pull-down, resistor and capacitor on the input line would ensure you get one clock pulse per button push. All of the buttons need this type of circuit.

Article on switch debounce: https://www.allaboutcircuits.com/technical-articles/switch-bounce-how-to-deal-with-it/
 

Thread Starter

Andres-CH

Joined Mar 21, 2017
3
Thanks for the info, i understood MR needs to be kept HIGH.

I connected it to an arduino, so the bouncing switch problem should be obsolete, but still nothing happens..

JavaScript:
int pinMR = 2;
int pinCP = 4;
int pinDS1 = 7;

void setup() {
  Serial.begin(9600);

  pinMode(pinMR, OUTPUT);
  pinMode(pinCP, OUTPUT);
  pinMode(pinDS1, OUTPUT);
  digitalWrite(pinMR, HIGH);
}

int dly = 1000;

void clk() {
  Serial.println("Clock");
  digitalWrite(pinCP, HIGH);
  delayMicroseconds(dly);
  digitalWrite(pinCP, LOW);
}

void dataPin() {
  Serial.println("Data");
  digitalWrite(pinDS1, HIGH);
  delayMicroseconds(dly);
  digitalWrite(pinDS1, LOW);
}

void clr() {
  Serial.println("Clear");
  digitalWrite(pinMR, LOW);
  delayMicroseconds(dly);
  digitalWrite(pinMR, HIGH);
}

void writeReg(byte data) {
    for (int i = 0; i < 8; i++) {
      clk();
      Serial.println(data & (B10000000 >> i));
      if (data & (B10000000 >> i)) {
         dataPin();
      }
    }

}

void loop() {
  clr();
  writeReg(B11111111);
  delay(5000);
}
 

Thread Starter

Andres-CH

Joined Mar 21, 2017
3
Okay i guess i now figured out how it works, set DS1 to HIGH, set clock to HIGH -> LOW, set DS to LOW ...

Quite obvious, after you've done it once.. datasheets are not meant for beginners i guess..
 

hp1729

Joined Nov 23, 2015
2,304
Hi i want to use shift-registers to control several 8x5 dot-matrix led-displays.

I bought a TI CD74HC164E and found a datasheet here but it doesn't work as expected.

When i put HIGH (5V) to MR (MasterReset) all my Leds light up, when putting it to LOW all turn off.
When i touch the wire connected to CP (Clock) it changes the registers at random from the induction caused, so
it's realy sensitive. When pressing the buttons connected to CP or DS1 / 2 (Serial Data) nothing happens.

Thanks for any help.

(Picture: the display is connected correctly, i did the pin allocation, the 8 Anode pins are connected to the shift-register and the Cathode of the right most column to GRD)
Yes, debounce ... and pull-down resistor, about 10K.
 
Top