plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

Get the book!

If you're really looking to learn about PLCs, you NEED our book...

"Your Personal PLC Tutor - A Guide to Understanding PLCs"

Easy to read and uses 'plain' language!
Get $$FREE$$ priority mail shipping too!!!
You WILL be glad you did!!

Click Here now to order

Reply
 
Thread Tools Display Modes
Old April 21st, 2006, 06:04 PM   #1
Terry Woods
Member
United States

Terry Woods is offline
 
Join Date: Apr 2002
Posts: 3,170
FLIP-FLOP or FLIPFLOP or FLIP FLOP or TOGGLE or ONE BUTTON or ONE-BUTTON

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

This will work in ANY PLC. It is the "generic" solution for any PLC. It's only four Rungs in length and is totally transparent, to ANY PLC user, even Bubba! (OSR's can be confusing to some.)

The Flipping (Toggling) action takes place in only one scan.

This Rung watches for the PB to be pressed. When the PB transitions from NOT Pressed (OFF) to Pressed (ON), "FLIP-BIT" goes ON to flip the "TARGET BIT". "FLIP BIT" goes ON for no more time than it takes to scan the next two Rungs. And possibly, for as little time as it takes to scan the next one Rung.

SET-ting "WAS PB" prevents "FLIP BIT" from being re-activated, in subsequent scans, while the PB is still being pressed.


WAS
PB PB
---| |-------|/|---+---( ) FLIP-BIT
|
+---(SET) WAS PB



If the PB is just-now pressed, and the "TARGET BIT" is ON, then "TARGET BIT" is RESET (Turned OFF). Then, the driving signal, "FLIP BIT", is RESET (Turned OFF). If "FLIP BIT" is turned OFF in this Rung, then the next Rung is prevented from operating on the "TARGET BIT".


FLIP TARGET
BIT BIT
---| |-------| |---+---(RST) TARGET BIT
|
+---(RST) FLIP-BIT



If the PB is just-now pressed, and "FLIP BIT" is still ON (not RESET in the previous Rung), and "TARGET BIT" is OFF, then "TARGET BIT" is SET (Turned ON). Then, the driving signal, "FLIP BIT", is RESET (Turned OFF). Since "WAS PB" was SET (Turned ON), Rung-1 is prevented from being activated.


FLIP TARGET
BIT BIT
---| |-------|/|---+---(SET) FLIP-BIT
|
+---(RST) FLIP-BIT



When the signal from PB finally goes OFF, after having been ON ("WAS PB" is ON), then run that pair of conditions through a short-termed Timer (1-second). After timeout, RESET (Turn OFF) "WAS PB". That produces a "debouncing" effect. When "WAS PB" goes OFF, the first Rung is allowed to "watch" for the next pressing of PB.


WAS
PB PB +---------+
---|/|-------| |----+ TIMER +---(RST) WAS PB
| 1-Sec |
+---------+



.
  Reply With Quote
Old April 21st, 2006, 08:40 PM   #2
Rube
Member
United States

Rube is offline
 
Rube's Avatar
 
Join Date: Sep 2003
Location: Fort Worth, Texas
Posts: 725
Quote:
"even Bubba!"
Hey, I resemble that remark!

I guess Terry has settled the background noise for a month!?
__________________
Mark A. Crowley

Automation is not a corrective action for a lack of discipline.
  Reply With Quote
Old April 22nd, 2006, 12:48 AM   #3
rsdoran
Member
United States

rsdoran is offline
 
rsdoran's Avatar
 
Join Date: Apr 2002
Location: Birmingham, AL
Posts: 7,373
4 rungs for a flip flop?

Personally I disagree with the use of the term flip flop.

In many cases the descripton of one input used to alternatte an output is called a JK flip flop...that is just wrong.

One rung with many branches is not innovative..especially when talking about an S7-200...it has a "toggle" instruction.

I posted examples of "toggle" or flip flop with Terry's flowchart to help.

Flip flop's are electronic devices used for a specific purpose, a PLC can simulate it BUT it is not one...it can do more.
__________________
http://www.patchn.com Industrial Electrical & Maintenance @ www.patchn.com "Tell me and I forget, show me and I remember, involve me and I understand."

Last edited by rsdoran; April 22nd, 2006 at 12:58 AM.
  Reply With Quote
Old April 22nd, 2006, 08:23 AM   #4
TSmith
Member
United States

TSmith is offline
 
Join Date: Apr 2006
Location: East Texas
Posts: 42


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
  Reply With Quote
Old April 22nd, 2006, 09:09 AM   #5
geniusintraining
Member
United States

geniusintraining is offline
 
geniusintraining's Avatar
 
Join Date: Jun 2005
Location: SC
Posts: 2,834
Our you can do it like this,





You can call it...JK-Flip-Flop, RS-Flip-Flop, JFK-Flip-Flop
What ever you want, as long as your output is true when you want it to be.

