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.

Help needed w/simple logic function

Status
Not open for further replies.

carbonzit

Active Member
This question came up in another thread, but I'm starting a new one since I'm not getting any answers there, and this might be useful to someone beside myself.

In this circuit:

**broken link removed**

I don't know how to make the part that's the box with the "?" in it. Here's what this needs to do:

  • On power-on, it should output a logic "high" to the first flip-flop data (D) input. At the same time, it should generate a clock pulse to the flip-flop chain, long enough to initiate a cycle. (Sorry, clock connection not shown here.) The goal is to "seed" the first flip-flop so that its output is high to start; succeeding switch closures then cycle this state through the chain of flip-flops. The capacitor is as far as I got, to generate a long decaying pulse at power-on.
  • After this, it should "take itself out of the game". The connection to the data input should go high-Z (tri-state). Not sure if the connection to the clock needs this as well; if so, then do that.

So how would I implement this?

If you think this won't work, I'm all ears. I'm a newbie when it comes to designing combinatorial logic circuits.

As always, all help much appreciated.
 
I would suggest a reset circuit from Vcc consisting of an RC circuit into a Schmitt trigger (gate or comparator) which will generate a short reset pulse upon power up. Use this pulse to go to the "Set" input of the first FF and the "Reset" inputs of the other FFs. No need to generate a clock pulse.

For example a series cap of 10uF with a 10k resistor to ground connected to the logic input of a Schmitt trigger gate, such as a CD4093, should give a pulse of about 0.1s.
 
Hey, thanks! So something like this?

**broken link removed**

I'm wondering, why do I even need the gate? Can't I just use the pulse from the capacitor to set/reset the flip/flops? or is the NAND needed for waveshaping, to make a nice square wave that won't confuse the FFs?
 
I'm wondering, why do I even need the gate? Can't I just use the pulse from the capacitor to set/reset the flip/flops? or is the NAND needed for waveshaping, to make a nice square wave that won't confuse the FFs?
Well, the purpose of the gate is to provide a nice square pulse, but the SET and RESET lines should be tolerant of a slow fall-time, so running the cap directly should work fine.

Incidentally you need to note the polarity of the SET and RESET inputs. You show an inverter, which would make the signal active low. If the inputs are active high then going directly from the cap will work.

Edit: Make sure you ground all the unused inputs on the FFs.
 
Last edited:
The cap and the resistor need to be reversed. If the switch at the bottom is the power switch then the line feeding the cap has to be moved after the switch. It's not necessary to have the ground of the gate connected to ground.

The cap acts as an initial short circuit until it charges up. A schmidt trigger or inverting schmidt trigger is all thats needed depending on the sense of the S input. If the sense was active high (rising edge), then an inverting schmidt trigger would do.
 
The cap and the resistor need to be reversed.

Why does that matter? The cap will be charged to the same value regardless, no?

If the switch at the bottom is the power switch then the line feeding the cap has to be moved after the switch.

That's the "toggle" switch, not a power switch.

It's not necessary to have the ground of the gate connected to ground.

I think it is, since the device is a NAND gate (that's what was suggested to me), but I didn't realize I could just use a simpler Schmitt trigger (inverter device) with only one input.

In any case, the previous response convinced me that no gate is needed, just a capacitor and resistor to generate a (decaying) pulse. Apparently having the pulse die away slowly won't scramble the flip-flops' little brains.
 
Last edited:
Reversed. Yes. The input to the gate has to be the voltage across the capacitor to ground since that's the logic reference.

If you need a NAND somewhere else, then use a NAND. Just tie two inputs together and you get an inverter.

If you need an EDGE, you won't get one without the schmidt trigger. I had to change a chip on a single board computer to a schmidt because of reset issues and a linear regulator. If I used a switching regulator it would reset every time. With the linear, it wouldn't.
 
Reversed. Yes. The input to the gate has to be the voltage across the capacitor to ground since that's the logic reference.
Reversed. Not necessarily. It depends upon the reset polarity you need.

With the capacitor first in series and the resistor to ground, the voltage will immediately go the the supply voltage (logic high) and then decay to logic low. That's what's needed if the SET and RESET signals are active high if going directly to these pins.

If the resistor is in series and the cap to ground, then the voltage will initially be logic low and rise to the supply voltage (logic high). That would be needed if the SET and RESET signals are active low if going directly to these pins.
 
So to follow up, I used this circuit, which seems to work fine for my little experiment anyway (3 4013 flip-flops):

**broken link removed**

I used 22K for the resistor and a small electrolytic cap. I suspect a much smaller cap would work as well.

This was used to set one of the flip-flops and reset the other two. Worked reliably every time. No need here for a Schmitt trigger, apparently.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top