Shop OBEX P1 Docs P2 Docs Learn Events
Three state LED - on, off, flashing — Parallax Forums

Three state LED - on, off, flashing

whyrnutzwhyrnutz Posts: 11
edited 2009-11-11 00:19 in BASIC Stamp
Hi All,
I need to have an LED go into one of three states (off, on, flashing), depending on the status of an input. I'm going to be doing other things during the main loop so I don't want to waste time with pause statements, so I was wondering if the attached circuit would do the trick. It's a modification of a two state led flasher from Forest Mims' Engineer's Notebook. It's based on a 74LS13 dual NAND Schmitt trigger, and according to the text, setting the control high will enable flashing and setting it low will keep the led on steady. Theoretically, if I set P1 low and P0 high it would enable the led to flash, if P0 is low the led would stay on, and if P1 is high it would turn it off. Would this work? Is there a better way to do it?

Post Edited (whyrnutz) : 11/9/2009 8:54:32 PM GMT
985 x 710 - 30K

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2009-11-08 18:16
    Nothing wrong with your thinking.

    This (off-loading some tasks) is classic microprocessor design technique.

    We do it with serial buffers, pwm control, high speed counters, etc.

    · Please use a descriptive Subject!

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • whyrnutzwhyrnutz Posts: 11
    edited 2009-11-08 18:32
    Woohoo!! I don't know which I'm happier about - the speedy reply, the fact that it will work, or that I've actually LEARNED something!

    Thanks, Tom!

    Tom Schoenknecht
  • Larry~Larry~ Posts: 242
    edited 2009-11-08 18:53
    Im all about easy! you are using two pins so you could have four states not just three,·using these same two pins P0,P1 with two led's
    no other circuit needed.
  • whyrnutzwhyrnutz Posts: 11
    edited 2009-11-08 19:08
    Wow, what a great idea! That never would have occurred to me. I'm definitely adding that to my notes for future use. I might even try to squeeze it in to this project, just because of the cool factor! wink.gif Thanks, Larry!
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2009-11-08 21:37
    It is possible to do all three states (OFF, ON or flashing) with one single Stamp pin. That is because the Stamp pins have three possible states, output LOW, output HIGH, or INPUT. See the attached circuit.

    LOW 0 ' turns the LED off
    HIGH 0 ' turns the LED on steady
    INPUT 0 ' allows the LED to flash at the rate determined by R and C

    attachment.php?attachmentid=64990

    Note that the CD4093 is a CMOS Schmitt trigger, and the circuit benefits from the high impedance CMOS input. Note that the resistor is a 1 megaOhm and the RC product is the same as it is in your circuit, 0.1 second, and it is the RC product that sets the flash rate. The high resistor value won't work with the 74LS series chips. There are CMOS triggers in the 74HC series (e.g. 74HC14, 74HC132).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com

    Post Edited (Tracy Allen) : 11/8/2009 9:42:12 PM GMT
    272 x 101 - 3K
  • sylvie369sylvie369 Posts: 1,622
    edited 2009-11-09 00:03
    Larry~ said...
    Im all about easy!
    Do you have a sister? tongue.gif

    Holy smoke, I really learned something too, from Tracy's response. That's amazing - another thing I'd have bet couldn't be done.
  • Larry~Larry~ Posts: 242
    edited 2009-11-09 00:16
    As a matter of fact two icon14.gif


    now if you want cool tracy's idea is that!
  • whyrnutzwhyrnutz Posts: 11
    edited 2009-11-09 16:26
    Wow, wow WOW! My coolmeter went off the scale with this one. Three states from ONE pin? Amazing! That's going to come in very handy for future projects but particularly for this one since I'm using a BS1 (a Prop-1 Controller), and as you know, every pin counts. Thank you , Tracy! And thanks to you and all the good people on this forum for sharing your time and knowledge with those of us who are perpetually learning. We really do appreciate it!

    I just wish I had been paying more attention when I wrote the original post as I didn't realize there was no subject until I saw it posted. I tried to go back and change it but it appears you can't do that. I'd really like to fix that as I'm sure there are other people who could benefit from this circuit. Speaking personally, I wish I had had this for many past projects, it would have made life much easier. Anyone have any thoughts? Is there a way to edit the subject line?
  • davejamesdavejames Posts: 4,047
    edited 2009-11-09 16:46
    Whyrnutz,

    Yup - go back to your original post, press the "pencil button" in the upper right corner (you'll enter edit mode), and change the subject line there. Re-submit and you're done!


    And Mr. Allen, very nicely done with that tip.


    DJ

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Instead of:

    "Those who can, do.· Those who can't, teach." (Shaw)
    I prefer:
    "Those who know, do.· Those who understand, teach." (Aristotle)
    ·
  • whyrnutzwhyrnutz Posts: 11
    edited 2009-11-09 21:24
    Thanks Dave!

    Tom
  • davejamesdavejames Posts: 4,047
    edited 2009-11-09 23:14
    ...welcome!

    DJ

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Instead of:

    "Those who can, do.· Those who can't, teach." (Shaw)
    I prefer:
    "Those who know, do.· Those who understand, teach." (Aristotle)
    ·
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2009-11-10 16:54
    I'm happy that will be a useful. Those CMOS Schmitt triggers can be useful for a lot of things, and they come 4 or 6 to a package!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Beau SchwabeBeau Schwabe Posts: 6,559
    edited 2009-11-10 20:54
    Yes!

    The 74HC14 is a personal favorite of mine.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • alphamike27alphamike27 Posts: 10
    edited 2009-11-11 00:19
    Woo Hoo Tracy Allen, what a great idea. New one for me too..........................
Sign In or Register to comment.