Convert Ladder to SFC and ST

asteroide

Member
Join Date
Jul 2010
Location
der
Posts
158
Hello Friends

I would like to represent the start/stop of a motor in the five programming languages (Ladder, FBD, IL, SFC, ST)

I have done in Ladder, FBD and IL.

Somebody could help me to do in SFC and ST?

Thanks in advance.
 
Last edited:
ST

Code:
Motor:=(Start [COLOR=Blue][B]or[/B][/COLOR] Motor) [COLOR=Blue][B]and[/B][/COLOR] [COLOR=Blue][B]not[/B][/COLOR] Stop;
 
Last edited:
Another way to do it in ST would be like this:

Code:
[COLOR=Blue][B]if[/B][/COLOR] Stop [COLOR=Blue][B]then[/B][/COLOR]
   Motor:=[COLOR=DarkOrchid]false[/COLOR];
[COLOR=Blue][B]else[/B][/COLOR]
   [COLOR=Blue][B]if[/B][/COLOR] Start [COLOR=Blue][B]then[/B][/COLOR]
      Motor:=[COLOR=DarkOrchid]true[/COLOR];
   [COLOR=Blue][B]end_if[/B][/COLOR];
[COLOR=Blue][B]end_if[/B][/COLOR];
It's has same function. This is usually how beginners tend to program (in contrast to the post above).
But they would likely check for Start first:
Code:
[COLOR=Blue][B]if[/B][/COLOR] Start [COLOR=Blue][B]then[/B][/COLOR]
   Motor:=[COLOR=DarkOrchid]true[/COLOR];
[COLOR=Blue][B]end_if;

[/B][/COLOR][COLOR=Blue][B]if[/B][/COLOR] Stop [COLOR=Blue][B]then[/B][/COLOR]
   Motor:=[COLOR=DarkOrchid]false[/COLOR];
[COLOR=Blue][B]end_if[/B][/COLOR];
It's easy to read but would slightly mess up things if Start and Stop are active at the same time. So it doesn't work exactly like the ladder example.

A slightly more elegant variation of the first example in this post could be like this:
Code:
[COLOR=Blue][B]if[/B][/COLOR] Stop [COLOR=Blue][B]then[/B][/COLOR] 
   Motor:=[COLOR=DarkOrchid]false[/COLOR]; 
[COLOR=Blue][B]elsif[/B][/COLOR] Start [COLOR=Blue][B]then[/B][/COLOR]
   Motor:=[COLOR=DarkOrchid]true[/COLOR]; 
[COLOR=Blue][B]end_if[/B][/COLOR];
.
 
Last edited:
I agree with Ivo. The industry standard is that the stop button is a physical N.C. contact. So it should be an N.O. in the program.

It also helps when the symbols include the information, not just "start" and "stop", but "start_PB_NO" and "stop_PB_NC".

also, in the screenshot, the parallel contact that latch the motor, points to a different address O:0.1, instead of O:0.0.
 
I agree with Ivo. The industry standard is that the stop button is a physical N.C. contact. So it should be an N.O. in the program.

It also helps when the symbols include the information, not just "start" and "stop", but "start_PB_NO" and "stop_PB_NC".

also, in the screenshot, the parallel contact that latch the motor, points to a different address O:0.1, instead of O:0.0.

I don't agree with that at all. NC for stop button was the standard 30 or more years ago when we used relays and not PLCs.

For a PLC I think it makes more sense to use positive logic whenever possible, meaning logical 1 is 24V and the state when the input/output is activated. That makes all push buttons normally open, NO.

Exceptions to that would be emergency stops and other safety circuits.

In real life I seldom use two buttons for start and stop and a self-latching circuit. Most systems I work with already have a HMI or several and are also often controlled from DCS/SCADA systems. That means a start command can be issued from many places. My preference is for an illuminated push button which I program like a toggle. Then it's easy to see if something is running (it's illuminated) and it can be easily controlled from anywhere and it doesn't take up much space.

.
 
And if the real world physical wire falls off the pushbutton or you have a wire break what happens in your logic if the button is wired normally open?

Steve
 
Interesting discussion.

I've usually heard the argument of: "what if the wires to the stop button are broken?".

With a NO contact as a stop you then can't stop the motor unless you also have an emergency stop. I'm pretty sure I've seen a few Siemens tutorials where they use NO buttons as stop though.
 
I do not condone the use of SFC for this purpose but for educational purposes here is my stab at doing the start/stop in SFC (With a Normally Closed Stop Button).

To the right of the step boxes is the ST command in the step box.

sfc_tEST.PNG
 

Similar Topics

I'm not a ladder or AB guy and the people asking me are using both, so this has me stumped. Long story short, they have several arrays of...
Replies
11
Views
5,334
Hello: I am working on TwinCAT3. How to write this code in Structured Text. I am able to execute it on Ladder Diagram. Please have a look at this...
Replies
2
Views
3,111
Please I want software to convert grafcet to ladder:shock::confused::confused:
Replies
3
Views
4,545
Hey hi, I have written a logic in ladder in Siemens s7 300 plc and then converted it into STL . Now I m trying to convert it into ladder again...
Replies
1
Views
2,938
hello i want to convert SFC program into ladder. plz can any one covert the programming given below to ladder logic. 0 LD M8002 1 MOV H0C96...
Replies
9
Views
4,428
Back
Top Bottom