4013 Flip Flop Toggle Start up

U

Up in Canada

Guest
Hello-

I am using a 4013 as a toggle to control a LED.
Simple school project.

I have Qbar connected to Data, Q is to a small fet that turns on a LED.

The clk input is connected to a MOM push button switch that grounds it
out when pushed.
I have RESET and SET at ground.


It works great so far!!


Now, how do I control the Startup condition?

I need to have one that powers up with the Q high (led on)

I also will use the other half of the 4013 in the same exact way,
totally independent, but need this Q to startup LOW( that led off).


Thanks.


Alvin
 
You probably should debounce that switch to
derive one active clock edge per push.
Errrr.... how do you reccomend?

Build the following circuit with a 1N914 diode
(or equivalent), a 100k resistor, and a 100 nF
cap. Connec TrueBriefly to the SET or RESET
input of each FF, as dictated by your requirement.


Perfect, it works great!! Thank you, thank you thank you thank you
thank you!
 
Up in Canada wrote:
Hello-

I am using a 4013 as a toggle to control a LED.
Simple school project.

I have Qbar connected to Data, Q is to a small fet that turns on a
LED.

The clk input is connected to a MOM push button switch that grounds
it
out when pushed.
I have RESET and SET at ground.


It works great so far!!


Now, how do I control the Startup condition?

I need to have one that powers up with the Q high (led on)

I also will use the other half of the 4013 in the same exact way,
totally independent, but need this Q to startup LOW( that led off).


Thanks.


Alvin
Hi, Alvin. I'm hearing that this is what you're doing with 1/2 of a
4013 (view in fixed font or M$ Notepad):


` .-----------------------.
` | .---. |
` | | | |
` | | | |
` | === | |
` | GND | |
` | .------o------. |
` | | S | |
` '----o D Q o-----------> To LED Driver
` | | |
` T | | |
` --- | | |
` .----o o------o 1/2 4013 | |
` | |CLK | |
` | | | |
` === | Q'o----'
` GND | |
` | R |
` '------o------'
` |
` ==` GND
created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de

The way to get it to start in a known state is to apply a momentary
pulse to the SET or RESET pin (not both) at startup like this:

