Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

I can't understand this 4013

Status
Not open for further replies.

Axe_Murderer

New Member
I know this thing should be simple, but I just can't get it to do what I want or expect it to do.

I want to use a signal to trigger a latch, and that latch stay set until I use a different signal to open it, regardless of how the trigger signal changes. Should be simple.

Using a 4013 I came up with the circuit attached. However not only doesn't it do what I want, it doesn't do anything! :( I expected it to turn on the LED on the first pulse from Clock and the LED to stay on until power is interupted from Vdd.

So throw me a bone. What the heck am I doing wrong? I'm obviously missing something fundamental about this IC.

Thanks.
-Mark
 

Attachments

  • 4013.gif
    4013.gif
    3.4 KB · Views: 1,509
The circuit doesn't work to your expectations because you have connected "D" pin to ground. Remember, in a D Flip-Flop, whatever data is there on the "D" pin will be transferred to "Q" pin (output) on every clock pulse. Here "D" is at logic 0 so your LED doesn't lit up. Make "D" = 1 and then try giving clock pulse. It will glow.
 
Try using a few relays and a timer unit. instead of the 4013. i have done this and it worked for me.
YOUR BONE HAS BEEN THROWN!!!!!!!!!!!! :D
 
it sounds like what you really want is an R/S flip flop... that way you use one line to turn it ON, and the other line to turn it OFF, rather than interrupting the power to turn it off...

also, yes, with D tied to ground, Q will always be 0... you could switch your LED to Q/ or pull D high.
 
precedence

Just a note. The previous circuit works fine as long as the trigger signal isn't present when reset is applied. My datasheet shows the 4013 driving both Q and Q' high if both SET and RESET are high at the same time.

Keep in mind that the asynchronous inputs (SET & RESET) take precedence over synchronous inputs (the "D" input in this case. Synchronous inputs are those that change the flip-flops' state on a clock edge.) If you want to reset the flip-flop regardless of the state of the trigger input, use the D input (set to a logic one) & clock to set, and the RESET input to clear.
 
Re: precedence

Sorry guys but it's still not working. Connected as drawn above it doesn't stay on once the trigger signal is removed. :?: What could I be doing wrong?
 
Hi, if I understand what you what, you what Q to go HIGH and stay there..
the 4013 was not designed for what you want, you need a circuit that will latch on the input, the 4013 will not do this if you take the control signal away..this is the same type of circuit used in alarm systems, if the trigger
is taken away the alarm still sounds...
 
D flip-flop connections

"Connected as drawn above"
refers to which schematic or suggestion? Could you post a schematic of your current hookup or list what each pin is connected to? Does the trigger signal go away before the reset signal is applied? Sebi's right, the flip-flop will behave like a latch if the asynchronous SET and RESET inputs are used, they just shouldn't be driven at the same time, as noted earlier.

p.s. do you have another CD4013 to try? They're easily damaged by static charge.
 
Re: D flip-flop connections

I tried Sebi's drawing. Since I don't have another 4013 I tried the other side with no improvment in results. Currently, both Q and Q/ stay hot all the time no matter what I do to Set and Reset (although at about half the supply voltage).
What should the set and reset be connected to when not "in use"? Can they just float?

Just to paraphrase my needs, I want the light to come on and stay on. To turn it off I will probably just remove power from the whole circuit, so that simplifies some things.

Thanks again folks.
 
CMOS inputs

You should never leave CMOS inputs floating, tie unused ones to their inactive level. For example, the set and reset inputs should be tied low when not in use. Your 4013 may be damaged (first make sure that you've tied all of the unused inputs inactive). What other ICs do you have? It's easy to make a cross-coupled latch out of a couple NAND or NOR gates (CD4011 or CD4001).
 
The 4013 will do what you want it to do. Yes unused inputs must be tied either to ground or to the positive rail. The diagram does not show a resistor in series with the LED. On any 4013 the output will only supply a certain amout of current, depending on which version it is. I would put a resistor in series with the LED to limit the current. 560 ohm for 5V and 1k for 12 supply voltage. When the power is applied to the 4013 it can come up in any state that is to say Q or Q not could be positive. By putting a .1uf capacitor from the reset terminal to the positive rail and a 10k from the reset terminal to ground will force the Q to be high on power up As the capacitor charges the terminal will be pulled low.
If you want the circuit to toggle that is the first trigger to light the LED and the second trigger to turn if off then you need to connect the D input to the Q not terminal. Make sure the trigger signal is at or near ground when not active and connect the trigger to the clock or CL pin, connect the reset to ground. The first positve trigger will turn on the LED, and the second one will turn if off.
If you only want a trigger to turn on the LED, then connect the D and the CL terminals to ground and connect the trigger to the reset terminal. When the trigger goes from ground to positive the LED will come on.
One final note the trigger signal must be noiseless and have only one ground-to-positive edge transition. If using a pushbuttion that is not debounced will not do the trick.
:lol: Ned
 
Well I've decided that I'm too dangerous to be left alone with logic gates. Fortunately I don't have any others around to mess up. One thing I don't understand is how I would keep the input low and then switch it to high without it also floating momentarily during the switch over. My lack of EE schooling shows I'm sure. :)
As a workaround I'm going to use a spare decade counter for the job, unless someone can offer a better solution (I also have some 555 laying around, might that work?). The signal pulse in question will last one minute and only occur every 12 hours. To turn the circuit off I'll probably just kill power to the whole circuit anyway, so that part is simple.

Thanks again.
 
555 latch

Although it isn't normally used that way, a 555 can be used as a latch, since it has a SR latch at its heart. The Threshold (pin 6) and Trigger (pin 2) act as the Set/Reset inputs. To work around the input comparators, the Threshold "high" just needs to be > 2/3 VCC and the Trigger "low" needs to be < 1/3 VCC. No problem if you're using VCC and GND levels for the inputs.

Threshold (S) turns the latch on, and the Trigger (R) or Reset input can be used to turn the latch off. Tie whichever one you don't use (pin 2 or 4) to VCC. The pullup/pulldown values aren't critical, they're just there to keep the inputs from floating.

Note that you only have access to the inverted state of the latch through pins 3 and 7. The normal buffered output at pin 3 can sink or source loads of up to 200mA, and the output is high when the latch is off. The discharge output at pin 7 can sink current when the latch is on and can also be used for level translation if the pull up resistor is connected to a positive supply other than VCC.

- CAL
 

Attachments

  • 555_latch.gif
    555_latch.gif
    14.1 KB · Views: 1,057
Sebi said:
I've edited the previous post.

Sebi's last revision works as needed. Thanks, I would have never figured that myself. Happy I didn't damage my flip-flop since I need the other half for something else.

laroche73: Thanks for the 555 circuit. I'm going to keep that one around for next time ;)

FYI, the circuit is for my nixie alarm clock. Plenty of nixie clock projects out there, very few that incorporate a full featured alarm. 8)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top