PDA

View Full Version : Problem with 74HC595 shift register initializing with %11111111



edlikestoboogie
06-13-2010, 12:21 PM
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.

Beau Schwabe (Parallax)
06-13-2010, 12:53 PM
edlikestoboogie,

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 (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

Dr_Acula
06-13-2010, 01:29 PM
Does the propeller boot up with pins in tristate?

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 (http://www.smarthome.viviti.com/propeller)

Peter Jakacki
06-13-2010, 03:12 PM
The 595 has a clear input on pin 10 which you can tie to the Prop's reset as this line is also an output from the Prop when BOE is tied low which is generally the case.

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 Pilgrim (PhiPi)
06-14-2010, 03:06 AM
Peter Jakacki said...
The 595 has a clear input on pin 10 which you can tie to the Prop's reset as this line is also an output from the Prop when BOE is tied low which is generally the case.

It would be so nice if that were true, but unfortunately it's not. /RST is pulled up when /BOE is tied low, but it's never driven low by the Prop [edit: except during a brownout condition once Vdd has already been establised], which means the '595 would not get reset at power on. You could, however, attach an inexpensive open-drain supervisor chip to the Prop's /RST pin to handle the power-on condition.

-Phil

Post Edited (Phil Pilgrim (PhiPi)) : 6/14/2010 12:55:50 AM GMT

edlikestoboogie
06-14-2010, 06:19 AM
Hi guys,

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

StefanL38
06-14-2010, 06:46 AM
OK there it is:

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

Peter Jakacki
06-14-2010, 07:18 AM
Phil Pilgrim (PhiPi) said...

Peter Jakacki said...
The 595 has a clear input on pin 10 which you can tie to the Prop's reset as this line is also an output from the Prop when BOE is tied low which is generally the case.

It would be so nice if that were true, but unfortunately it's not. /RST is pulled up when /BOE is tied low, but it's never driven low by the Prop, which means the '595 would not get reset at power on. You could, however, attach an inexpensive open-drain supervisor chip to the Prop's /RST pin to handle the power-on condition.

-Phil


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?



Brown Out Enable (active low). Must be connected to either VDD or VSS. If low, RESn becomes a
BOEn I weak output (delivering VDD through 5 kΩ) for monitoring purposes but can still be driven low to cause
reset. If high, RESn is CMOS input with Schmitt Trigger.




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 Pilgrim (PhiPi)
06-14-2010, 07:51 AM
I just checked it with a scope, and /RST does get pulled low ahead of Vdd going to zero when power is removed. But there's no symmetrical behavior during powerup: /RST tracks Vdd almost exactly. Also, an internal software-generated reset does not affect this piin. (The datasheet really needs to be much clearer about the behavior of the /RST pin.)

-Phil

edlikestoboogie
06-15-2010, 05:43 AM
I'm still not sure what I should do.. the TPIC6C595 doesn't seem to be able to handle my 1 amp pumps.

Phil Pilgrim (PhiPi)
06-15-2010, 06:05 AM
edlikestoboogie said...
... the TPIC6C595 doesn't seem to be able to handle my 1 amp pumps.

Well, no, given that the datasheet specs each output at 100mA and 250mA total for the whole chip, that's not too surprising. You will probably have to use a 75HCT595 to drive individual power MOSFET transistors to handle the one-amp loads. BTW, Parallax's Digital I/O Board Kit (http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/relay/List/0/SortField/4/ProductID/658/Default.aspx) would be ideal for your app.

-Phil

hover1
06-15-2010, 06:05 AM
The TPIC6C595 can not handle 1 AMP per output. (I believe this is the first time the current came up). 1/10 Amp at best with all outputs on. 1/4 AMP with one ouptput on :



Per Data Sheet:
Continuous source-to-drain diode anode current 250 mA
Pulsed source-to-drain diode anode current (see Note 3) 500 mA
Pulsed drain current, each output, all outputs on, ID, TC = 25C (see Note 3) 250 mA
Continuous drain current, each output, all outputs on, ID, TC = 25C 100 mA
Peak drain current single output, IDM,TC = 25C (see Note 3) 250 mA


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

edlikestoboogie said...
I'm still not sure what I should do.. the TPIC6C595 doesn't seem to be able to handle my 1 amp pumps.

Peter Jakacki
06-15-2010, 09:29 AM
Yes, the 6595 handles up to 250ma continuous for each output even if all are on so that's a total of 2A for the chip. The 6C595 only handles 100ma per output. I forgot that you mentioned pumps and I was thinking about solenoids but I didn't have any indications as to the current requirements previously.

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 (http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=FDS6990ACT-ND)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*

edlikestoboogie
06-15-2010, 12:45 PM
The bigger problem is the HIGH start up that is annoying me to death. Anyone else with any bright ideas?

Peter Jakacki
06-15-2010, 01:04 PM
I thought I answered that more than CLEARly enough. The 595 has a CLEAR input, just put a 1uf cap to from pin 10 to ground and add a pullup of around 10K or more as that will generate an automatic clear on power-up. (The Prop's reset line is not usable for this we established). I would always tie OE low so that the MOSFETs are driven and not left floating.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*

Phil Pilgrim (PhiPi)
06-15-2010, 02:09 PM
I would also add a diode in parallel with the pullup resistor "pointing" towards Vdd. That way, the cap will discharge more quickly on a power-down. Your program will have to account for the time that it takes the cap to charge before you start sending data to the '595.

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

StefanL38
06-15-2010, 09:18 PM
to add again:

the HIGH startup is NOT solveable with pure software changes. You have to change your HARDWARE as suggested above

best regards

Stefan

Bill Henning
06-15-2010, 11:45 PM
FYI,

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 :)

http://forums.parallax.com/showthread.php?p=818362

I should be receiving the boards today! (according to UPS)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com (http://www.mikronauts.com) E-mail: mikronauts _at_ gmail _dot_ com
My products: Morpheus (http://mikronauts.com/products/morpheus/) / Mem+ (http://mikronauts.com/products/morpheus/memplus/) / PropCade (http://forums.parallax.com/showthread.php?p=894725) / FlexMem (http://forums.parallax.com/showthread.php?p=894853) / VMCOG (http://forums.parallax.com/showthread.php?p=878382) / Propteus (http://mikronauts.com/products/propteus/) / Proteus (http://mikronauts.com/products/proteus/) / SerPlug (http://mikronauts.com/products/serplug/)
and 6.250MHz Crystals to run Propellers at 100MHz (http://mikronauts.com/products/mikronauts-625mhz-crystal/) & 5.0" OEM TFT VGA LCD modules (http://forums.parallax.com/showthread.php?p=852195)
Las (http://mikronauts.com/software-products/largos/) - Large model assembler Largos (http://mikronauts.com/software-products/largos/) - upcoming nano operating system

Phil Pilgrim (PhiPi)
06-16-2010, 12:18 AM
I just took another look at the '595 datasheet. The /SCLR pin is asynchronous for the shift registers but synchronous for the output registers. To clear the outputs, you have to assert /SCLR low then send a pulse to RCLK. This means that the cap and supervisor techniques will not work. So forget anything to do with /SCLR.

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

edlikestoboogie
06-16-2010, 07:35 AM
Hey Phil,

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 Pilgrim (PhiPi)
06-16-2010, 09:58 AM
You could do it all in Spin and not use an extra cog.

-Phil

Peter Jakacki
06-16-2010, 10:07 AM
@Phil: How about that, so the CLR is useless in other words for most things and you need an extra line just for the OE then. That makes that 4 I/O plus the shift-register for a few pumps, why bother with the shift register then.

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*

edlikestoboogie
06-16-2010, 11:50 AM
@Peter: I'm confused, 4 I/O pins extra plus the three for the shift register (sck, data, latch)? I thought phil just wanted me to connect two signals to my prop, on top of those three signals, /G and /RCLK. And he wants me to connect \SCLR to VDD. Wouldn't that be two extra prop pins on top of the three? You are right though, this solution is starting to be a bad idea, with all the pins used. What I2C chips were you suggesting, hopefully under $1? I have to output 5v since I am using the mosfets, before this I tried using a TTL hex inverter, but this also outputted HIGH on start up, should I have used a non-inverting TTL buffer?

Peter Jakacki
06-16-2010, 12:48 PM
SCLK, SDAT, RCLK, OE are 4 outputs, not extra. The RCLK is the latch for the output register.

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*

edlikestoboogie
06-26-2010, 11:20 AM
I am just posting to confirm that the above solution given by Phil works. Thank you Phil.