` .-----------------------.
` | .---. |
` | | | |
` | | | |
` | === | |
` | GND | |
` | .------o------. |
` | | R | |
` '----o D Q o-----------> To LED Driver
` | | |
` | | |
` | | |
` VCC o 1/2 4013 | |
` + |CLK | |
` | | | |
` .-. | Q'o----'
` 10K| | | |
` | | | S |
` '-' '------o------'
` | |
` o---------------'
` |
` ---
` ---
` .01uF |
` ==` GND
created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de

The R-C will result in a brief (about 0.1 ms.) high pulse at the SET
pin, which will result in the 4013 coming up with Q = 1.

You've got a bit of a problem, though, with the clock input, at least
the way you describe it. You're trying to create a toggle, or "T" F-F
out of a D F-F. That means there can be one and only one clock
transistion each time you press the button. CMOS inputs can be seen as
very small (pF range) capacitive loads. Because of leakage current on
your perfboard or imperfections in the chip, your input seems to want
to float high. When you press the button, you're discharging that
small capacitor, leading to what seems to be a good single logic
transistion.

That's not a good idea for a couple of reasons. CMOS inputs aren't
like TTL inputs, where they just naturally go to onoe logic state. And
also, it's very bad practice to allow slow transistions on clock
signals unless they're going into a schmitt trigger or something else
that will shape them up. Strange things happen inside clocked logic
ICs when the clock transition is pokey, and none of them are good.
Possibly you're the beneficiary of beginners' luck.

Anyway, the other half of the 4013 can help you with your issue here.
If you've got a SPDT pushbutton, you could try this with the other half
of the IC (view in fixed font or M$ Notepad):

` .--o-----------.
` | | |
` | .-. |
` | | | |
` | | | |
` | '-' |
` | | .------o------.
` VCC | === | S | Debounced
` + | GND.--o D Q o-------->
` | | | | | Clock Signal
` | o-' | | |
` '----o--__ | | |
` o-. o--o 1/2 4013 |
` | | |CLK |
` | | | |
` | | | Q'o
` | === | |
` | GND | R |
` | '------o------'
` '--o-----------'
` |
` .-.
` | |
` | |
` '-'
` |
` ==` GND
created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de

(Note that we're're following one of the primary rules of CMOS, which
is to never leave any input floating. Even if it isn't doing anything,
the intermediate logic level at the input almost always dramatically
increases power dissipation.)

The SPDT pushbutton is normally asserting the RESET input high. When
you press the button, it will let go of RESET before it asserts SET,
and you won't have to worry about pushbutton bounce causing multiple
clock transistions. When you let go of the pushbutton, SET will be let
go, but the Q output will remain high until the first contact of the
switch with the RESET input. This is called debouncing. One and only
one logic transition.

So, your whole one IC debounced toggle flip-flop should look something
like this:

` .--o-----------. .---------------------.
` | | | | .---. |
` | .-. | | | | |
` | | |10K | | | | |
` | | | | | === | |
` | '-' | | GND | |
` | | .------o------. | .------o------. |
` VCC | === | S | | | R | |
` + | GND.--o D Q o--------. '---o D Q o------>
` | | | | | | | | |
` | o-' | | | | | | |
` '--o--__ | | | | | | |
` o-. o--o 1/2 4013 | VCC'-----o 1/2 4013 | |
` | | |CLK | + |CLK | |
` | | | | | | | |
` | | | Q'o .-. | Q'o---'
` | === | | 10K| | | |
` | GND | R | | | | S |
` | '------o------' '-' '------o------'
` '--o-----------' | |
` | o--------------'
` .-. |
` | |10K ---
` | | ---
` '-' 01uF |
` | ==` === GND
` GND
created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de

You can put your R-C pulse at the SET or RESET pin of the 2nd 1/2 of
the 4013, depending on what you've got at the output, and whether you
need it to power up ON or OFF. You will also have one and only one
logic transition for every press of the pushbutton.

Good luck with your homework
Chris
 
Wow, thanks!!


My switch actually *has* to be a momentary mini toggle, ie, the spring
loaded ones that return to their original position.
I'll go looking to make sure they make these in SPDT!!!

Thank you, I really do appreciate your help. I looked in my textbooks
first.

Thanks!
 
one thing more.

I may need to add more momentary switches in parallel for remote
operation. Well not remote, but think of a light switch on each side of
a room.
It still has to be momentary toggles.

Uh oh, I think it just got more complicated. I have to use the least
amount of wires.

Anyway to have a debounce with just the momentary spst? If I have to
use a remote box with cable conected to mulitple leds, the less wiring
in cables the better. If I have to do 30 leds you can see what I mean.
I

I'll reread it all before I post again.

Thanks
The excitement!!
 
Up in Canada wrote:
Wow, thanks!!


My switch actually *has* to be a momentary mini toggle, ie, the
spring
loaded ones that return to their original position.
I'll go looking to make sure they make these in SPDT!!!

Thank you, I really do appreciate your help. I looked in my textbooks
first.

Thanks!
No problemo. Some of this probably wouldn't have been in your
textbook, anyway. The R-C pulse and the use of the forcing S and R
inputs instead of D and CLK usually aren't in beginners digital logic
books. There are a lot of "tricks" that will help you that they might
not teach in class.

For CMOS logic "tricks", try finding a copy of Don Lancaster's "CMOS
COOKBOOK". If it's not at the library, you can get it from Amazon or
Mr. Lancaster's website:

http://www.tinaja.com/

It's a good source for a lot of these tricks, and still very relevant
to a lot of what you'll do with digital logic. Well worth it. I
particularly like his discussion of MML (Mickey Mouse Logic) in Chapter
3. It explains some of the limits of this stuff, which is easy to do
with CMOS.

Other sources of tricks are Mr. Lancaster's magazine columns (many of
which are available on his website, too), and manufacturer data sheets
and app notes. Look particularly at old National Semiconductor,
Fairchild, and RCA COS-MOS appnotes if you can find them.

Keep learning and having fun. It's not all in the textbooks.

Chris
 
Larry,

I will try that feedback approach.

I will also research this schmidt trigger approach.

Thank you!



Chris,

Thanks for the help and the references!!

Thank you!
 

Welcome to EDABoard.com

Sponsor

Back
Top