Shop OBEX P1 Docs P2 Docs Learn Events
Floating pins problem with 74HC595 and propeller. — Parallax Forums

Floating pins problem with 74HC595 and propeller.

DavidMDavidM Posts: 630
edited 2011-09-01 18:08 in Propeller 1
Hi,

I have successfully written some code to control a shift register the 74HC595.

I am using the propeller demo board and a bread board with the shift register on it, I have 8 led's connected to the 595, My program simply turns on the LEDS on and off every second.

I have three lines coming from the propeller, CLOCK , LATCH AND DATA, as well as VSS & VDD ( 5 in total)

PROBLEM..
I have noticed that when I immediately turn on the propellor board that I get a sequence of leds flashing very quickly from 1 to 8 before the propellor code runs!

I have used the schematic from BS2 projects that show demos of the BS2 connected with the 74HC595 chip.

QUESTION..
How can I prevent the FALSE flashing of the outputs ( the LEDS) during power up? I think this has something to do with floating pins!

By the way ( used the code for SHIFTOUT from the BS2 library functions and it had an error , the LATCH pin is not mentioned at all in the code.

regards

David M

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-03-12 02:28
    The serial clock and latch clock are both positive edge triggered. You would like to hold them at logic low (ground) levels until the Propeller program can initialize the pins to low outputs. Just connect a 10K resistor between each pin and ground. Strictly speaking, you should provide a pull-up or pull-down resistor for any logic input connected to a logic output that can "float" at times like a microcontroller I/O pin.

    The BS2 SHIFTOUT code does not mention the LATCH pin because it's not part of the SHIFTOUT function. It's not an error. There are many other devices that do not have the latches that the 74HC595 has.
  • DavidMDavidM Posts: 630
    edited 2007-03-12 02:49
    Hi Mike,

    Regarding the latch pin , fair enough, but it had me stumped for hours!

    I placed two 10K resistors between the CLOCK & LATCH pins and back to ground.

    This SORT OF works.


    I slowed down the flashing of the led's so I could turn the POWER OFF when the LEDS were either on or off, I have noticed that if I turned the power off and then on again when all of the led's were off, then your suggestion works ok,
    But if the power is turned off when the led's were on, then it seemed to remember the state of the outputs ( i.e all on) until the propeller is ready, So I need some way of resetting the outputs of the 595 to always off during power up! Any ideas

    regards

    Dave M
  • Mike GreenMike Green Posts: 23,101
    edited 2007-03-12 03:41
    There is no direct way to reset the storage register with this part.

    There is an output enable (/OE) pin. You could have a pull-up on this and connect it to a Propeller I/O pin. During initialization, the last thing the Propeller would do is to set this pin to a low output which would turn on the 74HC595 output drivers. If you're just driving LEDs, this would leave them unpowered initially. If you're feeding logic inputs, you'd have to have pulldowns on those outputs so the inputs would see a logic low.
  • OzStampOzStamp Posts: 377
    edited 2007-03-12 04:02
    Hi David

    Mike's last suggestion of pulling up the OE line and controlling is what we spoke about on the phone.
    How many outputs do you want to control .. there may be a better way..??



    Ronald
  • DavidMDavidM Posts: 630
    edited 2007-03-12 06:01
    Hi Mike,

    Ok I have it working now! Thanks

    I hooked up the enable pin of the 595 using a 10K resistor to 5V+ ( pull up ) and then the same enable pin to a 470R resistor to an extra I/O pin on the prop. I set the ENABLE pin to LOW ( OFF ) at the start of my code and it seems to work.

    Does this means that the enable pin is always getting 5V but its not floating?


    thanks

    dave M
  • Mike GreenMike Green Posts: 23,101
    edited 2007-03-12 06:13
    dave,
    The enable pin of the 595 is pulled to whatever voltage is on the +5V line by the 10K resistor. I say this because it usually takes a few milliseconds for this to actually reach +5V when you turn the power supply on. The 595 input pin and the Propeller input pin are high impedance initially and don't present much of a load on this, so, even though you have a 10K resistor there, the voltage on the enable pin is essentially the same as the +5V line. By definition, the enable pin is not floating because its voltage is always defined (floating = undefined).

    Once your code gets around to initializing the pin to an output, the I/O pin overrides the "weak pull-up" since the I/O circuitry in the Propeller connects the enable pin to either roughly +3.0V or 0.3V (logic high or logic low) through a low resistance. The input circuitry of the 595 treats the +3.0V as a logic high so all is well. When the output pin (OUTA) is set to low, the enable pin is effectively grounded.

    This is kind of a longish and detailed explanation, but I hope it gives you a bit more insight into what you're doing.
  • DavidMDavidM Posts: 630
    edited 2007-03-12 06:55
    Thanks Mike,

    I am slowly understanding this.

    The main thing now is that IT WORKS, I will document my breadboard circuit so I can use this info later in my main project.
    Having the control of the ENABLE PIN is now a GOOD THING for my project.

    Next, I have to work out how to cascade 2 or more 595's.

    regards

    Dave Metus
  • jordan2003jordan2003 Posts: 6
    edited 2011-08-04 02:27
    Mike,
    Thank you so much for providing a clear and easy to understand reason why to put a pull up or pull-down resistor in an IC to IC connection. I have wondered about this and it briefly comes up in theory articles but it's been a little confusing on when you actually need to do this. Please let me know if this is standard practice in all IC to IC I/O connections? Should I always have a pull-up /down resistor? If so, what formula should i use to calculate optimal resistor values?

    I have an IT Informations Systems Degree and Electronics Engineering Assoc. Degree from 15 years ago but i am just now revisiting the electronics area after being in I.T. Infrastructure for the last 20 years(I was banging a kayboard in '84 at 14 and started working for banks at age 20 so I'm old school..LoL...). I am defiantly enjoying it again though for the second time in my life. I am currently integrating the Prop into my products for lighting control and hope to have a new product for my industry soon. I am VERY interested in I2C, Serial, etc.. Shift Registers and Shift-Registers with DC/GS/PWM control and it's been daunting. I'm slowly picking up more advanced skills but it will probably be a while till i can really get down with the prop. Lol.. Your explanations helped out a lot and I hope to read more.

    Thanks again for the info!


    Jordan
  • LeonLeon Posts: 7,620
    edited 2011-08-04 02:42
    You don't need them for all IC - IC connections. Pull-downs are often used when driving high-impedance input devices like MOSFETs from MCU outputs. Most MCUs have all their I/Os configured as inputs when they are powered up, or reset, and this would cause the MOSFET gate to float, which is undesirable as one doesn't know what the motor it is controlling, for example, will do in that situation. The pull-down resistor will ensure that the MOSFET is off until the MCU starts running its program and driving it. Something like a 10k resistor is usually used in that situation.
  • SapiehaSapieha Posts: 2,964
    edited 2011-08-04 06:20
    Hi jordan2003.
    Please let me know if this is standard practice in all IC to IC I/O connections? Should I always have a pull-up /down resistor? If so, what formula should i use to calculate optimal resistor values?

    You can use that formula

    IF You connect one IC in that chain that have know output state ---> You don't need that resistors.
    IF You connect IC's that don't have know states ( Inputs/TriState-In/Out) USE that resistors and place by them that connection is state You prefer (+/-)
  • kochevnikkochevnik Posts: 30
    edited 2011-09-01 14:10
    I know this is an older thread - I searched the forums for this - I was wondering if there is some simple Spin ode
    that someone has that could show how to drive several of these shift registers chained together ?

    A newb question I know, but well, I am a newb LOL

    I see a lot of stamp examples but have not found a Prop example yet.

    Thx
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-09-01 14:48
    The OBEX has a bunch of great code.

    Here's a shift register object I've used several times.

    http://obex.parallax.com/objects/437/

    Duane
  • tonyp12tonyp12 Posts: 1,951
    edited 2011-09-01 14:51
    Driving multiple is the same as driving one 595.
    You simple send the 8 clocks * chips used before doing the latch.

    see my code here:
    http://forums.parallax.com/showthread.php?129182-New-LED-driver-for-PPDB-Now-Available&p=983421&viewfull=1#post983421

    I also made a 1wire version that uses 1.5k ohm, 33k Ohm and two 2.2nF caps to hold serial and latch.
    http://forums.parallax.com/showthread.php?134106-Updated-17seg-LED-driver-for-PPDB-now-available.&p=1031110&viewfull=1#post1031110
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2011-09-01 18:08
    You may run into other issues once you start adding on 74HC595's that are running at 5V. I did. The Propeller has no problem driving the input on one 74HC595 but when I tried to go to four of the chips I started getting random garbage on the displays. to resolve it I used a 74HC14 chip. I used a pair of the inverters (back to back) on the clock and latch lines. That way the Propeller is still just driving on input. The output of the 74HC14 is running at 5V and has no issues driving the inputs on multiple 74HC595 chips. I know I have an older post that mentions the issue and how I fixed it.

    Robert
Sign In or Register to comment.