Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Momentary switch on/off feature

Status
Not open for further replies.

szfamman

Industrial
Jul 12, 2011
1
0
0
HU
Hi everyone!

I've started to learn PLC programming (Simatic manager with plcsim). I red an interesting lesson on the internet: write a plc program which can toggle on and off an output (LED, motor, etc.) with and ON and OFF momentary push button. I could solve it with an SR flip-flop, but the next lesson is harder for me. It's the same with only 1 button.
So, at beginning i push the button (then release it) and the output turns on, till i push the button again, when the output turns off (and then if i push again, it will turn on, then push again, it will turn off, and so on).

I know how to program it in C language, here it is:
if ((in1==1) && (temp1 == 0)
{
temp1 = 1
outTemp = !outTemp
}
if (in1 == 0)
{
temp1 = 0
}
out1 = outTemp

The problem, that it's complex for me to program it in STL/FBD/LAD. Can someone help me with that? I know, I should make a latch circuit (with one or more flip-flops maybe), but I don't really know how :S

And my other question: is there and easier/better way to solve the first circuuit (i solved it with 1 SR-FF, and i think it's the best/fastest solution)

Thanks,
szfAmman
 
Replies continue below

Recommended for you

Don't even need to evaluate. Just let bit 0 be your output. It changes state each time the counter steps up.

Gunnar Englund
--------------------------------------
Half full - Half empty? I don't mind. It's what in it that counts.
 
A number of PLC's allow the internal coils to work in an inpulse mode, where the coil state toggles with each rising edge input to the coil.
 
Hi Guys,
I have the same problem as the original poster. I fully agree that the solution with the counter and 0 bit is smart. However, I was asked to solve it just with contacts and simple outputs. Could somebody post a solution of this task in Ladder please?
 
Status
Not open for further replies.
Back
Top