Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / Logic gate toggle/flip flop circuit

Author
Message
Dark Java Dude 64
Community Leader
14
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 4th May 2012 05:41
Hello! For the past couple of days I have been in a logic simulator trying to create some circuit with logic gates that would have an input and an output, and whenever the input receives a rising or falling edge (doesn't matter which) the output would toggle to the opposite state. I have tried circuit with 4 internal sates, etc but I can't get anything to work! Any help would be greatly appreciated!

wë¡·sEæ
Nateholio
19
Years of Service
User Offline
Joined: 30th Dec 2005
Location: I\'ve Been Everywhere
Posted: 4th May 2012 09:14
Might this be what you are looking for?

The NOT/AND/NOR gates provide positive and negative edge detection and the flip-flop toggles between states.

In Development: K96 - Combat Simulation

Attachments

Login to view attachments
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 4th May 2012 13:10
Quote: "and whenever the input receives a rising or falling edge (doesn't matter which) the output would toggle to the opposite state."


Doesn't that defeat the purpose of even using a logic gate? You may as well use an inverter or buffer instead, as the output signal would always invert when you invert the input signal.

If you only want it to trigger on rising or only on falling signals, use a T-Flip Flop.

TheComet

Dark Java Dude 64
Community Leader
14
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 5th May 2012 07:20 Edited at: 5th May 2012 07:33
I will look into that! Maybe i was too specific; perhaps not on the rising or falling edge of the input but just something that in general would toggle the output... For example, if i were to connect some of these toggle circuits in such a way, i could use one to trigger another and so forth creating a counter! I will look into the T flip flop now!

Edit:
I looked up t flip flop schematics and made some in a logic sim but all of them either didnt work or when i toggled entered this strange oscillation.

wë¡·sEæ
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 5th May 2012 16:41 Edited at: 5th May 2012 16:44
Quote: "I looked up t flip flop schematics and made some in a logic sim but all of them either didnt work or when i toggled entered this strange oscillation."


T-flip flops rely on the fact that the input buffer for edge detection can delay the signal by a few nano seconds. In circuit simulators, all components are ideal, so you get strange effects that never really occur in real life. This is an example of how you can detect edges:



If you've built an RS flip flop in a circuit simulator, you'll most certainly get oscillation because again, RS flip flops rely on one of the NOR gates to be slightly slower than the other, otherwise you get undesired effects.

Here's a simple circuit I simulated quickly. I did it using an RS FF with an edge detected clock input:

http://forum.thegamecreators.com/xt/xt_apollo_pic.php?i=2345258

You can see nicely that the input signal's frequency (green) is halved at the output (red) because the output inverts at every positive edge.

TheComet

Attachments

Login to view attachments
Dark Java Dude 64
Community Leader
14
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 5th May 2012 21:17
Ah i see! Im wondering if oher options are available. One i tried is a circuit with two flipflops made from two NOR gates each, and there was a decoder to determine which one of four states the circuit was i at a point. If the input was high and if the state was one, it would flip to state two, then if it was in state two and the input was low it would flip to state 3, and if it was state 3 and the input was high it would flip to state 4, and if was in state 4 and the input was low it would switch back to sate 1. If it was in state 1 or 2, the output would be high and the output would be low if it was in state 3 or 4. Do you think the logic behind that is ok? I tested it in DBPro and it worked ok... I havent been able to gtet in the simulator though!

The way i tried to implement that was i had the flipy flopy thingys two store the 4 states as a 2 bit binary number, that went to a 2-4 decoder, that went over to a series of AND and NOT gates to determine what state to switch to, then that went to another circuit that was responsibe for switching the gates properly to then next state. The way i had it, the circuit wont switch unless the input changes somehow or another... What do you think of all that?

wë¡·sEæ
Nateholio
19
Years of Service
User Offline
Joined: 30th Dec 2005
Location: I\'ve Been Everywhere
Posted: 5th May 2012 21:42 Edited at: 5th May 2012 21:47


Do it the way The Comet or I told you. You're making it entirely too complicated.

In Development: K96 - Combat Simulation
Keep your Hope and Change, I choose individual Liberty!
Dark Java Dude 64
Community Leader
14
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 5th May 2012 21:55
Hehe... I would, but im trying to make a computer in a circuit simulator and i have to make it work in the simulator! It is complex but do you think it will work?

wë¡·sEæ
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 5th May 2012 21:59
Don't know about you, but my circuit simulator has basic computer components in it already. Just use those instead of trying to build everything out of transistors.

TheComet

Nateholio
19
Years of Service
User Offline
Joined: 30th Dec 2005
Location: I\'ve Been Everywhere
Posted: 5th May 2012 21:59
I'm not going to waste time thinking about it when it's more complex than it needs to be to begin with. All you need are two basic things: edge detectors and a F/F. If you didn't notice, the example I gave you worked as requested in a simulator.

You're trying to design a computer, or a CPU, in a simulator?

In Development: K96 - Combat Simulation
Keep your Hope and Change, I choose individual Liberty!
Dark Java Dude 64
Community Leader
14
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 5th May 2012 22:08
@TheComet Im not doing it with transistors but rather the basic gates it comes with instead.

@Nateholio Ill go take a closer look at your example.
Quote: "You're trying to design a computer, or a CPU, in a simulator?"
Who doesn't? Though many people, including TheComet build very complex stuff like this in Minecraft using redstone, where you dont have gates permade for you whereas i do in my simulator.

wë¡·sEæ
Nateholio
19
Years of Service
User Offline
Joined: 30th Dec 2005
Location: I\'ve Been Everywhere
Posted: 5th May 2012 22:18
I didn't mean "You're trying to design a computer, or a CPU, in a simulator?" in the sense of "Like OMG, you are soooo crazy. I wish I could do that".....

I meant, which one...computer or CPU?

In Development: K96 - Combat Simulation
Keep your Hope and Change, I choose individual Liberty!
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 5th May 2012 22:30
And if you have the option to use less space, then do it. There's no sense in composing your own T-FF out of deeper components if it's already available in once single chip.

TheComet

DeadTomGC
14
Years of Service
User Offline
Joined: 11th Aug 2010
Location: LU
Posted: 5th May 2012 22:39 Edited at: 5th May 2012 22:41
I would comment on this subject, but I feel that the discussion has gone too far for me to interject.

Edit: Actually, I'd like to ask, DBD, you're in a EE or CE major or something?


Dark Java Dude 64
Community Leader
14
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 5th May 2012 23:21
Quote: "I meant, which one...computer or CPU?"
Ah I see! Possible a computer, but the sim doesn't really have any nice input or output other than led an switches...

@comet actually strange thing, it doesn't have any t flip flops lol!

@deadtom No, I haven't had any colleg education yet! I do plan to do something like that though in the future.

wë¡·sEæ

Login to post a reply

Server time is: 2025-05-21 20:41:23
Your offset time is: 2025-05-21 20:41:23