Problem with 74HC595 shift register initializing with %11111111
edlikestoboogie
Posts: 71
I am using a 74HCT595 shift register to control some mosfets hooked up to water pumps. Problem is, the 74HCT595 turns on all parallel outputs on HIGH, for about 2 seconds when my project powers up. I was told these things turn on with all outputs on LOW. Is there any way, hopefully in software, to deal with this issue? I think the outputs source to HIGH once init() is called in Simple_74HC595.spin available in the obex, than finally sink to LOW.
Please help with this annoying problem, and thanks in advance.
Please help with this annoying problem, and thanks in advance.
Comments
Any way you can post a schematic? The 74HCT595 has a tri-state output and is in high impedance mode if the OE is low... without looking at a schematic it's hard to tell but a simple pull-up or pull-down in the right location during power-up might solve the problem.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
If so, then the OE input on the HC595 will be floating and picking up stray voltages, eg from nearby mains wiring and will randomly input data. Beau I think has the answer. If you want the outputs in tristate, pull OE high with 10k resistor.
That still doesn't quite solve the problem if the mosfet is driven directly off the HC595 outputs, as the mosfet gate could also be picking up stray voltages if it is floating. But if you pull the gate of the mosfet low with another 10k resistor, that means all the tristates will default to the pump being off.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.smarthome.viviti.com/propeller
Have you had a look at the TPIC6C595 and similar range? They are essentially a 595 shift-register and eight MOSFETs on the one chip suitable for driving solenoids etc. There is also the Allegro 5821 that are similar too. I have used both these devices with the Propeller.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
-Phil
Post Edited (Phil Pilgrim (PhiPi)) : 6/14/2010 12:55:50 AM GMT
Sorry about the late reply.
Here Is the schematic i am using on a PCB. I will read your posts and suggestions after I take an exam tomorrow.
Thanks for all the help.
Post Edited (edlikestoboogie) : 6/13/2010 11:25:24 PM GMT
quoting from the 595 datasheet:
"The storageregister has 8 parallel 3-state
busdriveroutputs. Data in the storageregister appears at
the output whenever the outputenableinput (OE) PIN13 is LOW."
You tied the outputenableinput to VSS = GND=LOW
If you add a pullup-resistor from PIN13 to Vdd and connect the PIN13 to a prop-IO-PIN
you can switch ON/OFF the output-stage by setting this prop-IO-pin to output and then set it to LOW
By default all prop-IO-pins are defined as input at powerup
If you don't want to use a prop-pin you could use a RC-circuit and a transistor which inverts the signal
on powerup the capacitor starts to charce and after some time the transistor switches to enable the
output-stage
best regards
Stefan
Hmm, I just read the datasheet again and it is an output but I am guessing then that it is only an output during a brown-out rather than a power-up?
I haven't actually used /RST as an output so what is the datasheet saying then? Of course a simple capacitor to ground on the reset pin won't hurt and it will generate the reset required for the 595.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
-Phil
-Phil
If the original MOSFETS where handling the load, I would go back to them. It seemed you had the power licked, now to tame the logic.
Jim
If you use the 74HCT595 you could just drive two FDS6990A or similar dual MOSFETs which are packaged in tiny 8-pin SMD packs and these handle up to 7A for each output. So your total surface would be no more than the equivalent of two 16-pin SMD packs.
search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=FDS6990ACT-ND
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
IMO, a better solution is to use an open-drain supervisor chip whose output is tied to both /RST and /CLEAR. That way, the Prop and '595 will reset at the same time on power-up, and you won't have to worry about capacitor charge delays.
-Phil
the HIGH startup is NOT solveable with pure software changes. You have to change your HARDWARE as suggested above
best regards
Stefan
I have a module with SSR's capable of 500mA continous current on each of eight outputs at up to 60VDC; details in my Morpheus thread.
See DIG-OUT-8-V on the bottom of page 10. It's designed to work with any Prop board [noparse]:)[/noparse]
http://forums.parallax.com/showthread.php?p=818362
I should be receiving the boards today! (according to UPS)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com E-mail: mikronauts _at_ gmail _dot_ com
My products: Morpheus / Mem+ / PropCade / FlexMem / VMCOG / Propteus / Proteus / SerPlug
and 6.250MHz Crystals to run Propellers at 100MHz & 5.0" OEM TFT VGA LCD modules
Las - Large model assembler Largos - upcoming nano operating system
Try this instead: Tie /SCLR high, and connect /G to a Prop pin along with a pull-up resistor to Vdd. All of the '595 outputs need to have pull-downs as well. But, if you're driving MOSFET gates, you'd do that anyway. With this configuration, any time the Prop pin driving /G is tri-stated (such as during a reset), /G will go high disabling the outputs, and the pull-downs on the outputs will inhibit the MOSFET drives.
To start up after a reset, load the shift register with zeroes, pulse RCLK, then assert the /G pin low.
-Phil
Post Edited (Phil Pilgrim (PhiPi)) : 6/15/2010 5:24:04 PM GMT
I will try what you said tomorrow, but I am wondering, should I use the code Simple_74HC595.spin (which loads a cog and listens for commands), available in the obex, and modify it to do what you said, or should I start from scratch and use BS2 functions like shiftout and pulsout to completely start from scratch? What would you do?
and is it necessary to use a cog to manipulate the '595? I would rather not use a cog and use shiftout and pulsout to control it ONLY when I want to turn a pump on/off. I am assuming the writers of the obex code were using a cog for fast speed?
thanks and if anyone else has suggestions I should try tomorrow, please let me know.
Ed.
-Phil
This is why it's easier to use the existing I2C lines and standard I2C chips or dedicate a cheap micro for these tasks. That way there is never an issue with losing I/O pins etc. However for simple I/O such as leds etc the shift register approach is fine and non-critical although it always requires I/O lines. In this regard I have found it convenient to always use the I2C lines as general-purpose CLOCK and DATA OUT so that even though shift-registers would pick up chatter from other I2C transmissions it is only when the output register is clocked that it is valid. So therefore a single output register chain would only need a single I/O pin plus the two existing I2C pins.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
Not sure what the go is with keeping it under $1 unless you are making lots and lots of these. How much is a cheeseburger and a can of coke these days?
Had a quick look at Mouser and for around a buck you can have the PCA9670 plus there are many other devices besides. I use cheap PIC chips in the $1 to $2 range and program them for I2C I/O and more besides. The same with a few other breeds of micros as well.
The MOSFETs that I mentioned earlier are very happy with 3.3V drive, no need for 5V at all.
KISS - Keep It Sweet & Simple (censored version) - don't add more stuff and complicate what is simple to start with, take stuff away, you only need a single chip and the MOSFETs. I don't know how many outputs you need but if you need a few then the I2C is certainly a way to go and doesn't use any extra Prop I/O, just P29,P28.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*