szfamman
Industrial
- Jul 12, 2011
- 1
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
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