Go Down

Topic: prevent shift register to start at random state (Read 2113 times) previous topic - next topic

6hearts

Oct 28, 2017, 08:13 pm Last Edit: Oct 28, 2017, 08:44 pm by 6hearts
I've got a 8-bit shift register 74HC595 connected to 8 opto-isolators.

But before arduino boots, the shift register turns on the opto-isolators in a random state.
Also, I have a long 5-wire connection from the arduino to the shift register, so if not absolutely necessary, I would prefer to keep only 5 wires.

Instead of putting another wire for the "enable output" pin, can I just plug the shift register's vcc to an arduino pin? This way it all would be turned off, before arduino boots and I set the "vcc" pin to HIGH.

- Is it OK to power up a shift register by a arduino IO pin?
- Do I need resistors for the IO "power" pin?

larryd

Hardware-wise, you can add an RC power up reset cct. to the reset pin.



.
No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

6hearts

Sorry, could you explain a bit more in details?
I'm a bit new to electronics...

Grumpy_Mike

The power up state of a shift register is in itself random. Their is a pin on the shift register, that if you pulse it low it sets the shift register to a known state. That pin is known as the MR or master reset pin.
You can use this pin by putting a capacitor from the MR pin to ground and a resistor from the MR pin to 5V. Then when to power is applied, the capacitor keeps the MR pin low for a short time before the capacitor charges up through the resistor. This in effect gives the chip a reset pulse on power up and acheaves the known state you are looking for.

Quote
can I just plug the shift register's vcc to an arduino pin?
Bad idea, the supply you get from a logic pin is not very well regulated and the current from that pin is limited. What you can do is to use a PNP transistor as a top switch to apply power to the chip and drive that transistor from an Arduino's output pin through a resistor.

larryd

#4
Oct 28, 2017, 11:59 pm Last Edit: Oct 29, 2017, 12:37 am by larryd
As Mike said:



Try 10K and 100nF (.1uF) as a starting point.


Edit
More correctly:



No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

6hearts

i don't know, I've made the exact same circut, connecting the capacitator/diode/resistor to the !SRCLR pin (!MR), while the arduino boots, the 74HC595 output is it's last state (I want to have the state 00000000).

What if I just power the 74HC595 through an opto-isolator?

Grumpy_Mike

Quote
I've made the exact same circut, connecting the capacitator/diode/resistor to the !SRCLR pin (!MR), while the arduino boots, the 74HC595 output is it's last state (I want to have the state 00000000).
With the same values?
Try making the capacitor 1uF or bigger.

Quote
What if I just power the 74HC595 through an opto-isolator?
You can't power anything through an opto isolator.

6hearts

in the circuit above, initial state is always all low values?

you said that on power up the register goes to a "a known state". What is a known state? I want to achieve that before I do anything, the shift register has all low values on output (00000000).

Grumpy_Mike

#8
Oct 29, 2017, 05:39 pm Last Edit: Oct 29, 2017, 05:40 pm by Grumpy_Mike
Quote
What is a known state? I
One that you know and is always the same. It tells you what it is in the data sheet for the part but yes it is all zeros.

Try and dab a wire between the ~MR and ground and see them all reset.

Ahmed_Ali20

Please, i have the same problem.

What is the solution you used to prevent the shift register to start at a random state?

Grumpy_Mike

Quote
What is the solution you used to prevent the shift register to start at a random state?
Wire the master reset pin on the shift register to your Arduino reset.
If your shift register needs the opposite polarity signal then invert the reset from the Arduino with a transistor.

Go Up