Shift Register on Start-up..

i'm following this guide and wiring...

but using 8 registers...

my problem is some LEDs are turned on momentarilly when my device starts..

is there a way to avoid this? or maybe a way to not reset the last state of turned on LEDs...

sorry, i'm just new...

You may be new but the article describes this problem. Perhaps more reading is in order.

Pin 10 (MR) is an active low reset that can be used in combination with an RC circuit to avoid this effect… perhaps. It depends upon the rest of your wiring which you have not divulged.

Pin 13 (OE) is an active low output enable that can also be used in combination with an RC circuit to avoid this effect.

Unfortunately, these solutions are not described in any detail in the article.

vaj4088:
Pin 10 (MR) is an active low reset that can be used in combination with an RC circuit to avoid this effect...

No need for circuitry. The arduino pins start LOW (I'm pretty sure), so just hook an arduino to the reset rather than tying the reset high. Turn the register on by setting the pin HIGH when the sketch is good and ready to do so.

PaulMurrayCbr:
No need for circuitry. The arduino pins start LOW (I'm pretty sure), so just hook an arduino to the reset rather than tying the reset high. Turn the register on by setting the pin HIGH when the sketch is good and ready to do so.

Untrue, on power on, all pins are high-impedance.

So you'll need to either use a pulldown on MR (or an RC as noted above), or a pullup on OE.

i'm using this wiring but with 8 shift registers....

the MR resets the shift register right? so i should tap a 10k ohm resistor to ground.. is that right?

Ya, and then drive that pin high in setup() so it gets pulsed low on startup to reset it

let’s say i have this wiring…

OE -------X------- 5v

is there a way that i can “cut” on the “X” the connection after a certain time (maybe 5secs)

i can’t use anymore arduino pins… all pins are used. (sketch below is just for testing purposes since my actual device has already been soldered… sad…)

it seems that my solution is to connect all the OE of all the shift register to the 5v (set to HIGH). Then once the sketch has loaded, cut connection so it will be set to LOW…

this is my sketch by the way…

int latchPin = 8;
int clockPin = 12;
int dataPin = 11;
int numOfRegisters = 3;
byte* registerState;

void setup() {
  //Initialize array
  registerState = new byte[numOfRegisters];
  for (size_t i = 0; i < numOfRegisters; i++) {
    registerState[i] = 0;
  }
  //set pins to output so you can control the shift register
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
}

void loop() {
  for (int i = 0; i <= 23; i++) {
    for (int z = 0; z <= 23; z++) {
      regWrite(z, LOW);
    }
    regWrite(i , HIGH);
    if (i == 23) {
      i = -1;
    }
    delay(300);
  }
}

void regWrite(int pin, bool state) {
  //Determines register
  int reg = pin / 8;
  //Determines pin for actual register
  int actualPin = pin - (8 * reg);

  //Begin session
  digitalWrite(latchPin, LOW);
  for (int i = 0; i < numOfRegisters; i++) {
    //Get actual states for register
    byte* states = &registerState[i];
    //Update state
    if (i == reg) {
      bitWrite(*states, actualPin, state);
    }
    //Write
    shiftOut(dataPin, clockPin, MSBFIRST, *states);
  }
  //End session
  digitalWrite(latchPin, HIGH);
}

i can't use anymore arduino pins... all pins are used. (sketch below is just for testing purposes

Do you know that the analogue pins can be used as digital input / output pins as well, just use PIN numbers 14 to 19.