FLIP-FLOP or FLIPFLOP or FLIP FLOP or TOGGLE or ONE BUTTON or ONE-BUTTON

Gerry - your examples may work on a Modicon with its 'by column scan' but for most others the "Toggle" will end up being unlatched alll the time. After it is latched (possibly) the test on the next rung, or the next branch of your second example, will see "Toggle" as latched then unlatch it again. Terry was proposing a processor independent format.
 
I think that might be a trick question!

My answer is... uummm... "TRUE"!

No wait! "FALSE"!

No wait... damn it! I knew this was a trick question!

No, it's not! YES, IT IS!

See, I told ya Casey... "apparently not".
 
Last edited:
Terry Woods said:
Archie,
Yours will work, however, isn't it kinda weird to operate a light or motor by "releasing" a push-button? And it is not exactly what I would call easy to decipher. Bubba would probably get dizzy trying to figure it out.
No it is not weird, you only have to understand that R1 is the "toggle bit" :)
Bubba understands it:) Do you you?:)
 
Since this is titled with FLIP-FLOP, One pushbutton etc lets offer some details on the subject. I have no idea now what my point was in my earlier response.

First let me say that I am one of the BUBBA’s you are referring too, just a maintenance man that happens to have some electronic background. Many of the people that come here are "students" that may or may not have an electronic background therefore using the word flip-flop is inappropriate. I respectfully submit that learning to understand what a flip-flop (bistable multivibrator) would be equal to learning how a one-shot works. I think all plcs these days have some form of one shot instruction. More on what a one shot is later.

Electronic flip-flops are bistable multivibrators that offer a form of one bit memory. There are 4 types, SR, D Latch, Toggle, and JK. The links below will provide more detailed information on flip-flops; the first link provides ladder diagrams equal to the flip-flop actions.

http://www.patchn.com/Digital/DIGI_10.html

http://en.wikipedia.org/wiki/Flip-flop_%28electronics%29

What Terry has created above I believe would be a D-Latch type flip-flop, the WAS bit is the equivalent to the E (enable) of the D-Latch flip-flop.

ONE SHOTS: What are they? They are a plc instruction that is only TRUE or ON for one scan of the plc. To understand "scan time" then look at what Phil Melore has provided here;

http://www.plcs.net/chapters/scan13.htm

There is also a section on One-shots; http://www.plcs.net/chapters/oneshot18.htm

There are differences between brands and different types.

Allen Bradley has ONS (one shot) and OSR (one-shot relay) instructions. Other brands use Positive or Negative differential which may be a contact or coil instruction and different methods for display i.e. (P), (N), (^) etc.

As mentioned before I have offered examples of flip flop or one pushbutton on/off on this page;
http://www.patchn.com/flipflop.htm

Note also that a flow chart diagram provided by Terry is also on that page.

Many PLCS today have "toggle" or "pulsed" instructions available, just take time to understand what your brand offers. I personally wish they did incorporate a "flip flop" instruction that was selectable between the 4 basic types. This is possible to develop in some cases.

The above discusses one pushbutton (one input) to latch on/off but what if you want an adjustable "pulsed output" (flasher). I have some AB examples on this page;
http://www.patchn.com/ab_plc_flasher.htm

Different brands use timers differently so you have to understand the timers for your brand. The first example using 2 timers should be easy to convert to other brands.

This has also been posted in this thread; http://www.plctalk.net/qanda/showthread.php?p=153764#post153764

 
Last edited:
Terry Woods said:
Archie,
Yours will work, however, isn't it kinda weird to operate a light or motor by "releasing" a push-button? And it is not exactly what I would call easy to decipher. Bubba would probably get dizzy trying to figure it out.

And by the way Archie, the conditions that cause the need for "debouncing" should not be considered frivolous.
Terry,

The "on after release" is very easily changed by replacing all R1's with Target, and all Target's with R1.

As for debouncing, yes there will be a problem if your PLC scans faster than the settle time of a switch. My experience is that PLC's typically operate in the 10ms scan range and most switch bounce is settled after a few hundred microseconds.

And note that I did not say ALL!

The solution does seem complex and hard to follow, but if you see the origin, it all then makes sense. Getting to the solution is much more interesting that the solution itself. This logic was derived using a state transition diagram with grey code defining each state, then minimizing the logic. Ohhh the days of designing electronic digital logic circuits.
 
bernie_carlton said:
Gerry - your examples may work on a Modicon with its 'by column scan' but for most others the "Toggle" will end up being unlatched alll the time. After it is latched (possibly) the test on the next rung, or the next branch of your second example, will see "Toggle" as latched then unlatch it again. Terry was proposing a processor independent format.

