3
\$\begingroup\$

I have a project with two seperate output shift registers and they are working fine. They both have LEDs at the moment but one shift register will eventually be controlling relays and then solenoid valves to control water flow. The issue I have is when I turn the power on, the 8 channels of the shift registers are rarely in the off state. Normally some are on which is no good having the solenoid valves randomly turn on then off when power is turned on. Is there are way I can force the registers to be off when power is applied? The shift registers I am using are both 74HC595N.

EDIT

The green LEDs light up before the MC can initialise the shift register. enter image description here

\$\endgroup\$
3
  • \$\begingroup\$ I don't have a complete circuit to include in an answer, but a "power-on reset" circuit seems like just the thing you need. If I recall correctly, there are ways to realize them with discrete components, or they can be purchased as purpose-made ICs. \$\endgroup\$
    – nanofarad
    Commented Nov 1, 2020 at 4:13
  • 1
    \$\begingroup\$ Usual approach is to assert reset line (low) then deassert (high) prior to first clock cycle. If the device has a Schmitt triggered reset this can be done with a cap from reset to low and resistor to high. Without Schmitt this will usually work but ideally a guaranteed rest pulse is desirable. \$\endgroup\$
    – Russell McMahon
    Commented Nov 1, 2020 at 4:45
  • \$\begingroup\$ Why don't more designers use SRAM with known values on startup? I found the circuit in an old old computer electronics book. It's just SRAM with tuned power supply wires so it costs virtually nothing on a chip that big. \$\endgroup\$
    – Joshua
    Commented Nov 1, 2020 at 19:51

3 Answers 3

4
\$\begingroup\$

The chip you are using has an output enable pin that allow you to keep the shift register outputs in a high impedance state until you shift in known data. You would probably want to use a microcontroller for this.

From NXP Datasheet:

Output enable

Additionally you can use the master reset pin to clear shift register contents if you want them to be all 0. If you use this method it's probably doable to set up a resistor and capacitor to keep the pin low for a certain duration of time after power up.

\$\endgroup\$
3
  • \$\begingroup\$ I am still a beginner when it comes to circuit design, I can't find any examples that would help explain exactly how to use the MR pin like you suggest. \$\endgroup\$ Commented Nov 1, 2020 at 5:15
  • \$\begingroup\$ Not quite the answer for me but put me on a path that allowed me to solve it. I don't quite understand how I could add a resistor and capacitor to give me the high at boot and then switch to low, but I know the microcontroller I am using defaults a pin to high on boot, I connected it to the OE pin and toggle it to low in my setup. It works great. \$\endgroup\$ Commented Nov 1, 2020 at 6:08
  • 2
    \$\begingroup\$ The downside of using the OEbar pin is that it sets the outputs to high-Z. In general this is to be avoided because it does not guarantee a specific logic state while OEbar is high. There may be cases where this turns out to be OK due to some other reason (weak pullup/pulldown, leakage, etc.). But even then, using a high-Z on a digital signal still leaves you vulnerable to noise coupling. The other answer I posted avoids these problems, and is the main reason I bothered to post an alternative. \$\endgroup\$ Commented Nov 1, 2020 at 6:28
1
\$\begingroup\$

You will need to combine three general concepts to obtain what you want in this particular case.

  1. A power-on reset function: This circuit element senses the power supply voltage, compares it to an internal threshold, and supplies an output (call it PowerOK) that indicates whether the supply has exceeded the threshold. In most cases, PowerOK is a digital signal. As the supply rises from zero, PowerOK remains low until the supply crosses the threshold, then rises to a logic HIGH and tracks the supply as it completes its rising transient. To be useful, the threshold must be hysteretic, lest the output chatter on its way up or down.
  2. A reset function for the digital state elements: On your 74HC595N, this function is supplied by the MRbar pin. Its internal flops have an asynchronous "resetb", where the flop outputs are always some fixed state (either 0 or 1) whenever "resetb" is LOW, i.e., in the Reset state. Why "resetb", and not "reset"? When the supply comes up, you always want to start your digital state elements in a known state. But if the supply voltage is below the minimum, a valid logic LOW is available (ground) but a valid HIGH may not be.
  3. Assigning reset values to each element that requires them. Suppose your shift register produces all 0's in the reset state. Suppose further that some elements you're controlling need to 0's, while others need to be 1's. What to do? Generally, the most robust thing to do is to place combinational logic after the state element, and in front of the controlled element.

To glue together these ideas, you'll need to drive your MRbar pin with PowerOK (or possibly, PowerOK AND SomeOtherLogic). Depending on what else in the system uses PowerOK, you may have to generate a locally-delayed copy of it for your shift reg or some other element. Also, depending on the reset value for each element (relay, solenoid, etc.) you may need to add static logic. It may be as simple as an inverter, but you'll need to make sure that the logic function (a) provides the proper reset value when PowerOK rises, and (b) that the logic circuitry can function reliably at your rising PowerOK threshold.

\$\endgroup\$
1
\$\begingroup\$

The easiest way that requires very little additional hardware is to drive the OE of the shift register from another GPIO line from the processor.

This GPIO line should be pulled high with a resistor sp that at power-on it is guaranteed to be in the high-state. This will ensure that the output of the shift register is in the high-impedance state.

At power-on the software should initialize the shift register before setting the OE line to a logic low. The OE line can then be left in this state

This sequence will ensure that the LEDs remain off until the software has had a chance to initialize the circuitry.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.