PDA

View Full Version : Three state LED - on, off, flashing



whyrnutz
11-09-2009, 01:08 AM
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

stamptrol
11-09-2009, 01:16 AM
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
·

whyrnutz
11-09-2009, 01:32 AM
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~
11-09-2009, 01:53 AM
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.

whyrnutz
11-09-2009, 02:08 AM
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! http://forums.parallax.com/images/smilies/wink.gif Thanks, Larry!

Tracy Allen
11-09-2009, 04:37 AM
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

http://forums.parallax.com/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 (http://www.emesystems.com)

Post Edited (Tracy Allen) : 11/8/2009 9:42:12 PM GMT

sylvie369
11-09-2009, 07:03 AM
Larry~ said...
Im all about easy!

Do you have a sister? http://forums.parallax.com/images/smilies/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~
11-09-2009, 07:16 AM
As a matter of fact two http://forums.parallax.com/forums/posticons/icon14.gif


now if you want cool tracy's idea is that!

whyrnutz
11-09-2009, 11:26 PM
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?

davejames
11-09-2009, 11:46 PM
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)
·

whyrnutz
11-10-2009, 04:24 AM
Thanks Dave!

Tom

davejames
11-10-2009, 06:14 AM
...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 Allen
11-10-2009, 11:54 PM
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 (http://www.emesystems.com)

Beau Schwabe (Parallax)
11-11-2009, 03:54 AM
Yes!

The 74HC14 is a personal favorite of mine.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

alphamike27
11-11-2009, 07:19 AM
Woo Hoo Tracy Allen, what a great idea. New one for me too..........................