Single button Start Stop latching logic

mindshaper said:
Politly this must be the world's shortest 1 button on-off lad. code!

This is the smartest code i ever done, i used in seweral applications and newer failed or timeouted...

But it uses 17bits instead of I/O's..

Savaş; (Thx. M. Emin Dinc)



The solution is really the same as mine and bernie carltons in operation, we did our exclusive or just with the bits required. You are changing/effecting the state of 16 real world outputs!!!

Is that really smart?
 
not true....

mentioned solutions are the same while plc is running, but you will see the difference after PLC is powered down.

versions using XOR or latch/unlatch INSTRUCTIONS maintain state while XOR equivalent using CODE (and have coil as output) can't do that.

also nobody says you can't use same XOR instruction and each of 16-bits in the output word - all toggled independantly 16 different buttons. the only penalty is one bit for ONS/OSR.
try that on 32-bit register and compare with memory use and code length of your example.

just wire 16 buttons and try following code

[NEQ I:1 0]----[osr B3:0/0]-------[XOR I:1 O:2 O:2]



while you have all those buttons wired, add following rung and see what it does. Make sure to power up plc few times...

---|S:1/15|----|O:2/0]-----[CLR O:2]



or try replacing [CLR O:2] with [AND O:2 255]
 
Last edited:
I use this with great success.

onebutton.JPG
 
If some do not know I have a site that offers things like this, look at my signature.

THAT said, I can not think of any industrial application where I would use a single push button to perfom two (2) or more functions, too easy to use a position switch etc.

Just cause you can does not mean you should..
 
The method im using is this :

U #in
FP #apu_1
= #apu_2
UN #apu_2
SPB yl1
U #out
SPB yl1b
SET
S #out
SPA yl1
yl1b: SET
R #out
yl1: NOP 0
BEA
 
rsdoran said:
If some do not know I have a site that offers things like this, look at my signature.

THAT said, I can not think of any industrial application where I would use a single push button to perfom two (2) or more functions, too easy to use a position switch etc.

Just cause you can does not mean you should..

Normally I have seen this used on a graphics system, where the buttom maybe green and labelled start, on pressing it it starts the process and changes to red and labelled stop, the next press stops the process, etc.

Never seen it used with hardware buttons to be honest.
 
I will not deny people may do it, BUT I never will, damn what anyone says.

The first time I encountered a STOP PB wired NO to a plc it freaked me out.

I do not care what plc or programming language is used, if I do not know it I will learn it, but never one (physical) PB to do multi functions.
 
i use toggle logic all the time (but not as start/stop logic).
this is very convenient way to change machine settings or edit recipes (buttons are not hardwired, they are on the HMI...)
 
Omg

Peter Nachtwey said:
LOL. Ron, the looks like a comment I would make.

I like the copyright on Mindshaper's example too. Cool. ;)

I am becoming an engineer.....LOL

Using an HMI I have used multistate pushbuttons BUT I was refering to hard wired pushbuttons in my rant.

Technically may work ok BUT think it may be confusing to the "BUBBAS"; which I am proud to be one of.
 
rsdoran said:
...I can not think of any industrial application where I would use a single push button to perfom two (2) or more functions, too easy to use a position switch etc..

That's what I thought until...

One day I made my order, all my parts came in, the next day I started to build my panel, several hours later... tada! done

hit the start button, great it works (without letting out the magical smoke) then I turned the toggle switch to make it run in reverse...Damn it, I bought a momentary spring return toggle sw, not the maintained...

So using the same concept, I made something close to Peter's and Bernie's example, worked great.

I did not have to wait for the new switch or spend time changing it out...

now on the other hand, that was not my best code I have ever wrote, not even in the top 1000, but then again its still running and I have not had to work on it :D 4yrs later
 
PeterW said:
The solution is really the same as mine and bernie carltons in operation, we did our exclusive or just with the bits required. You are changing/effecting the state of 16 real world outputs!!!

Is that really smart?

It only changes the state of 0:2/0, not the entire table!
Just download it and try, or "think"...
 
mindshaper said:
It only changes the state of 0:2/0, not the entire table!
Just download it and try, or "think"...

think???? ?????

OK, lets get it into perspective, its only a sample of a method to toggle a single bit.

I don't think its a smart example for an output though. To be honest, my example I would not use for an output, except maybe if it was a lamp, certainly not if it actually drove anything.

What I really don't like about your example, apart from wasting 15 bits, is the fact that 15 outputs can be effected by logic that has nothing to do with it. So what if the XOR logic means that 'providing' those N bits remain off, they would not effect the outputs. BUT... what if something or someone inadvertently effects those 15 bits. What output would switch? what would it do??? There is no protection.

Sorry the idea is OK, but its wasteful and if used for outputs, possibly dangerous.
 

Similar Topics

Hello everyone, been awhile since I've posted..... As the title suggests, using Crimson 3.1 software (Red Lion) I cant seem to figure out if its...
Replies
4
Views
1,713
Hi, So I have one push button(non-latch momentary) and would like use it to trigger two function sequences with the short press for primary...
Replies
3
Views
2,005
I've used the simple momentary switch toggle logic for a few decades now. Now I need to find logic that allows the toggling to latch/unlatch a...
Replies
26
Views
9,865
I'm a beginner in PLC education, struck with a problem. Anyone can please help. The problem is: I have a single push button. When I press &...
Replies
30
Views
15,207
Hello, I have a SLC5/05 and am having problems writing code for a pushbutton (momentary) to start and stop a process. The problem is this... Due...
Replies
20
Views
16,010
Back
Top Bottom