SFC subroutines in RSLogix 5000 (V17)

lcoyne11

Member
Join Date
Oct 2002
Posts
4
Hi All,

I'm hoping someone may be able to shed some light on the following questions concerning executing subroutines written as SFC's in RSLogix 5000 (V17).

These questions refer to situations where an SFC subroutine is executed in a calling SFC step as a Non-Stored action and no parameters are passed. (The subroutine is NOT being executed as an SFC transistion condtion.)

1.)How is control usually returned to the calling SFC Step from the subroutine?

2.) When the subroutine is executed a second time does it commence with the initial step or at some other step based on the previous execution of the subroutine.

Many Thanks.
 
I think you are confusing Ladder Logic with computer software programming. These are two totally different animals.

In computer programming you can call a certain loop or function, then return to where you started. Not so in Ladder Logic.

Ladder Logic starts at the top and works it's way down. If you call a sub-routine, it goes to that sub-routine, runs all the rungs top-to-bottom, then returns to the main, where it countinues to the next rung.

This is where the rule "Last rung wins!" comes from. You always put the most important rungs at the bottom of the ladder. This way there is less chance of them being over-written by other logic.

The basic concept as I understand it is: scan all rungs top-to-bottom THEN update outputs THEN read inputs THEN start all over.
 
" You always put the most important rungs at the bottom of the ladder. This way there is less chance of them being over-written by other logic."

Thats funny. All the rungs should be important, write the logic so nothing is being overwritten. You explained how ladder logic is scanned correctly, but I think that was bad advice.
 
Great concept. Now let's all return to reality where "s**t happens!".

I have yet to ever write a large program that worked flawlessly the first time.

If you have, you must be better then me.

I believe that "last rung wins" is an extremly important concept to understand in PLC programming.
 
Hi lcoyne11,

An SFC subroutine works just like any other subroutine. The state you left it in when you left is the state the SFC will be in when you next call it (provided you didn't use any external forcing instructions, etc...)

Good Luck,

(8{)} :) .)
(Yosi)
 
Clarification

The basic concept as I understand it is: scan all rungs top-to-bottom THEN update outputs THEN read inputs THEN start all over.
This is true for SLC and PLC5, not Control Logix family. Control Logix I/O is updated asynchronous to PLC scan. An input can change state at anytime during the scan. This is also true for outputs. There are different ways of handling this, it's important that you are aware of it.
 
TheStarr said:
The basic concept as I understand it is: scan all rungs top-to-bottom THEN update outputs THEN read inputs THEN start all over.
but:
gmferg said:
This is true for SLC and PLC5, not Control Logix family. Control Logix I/O is updated asynchronous to PLC scan. An input can change state at anytime during the scan. This is also true for outputs. There are different ways of handling this, it's important that you are aware of it.

For Control Logix i copy all inputs to MY input image.
Then all Routines are running true. Finally i copy MY
internal output image to the real outputs. Finally I have the
same stile like SLC and PLC (or like the SIEMENS S7-300 OB1 cycle).

Frank
 
Great concept. Now let's all return to reality where "s**t happens!".

I have yet to ever write a large program that worked flawlessly the first time.

If you have, you must be better then me.

I believe that "last rung wins" is an extremly important concept to understand in PLC programming.

No, it is a pure and simple example of erroneous thinking, unless you are referring to only latching type instructions. If not, then you should consider only writing the last few rungs, and ignoring the rest of the program.

Compensating for earlier logic mistakes by simply writing new "Overriding" logic at the end of a program is a serious flaw, and more and more will be guaranteed to cause you untold grief in this day and age of asynchronous I/O.

It has nothing to do with writing programs "Perfectly" the first time, rather with debugging them properly.

The reality you describe is one which often causes me to completely erase a program in a piece of equipment (with the start-up guy watching), dismiss the start-up guy, and writing a new and proper program on site.

And yes, I have spent a long time writing extremely large programs.
 
Oh, and to actually answer the original poster, SFC is (as mentioned above) state-maintained between calls to SFC routines, unless you specifically reset the SFC or manually initialize it. It will happily wait for hours (and tens of thousands of scans) for a particular condition to be met before moving on to the next step.

As an aside: SFC is NOT ladder logic.
 

Similar Topics

Hi, I am programming using mainly SFC's and structured text in RSLogix5000 I am making subroutines for my main SFC's, and many of my SFC's have...
Replies
2
Views
1,853
Hey. If you haven't already read me, first time I'm building a full project on Rockwell PLC. I started building the sequences last week and I...
Replies
3
Views
129
Hi all. I'm building my first Grafcet using Logix, but I started from another project. From what we usually do with other PLC's, I was expecting...
Replies
3
Views
156
I have a fanuc servo motor and drive that I salvaged from a lathe barfeeder that was headed for the dumps which I'm trying to see if I can get...
Replies
2
Views
154
Hiya, I'm a student who's very new to programming on Studio5000 (Logix Designer - Rockwell Software) and maybe getting some insight or help on a...
Replies
0
Views
90
Back
Top Bottom