DANG
You're absolutely right of course - that would be why I normally just use a counter.
However, I do like that multi-bit XOR solution on the other FF thread.o_O
 
Terry,

Thanks for hijacking my thread. Like we needed to start another one on flip-flops. But I guess this is par for the course for me.

And Ron. I couldn't figure out at first what you meant by "bubba" when you posted in my thread. Then I saw that you were responding to a post in Terry's thread. I guess I could call myself a "bubba" too since I came in the back door of PLC programming. 20 years ago I was crawling around under houses as a residential electrician. Now I sit in front of a computer most of the day designing control panels in AutoCad and\or doing PLC programming.

Also thanks for your example of the flip-flop circuit. I used it in my program.(y)

Sorry if this post seems a little whiney. May be the result of working 65 to 70 hours per week for the last 4 months. :sleep:
 
I'm new to this forum, so please excuse me if this example of Toggle-Toggle (or flip-flop) has been posted. This is what I use. One advantage is that the Toggled Bit (IND) will un-toggle when the PLC goes to program mode. In the second rung, you can easily add permissives like E-stops or guards closed. There may be some plcs that this logic is not possible. For me, this logic seems very intuitive and easy to explain to new programmers.

Toggle.JPG



Regards,
Mark.
 
TSmith said:
toggle2.JPG


This AB logic. It is a simple toggle
!st time input is true CTU=1 Output is on
2nd time input is true CTU=2,resets,CTU=0 Output is off
Is there an easier way to post pics or drawings? Thanks


Now thats what I call doing it the hard way.

Lets take a look at the counter ACC. Pay attention to what the LSB is doing in binary:
0 = 0000
1 = 0001
2 = 0010
3 = 0011
4 = 0100
5 = 0101
6 = 0110
7 = 0111
8 = 1000

Do you notice anyting about the ACC/0 bit? Notice how each time the counter upcounts, the value of the ACC/0 changes state.

If you are hell bent on using a counter to implement a flip flop then skip all of the resets and the EQU compare instruction - these all consume cpu cycles.
AL42406.GIF

Forget about the actual value of the ACC or the preset or the DN bit or even counter roll over, the only bit that matters is the ACC/0 bit. BTW, when using a counter as a flip flop you create a retentive flip flop, so be very careful.
 
Gee...

All of the "heros" out there seem to ignore the primary stipulation...

What part of "ANY PLC" do you not understand?

Most of you have come up with a "brand-specific" solution!
Some are "function-specific" (again, brand specific).
Some are just... "cute", however, none of them are universal.

Obviously, very few of you, if any, have been "around-the-block" enough to realize that there are more PLCs out there than your own particular favorite brand!

Some of those other PLCs are more capable, some of them are less capable.
BELIEVE IT OR NOT!!! Not all PLCs are as capable as your personal favorite!

My solution will apply to "ANY PLC"!

Yours will not.

Don't you get it???

And to you, rta53...

I didn't "hijack" your thread. "Hijacking" occurs within the thread. I simply started a new thread, of my own, that directly addressed the search-issue and the universal-solution-issue.

Do you have a problem with me helping those that don't have your particular favorite brand?

If so... too bad. This ain't the rta53 site.

Don't take it personally... except to the extent that you really need to reconsider your attitude about this issue.

Damn! I hate using sharp daggers! But sometimes...
 
Terry Woods said:
My solution will apply to "ANY PLC"!

Yours will not.

Don't you get it???

Terry, FYI, we do get it.

But why bother to re-construct what some PLCs already have? That kind of negates any advancement in instruction sets.
Followed to its logical consclusion (pun intended), shall we throw out every single instruction except AND, OR, NOT, and XOR?
 
What about not using SET / RESET or OS instructions?

Again though, most PLC's have these instructions built in.

The XOR method could be quite useful also, especially if the HMI does not have the toggle or alternate function
 

Similar Topics

I am having this issue trying to figure out how to do this. I have a Hydraulic ram that travels when a machine is running. The ram extends to the...
Replies
31
Views
9,455
Hi everyone, I'm learning ladder logic and have built a flip flop circuit (see pic) from an online tutorial. Closing the switch A is meant to...
Replies
19
Views
6,886
I found and fixed issue. B3:3 was used in MOV.
Replies
11
Views
2,555
I am calculating power factor from samples of voltage and current. Calculation is done by multiplying voltage and current samples. What Im...
Replies
0
Views
1,632
Hi all, my first post here, I've been lurking for a while. I'm a beginner and I hit a wall on one of my first projects I'm working on. I know it...
Replies
6
Views
2,529
Back
Top Bottom