PS. Tsmith... my neck hurts





edit: I cant seem to get the pic to insert??, but here is a PDF
Edit: Got it...you must read, hmmm
Attached Files
File Type: pdf flip.pdf (40.9 KB, 176 views)
__________________
www.PLCTrainer.net

PLC Trainers, Communication Cables and Automation Supplies, ((NEW)) Siemens S7 1200 trainers

Last edited by geniusintraining; April 22nd, 2006 at 10:01 AM.
  Reply With Quote
Old April 22nd, 2006, 11:00 AM   #6
Terry Woods
Member
United States

Terry Woods is offline
 
Join Date: Apr 2002
Posts: 3,170
"I guess Terry has settled the background noise for a month!?"

Apparently not.

Yes Ron, there are indeed four rungs.

Ron... A rose by any other name is still a rose.
I just used what seemed to be the most common names for the sake of searching.

The point of my post was to present a "flip-flop-toggle-whatever-thingee" that would work in ANY PLC. The only element that might be considered exotic is the timer. However, even Smart Blocks (Smart Relays) have timers.

I've always been bothered by brand-specific solutions. A solution created for a particular brand of PLC might be so unique that it can't be applied to other PLCs. This code will apply to any PLC. Any programmer can read it and understand it. The concept is apparent. Having understood the concept... any programmer can then use those unique tools in his particular tool-box to realize the concept in any manner he wishes... or, with only one caveat, he can use the code exactly as I have presented it. The caveat is in regards to the timer. It appears that most PLCs handle timers differently. So, apply the timer in the manner required for your particular PLC.

"One rung with many branches is not innovative..especially when talking about an S7-200...it has a "toggle" instruction."

One rung?
I thought we just agreed that it was four rungs.

S7-200?
I thought I made it clear that this code is for use in ANY PLC.

So Ron... what's your point?

(From "Never-Never-Land"... where believing in yourself can produce some pretty amazing results!)
  Reply With Quote
Old April 22nd, 2006, 01:02 PM   #7
Jim Dungar
Member
United States

Jim Dungar is offline
 
Join Date: Apr 2002
Location: WI
Posts: 1,132
Terry,

Look at your third rung. The logic does do not match with the description.

Shouldn't it be |---+---(SET) TARGET-BIT ?
  Reply With Quote
Old April 22nd, 2006, 03:28 PM   #8
Terry Woods
Member
United States

Terry Woods is offline
 
Join Date: Apr 2002
Posts: 3,170
The best laid plans of mice and men...

Damn it Jim! You are so right.

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


This will work in ANY PLC. It is the "generic" solution for any PLC. It's only four Rungs in length and is totally transparent, to ANY PLC user, even Bubba! (OSR's can be confusing to some.)

The Flipping (Toggling) action takes place in only one scan.

This Rung watches for the PB to be pressed. When the PB transitions from NOT Pressed (OFF) to Pressed (ON), "FLIP-BIT" goes ON to flip the "TARGET BIT". "FLIP BIT" goes ON for no more time than it takes to scan the next two Rungs. And possibly, for as little time as it takes to scan the next one Rung.

SET-ting "WAS PB" prevents "FLIP BIT" from being re-activated, in subsequent scans, while the PB is still being pressed.


WAS
PB PB
---| |-------|/|---+---( ) FLIP-BIT
|
+---(SET) WAS PB




If the PB is just-now pressed, and the "TARGET BIT" is ON, then "TARGET BIT" is RESET (Turned OFF). Then, the driving signal, "FLIP BIT", is RESET (Turned OFF). If "FLIP BIT" is turned OFF in this Rung, then the next Rung is prevented from operating on the "TARGET BIT".


FLIP TARGET
BIT BIT
---| |-------| |---+---(RST) TARGET BIT
|
+---(RST) FLIP-BIT




If the PB is just-now pressed, and "FLIP BIT" is still ON (not RESET in the previous Rung), and "TARGET BIT" is OFF, then "TARGET BIT" is SET (Turned ON). Then, the driving signal, "FLIP BIT", is RESET (Turned OFF). Since "WAS PB" was SET (Turned ON), Rung-1 is prevented from being activated.


FLIP TARGET
BIT BIT
---| |-------|/|---+---(SET) TARGET BIT
|
+---(RST) FLIP-BIT




When the signal from PB finally goes OFF, after having been ON ("WAS PB" is ON), then run that pair of conditions through a short-termed Timer (1-Second). After timeout, RESET (Turn OFF) "WAS PB". That produces a "debouncing" effect. When "WAS PB" goes OFF, the first Rung is allowed to "watch" for the next pressing of PB.


WAS
PB PB +---------+
---|/|-------| |----+ TIMER +---(RST) WAS PB
| 1-Sec |
+---------+


Last edited by Terry Woods; April 22nd, 2006 at 03:31 PM.
  Reply With Quote
Old April 22nd, 2006, 04:39 PM   #9
Jim Dungar
Member
United States

