Set/reset or toggle function

chippieboy

Member
Join Date
Sep 2019
Location
Silicon Valley
Posts
56
I am trying to achieve a set/reset or toggle function withthe same input. Example: Push a button once, the motor or pump starts, push the same button again, and the motor or pump stops. I know there are many, many ways to do this but I thought I would reach out to the forum to see what is popular. I cut my PLC teeth with Omron. Omron has a simple set/resetfunction built in.
 
There was a long thread about this a while ago, and there is a PDF or similar in the DOWNLOADS section (see link above; look for [ALTERNATOR METHODS.pdf], in the [Allen Bradley] section).
 
Last edited:
The key to almost all methods is the one-shot (pulse) logic that detects the edge of the button press to drive it, otherwise it will toggle on each and every scan as long as the button is held down.

Perhaps the one-shot pattern should be on the [Patterns of Ladder Logic Programming] page; it is at least as interesting as the seal-in, start/stop, state/fault, and other patterns.
 
Last edited:
One other thing to note is that the use of one button to perform multiple operations isn't recommended as the action is ambiguous. On and Off are seperate functions so should have separate controls.

So, you think to yourself "I'll use a toggle switch" but what then happens after an e-stop? You cannot allow the pump to restart as the result of an e-stop reset so you then need write come code so that the pump stitch has to be off before it is switched on again...

Just use two buttons.

Nick
 
You can used layered buttons who's visibility is controlled by the status of the command. One turns it on, another off. so your buttons are nonambigious but exist in the same spot. Set/Reset. Start is visible when the motor is Stopped. Stop is visible when the motor is Running. You can use color schemed icons rather than text buttons.
 
I agree on Start/Stop separation.

Code:
Run := (Run or OCmd_Start) & NOT OCmd_Stop; // easy logic.

Code:
Run := (Run or OCmd_Start) & NOT (OCmd_Stop OR Fault OR HiTemp OR Something); // easy logic with extra trip conditions.

I disagree with overlapping buttons on HMI: it needs to be clear to the operator how/where to stop a device prior to starting it.
 
One other thing to note is that the use of one button to perform multiple operations isn't recommended as the action is ambiguous. On and Off are seperate functions so should have separate controls.....Just use two buttons.


I have used a single button in the days before HMI's to control a bank of 15 pumps, Punching 15 30.5mm holes in a straight line was easier than 2 rows for 30 individual Start & Stop buttons, or 45 in 3 rows if a pilot light was used as the original spec called for. Only 15 illuminate PB's and toggle each pump and the indicator light with the PLC, and the customer liked it better too.


As far as HMI pushbuttons most of the time there is only one to toggle a condition, other than main start and stop rarely have I used 2 separate buttons,
 
Flip Flop

I use this. It's the same basic concept when using a Logix PLC so I would imagine something like this is doable in other brands of PLCs.

Bools or INTs can replace the I/O but if I remember correctly (it’s been a while since I’ve used one) each instruction has to have all of the data types used in it, match.

One of many ways to do it but when you can get things down to one input, one output and one line of code, you’re ahead of the game.

P.S. Courtesy of Ken R. many years ago.

flipflop.jpg
 
I think you mean

dummy := 1 - dummy;


We don't even know the environment (Mfr, Model, language).
-

I didn't mean structured text.
I haven't even tried it in codesys structured text yet to see if it works.
It was something some other programmer did in a Wonderware hmi script and I thought it was crafty.
 

Similar Topics

I have a graphic that has 2 buttons for Automatic and Manual, each with pushbutton animations associated with them to toggle a bit in the PLC, one...
Replies
8
Views
2,520
i am using logixpro I/O Simulation, i am currently using push buttons with TOF timers i would like to use TON timers instead so what i was want to...
Replies
9
Views
216
Hi need help why this “failure 5 emergency stop “ appears at every startup in the morning ? Have to shut off main switch at least 10 times on...
Replies
19
Views
304
I was loading a program onto an XE1e2 PLC and it got stuck on these two windows and won't progress. It won't let me connect from the PC to reload...
Replies
0
Views
74
Hi all, i have recieved some 4RF Aprisa SR+ ethernet radios from a customer to configure. Issue is that they are used and have non-default...
Replies
0
Views
81
Back
Top Bottom