Jim Dungar is offline
 
Join Date: Apr 2002
Location: WI
Posts: 1,132
I Like my MGD room temp and served in a frozen mug.
  Reply With Quote
Old April 22nd, 2006, 05:41 PM   #10
Terry Woods
Member
United States

Terry Woods is offline
 
Join Date: Apr 2002
Posts: 3,170
Jim,

Do you try to develop a large head? Or do you pour it down the side?

I go for no head!
  Reply With Quote
Old April 22nd, 2006, 06:47 PM   #11
Archie
Member
United States

Archie is offline
 
Archie's Avatar
 
Join Date: May 2002
Location: Orangeburg, SC
Posts: 496
An even more universal solution. No Set/Resets. No Latch/Unlatch. No Counters. No Timers. No Time delay to deal with.

 
PB Target R1
--] [-+-]/[--+--------------------( )-
| |
R1 | PB |
--] [-+-]/[--+


PB R1 Target
--]/[-+-] [--+--------------------( )-
| |
Target| PB |
--] [-+-] [--+


1) Target and R1 starts out both off
2) PB is pressed and held. Only R1 is on
3) PB is released. Both R1 and Target are on
4) PB is pressed and held. R1 drops out
5) Button is released. Both R1 and Target are off as in step 1

Last edited by Archie; April 22nd, 2006 at 06:49 PM. Reason: Ladder was showing wrong
  Reply With Quote
Old April 22nd, 2006, 06:57 PM   #12
Gerry
Member
New Zealand

Gerry is offline
 
Join Date: Jun 2002
Location: Auckland
Posts: 1,130
How about this for generic.
Some very basic / stone-age PLC's don't support multiple outputs on a rung. And even those have input filtering, so a debounce is redundant (unless the operator has Parkinson's).
Still 4 rungs though

PB aux OS
----] [-------]/[-----------------( )--

PB aux
----] [---------------------------( )--

OS TOGGLE TOGGLE
----] [-------]/[-----------------(L)--

OS TOGGLE TOGGLE
----] [-------] [-----------------(U)--



Slightly less generic using output branching:
Down to 2 rungs. (This one's better if I/O is asynchronous)

PB aux OS
----] [---+---]/[-----------------( )--
|
| aux
+-----------------------( )--

OS TOGGLE TOGGLE
----] [---+---]/[-----------------(L)--
|
| TOGGLE TOGGLE
+---] [-----------------(U)--


Last edited by Gerry; April 22nd, 2006 at 06:59 PM. Reason: Archie types faster (no change)
  Reply With Quote
Old April 22nd, 2006, 09:19 PM   #13
TSmith
Member
United States

TSmith is offline
 
Join Date: Apr 2006
Location: East Texas
Posts: 42
I agree with the concept of less rungs is better. I do not have the experience of the major posters here, but I learned early on, you can get so fancy that it does't work.
  Reply With Quote
Old April 23rd, 2006, 08:15 AM   #14
Jim Dungar
Member
United States

Jim Dungar is offline
 
Join Date: Apr 2002
Location: WI
Posts: 1,132
Tsmith said "you can get so fancy that it does't work" - well put.

Terry, If the brewmaster had intended the beer to be flat, he wouldn't have put in the bubbles in the first place.
  Reply With Quote
Old April 23rd, 2006, 09:10 AM   #15
Terry Woods
Member
United States

Terry Woods is offline
 
Join Date: Apr 2002
Posts: 3,170
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.

Gerry,
Neither of yours will ever work in the vast majority of PLCs. If the light is ON you can turn it OFF.. however, the problem is that the light can never be turned ON!

Gerry said...
"Some very basic / stone-age PLC's don't support multiple outputs on a rung. And even those have input filtering, so a debounce is redundant (unless the operator has Parkinson's)."

Gerry, if you were hired to create a One-Button Toggle-Function that would work in ANY PLC, would your statement have any validity at all? Notice that the key-word is "ANY"... that would include all of those "...very basic / stone-age PLC's...". Even those that don't have built-in filtering!


Jim...
Since I paid for those bubbles... I prefer to keep them for myself rather than letting them bubble away into the atmosphere!

If ya can't get a good healthy buuuurrrrp.... out of them bubbles, then what the hell is the point of havin' 'em?

Last edited by Terry Woods; April 23rd, 2006 at 09:29 AM.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Flip Flop and Something to think about rta53 LIVE PLC Questions And Answers 13 April 24th, 2006 08:16 AM
Question for S7 Guy or another XOR flip flop expert! 504bloke LIVE PLC Questions And Answers 2 March 15th, 2006 07:26 AM
flip flop logic Unregistered LIVE PLC Questions And Answers 12 May 1st, 2005 08:59 PM
Flip flop or toggle: a rehash rsdoran LIVE PLC Questions And Answers 8 January 29th, 2003 02:58 PM


All times are GMT -5. The time now is 12:01 AM.


.