Sequential Function Chart - Logix 5000
Sequential Function Chart - Logix 5000
Activities including installation, adjustments, putting into service, use, assembly, disassembly, and maintenance are required to be carried out by suitably trained personnel in
accordance with applicable code of practice.
If this equipment is used in a manner not specified by the manufacturer, the protection provided by the equipment may be impaired.
In no event will Rockwell Automation, Inc. be responsible or liable for indirect or consequential damages resulting from the use or application of this equipment.
The examples and diagrams in this manual are included solely for illustrative purposes. Because of the many variables and requirements associated with any particular installation,
Rockwell Automation, Inc. cannot assume responsibility or liability for actual use based on the examples and diagrams.
No patent liability is assumed by Rockwell Automation, Inc. with respect to use of information, circuits, equipment, or software described in this manual.
Reproduction of the contents of this manual, in whole or in part, without written permission of Rockwell Automation, Inc., is prohibited.
Throughout this manual, when necessary, we use notes to make you aware of safety considerations.
WARNING: Identifies information about practices or circumstances that can cause an explosion in a hazardous environment, which may lead to personal injury or
death, property damage, or economic loss.
ATTENTION: Identifies information about practices or circumstances that can lead to personal injury or death, property damage, or economic loss. Attentions help
you identify a hazard, avoid a hazard, and recognize the consequence.
IMPORTANT: Identifies information that is critical for successful application and understanding of the product.
These labels may also be on or inside the equipment to provide specific precautions.
SHOCK HAZARD: Labels may be on or inside the equipment, for example, a drive or motor, to alert people that dangerous voltage may be present.
BURN HAZARD: Labels may be on or inside the equipment, for example, a drive or motor, to alert people that surfaces may reach dangerous temperatures.
ARC FLASH HAZARD: Labels may be on or inside the equipment, for example, a motor control center, to alert people to potential Arc Flash. Arc Flash will cause severe
injury or death. Wear proper Personal Protective Equipment (PPE). Follow ALL Regulatory requirements for safe work practices and for Personal Protective Equipment
(PPE).
Tip: Identifies information that is useful and can help to make a process easier to do or easier to understand.
Rockwell Automation recognizes that some of the terms that are currently used in our industry and in this publication are not in alignment with the movement toward inclusive
language in technology. We are proactively collaborating with industry peers to find alternatives to such terms and making changes to our products and content. Please excuse the
use of such terms in our content while we implement these changes.
Grammatical and editorial style changes are not included in this summary.
Global changes
None in this release.
Change Topic
Updated the diagrams that show options for execution control. Execution diagrams on page 48
Introduction...................................................................................................................................................................................................................................................................................................11
Step guidelines................................................................................................................................................................................................................................................................................. 16
SFC_STEP structure..........................................................................................................................................................................................................................................................................17
Sequence........................................................................................................................................................................................................................................................................................... 22
Selection branch.............................................................................................................................................................................................................................................................................. 23
Simultaneous branch...................................................................................................................................................................................................................................................................... 23
SFC_ACTION structure.....................................................................................................................................................................................................................................................................26
Transition tag...................................................................................................................................................................................................................................................................................30
SFC_STOP structure.........................................................................................................................................................................................................................................................................45
Nest an SFC.................................................................................................................................................................................................................................................................................................45
Pass parameters.............................................................................................................................................................................................................................................................................. 47
Execution diagrams................................................................................................................................................................................................................................................................................... 48
Introduction................................................................................................................................................................................................................................................................................................. 53
Drag elements.................................................................................................................................................................................................................................................................................. 54
Hide a wire.................................................................................................................................................................................................................................................................................................. 59
Configure a step.........................................................................................................................................................................................................................................................................................59
Program a transition..................................................................................................................................................................................................................................................................................61
Add an action..............................................................................................................................................................................................................................................................................................62
Configure an action................................................................................................................................................................................................................................................................................... 62
Program an action.....................................................................................................................................................................................................................................................................................64
Document an SFC.......................................................................................................................................................................................................................................................................................66
Language switching........................................................................................................................................................................................................................................................................ 66
Force steps............................................................................................................................................................................................................................................................... 71
Introduction.................................................................................................................................................................................................................................................................................................. 71
Precautions...................................................................................................................................................................................................................................................................................................71
Enable forces............................................................................................................................................................................................................................................................................................... 71
Force LED.......................................................................................................................................................................................................................................................................................... 72
GSV instruction.................................................................................................................................................................................................................................................................................73
Force a transition............................................................................................................................................................................................................................................................................ 74
For a complete list of common procedures manuals, refer to the Logix 5000 Controllers Common Procedures Programming Manual, publication 1756-PM001.
The term Logix 5000 controller refers to any controller based on the Logix 5000 operating system.
Rockwell Automation recognizes that some of the terms that are currently used in our industry and in this publication are not in alignment with the movement toward inclusive
language in technology. We are proactively collaborating with industry peers to find alternatives to such terms and making changes to our products and content. Please excuse the
use of such terms in our content while we implement these changes.
The Studio 5000 Automation Engineering & Design Environment® combines engineering and design elements into a common environment. The first element is the Studio 5000
Logix Designer® application. The Logix Designer application is the rebranding of RSLogix 5000® software and will continue to be the product to program Logix 5000™ controllers for
discrete, process, batch, motion, safety, and drive-based solutions.
The Studio 5000® environment is the foundation for the future of Rockwell Automation® engineering design tools and capabilities. The Studio 5000 environment is the one place for
design engineers to develop all elements of their control system.
Additional resources
These documents contain additional information concerning related Rockwell Automation products.
Resource Description
Industrial Automation Wiring and Grounding Guidelines, publication, 1770-4.1 Provides general guidelines for installing a Rockwell Automation industrial system.
Rockwell Automation product certifications Provides declarations of conformity, certificates, and other certification details.
Legal notices
Rockwell Automation publishes legal notices, such as privacy policies, license agreements, trademark disclosures, and other terms and conditions on the Legal Notices page of the
Rockwell Automation website.
The software included in this product contains copyrighted software that is licensed under one or more open source licenses. Copies of those licenses are included with the software.
Corresponding Source code for open source packages included in this product are located at their respective web site(s).
Alternately, obtain complete Corresponding Source code by contacting Rockwell Automation via the Contact form on the Rockwell Automation website:
http://www.rockwellautomation.com/global/about-us/contact/contact.page
A full list of all open source software used in this product and their corresponding licenses can be found in the OPENSOURCE folder. The default installed location of these licenses is:
Introduction
Use a force to override data that your logic either uses or produces.
Use forces only as a temporary measure. They are not intended to be a permanent part of your application.
A text box lets you add descriptive text or notes to your SFC.
2. For those functions that go in a periodic task, group the functions according to similar update rates. Create a
periodic task for each update rate.
For example, 2-state devices may require faster updates than PID loops. Use separate periodic tasks for
each.
In this example, a project uses two periodic tasks to regulate motors, valves, and temperature loops. An SFC
controls the process.
If Then
• The SFC is the only routine in the program Configure the SFC as the main routine for the program.
• The SFC calls all the other routines of the program
• The program requires other routines to execute 1. Configure another routine as the main routine for the
independent of the SFC program.
• The SFC uses Boolean actions 2. Use the main routine to call the SFC as a subroutine.
If the SFC uses Boolean actions, then other logic must run independent of the SFC and monitor status bits of the SFC.
A transition ends a step. The transition defines the physical conditions that must occur or change in order to go to
the next step.
Step guidelines
Follow these guidelines.
• Start with large steps and refine the steps in several passes.
• When you first open an SFC routine, it contains an initial step and transition. Use this step to initialize your
process.
• To identify a step, look for a physical change in your system, such as new part that is in position, a
temperature that is reached, a preset time that is reached, or a recipe selection that occurs. The step is the
actions that take place before that change.
• Stop refining the steps when they are in meaningful increments. This is an example.
SFC_STEP structure
Each step uses a tag to provide information about the step. Access this information with either the Step Properties
dialog box or the Monitor Tags tab of the Tags window.
Determine how long a T DINT When a step becomes active, the Timer (T) value
step has been active resets and then starts to count up in milliseconds.
(milliseconds) The Timer continues to count up until the step
goes inactive, regardless of the Preset (PRE)
value.
Set a flag when the step PRE DINT Enter the time in the Preset (PRE) member.
has been active for a When the Timer (T) reaches the Preset value, the
specific length of time Done (DN) bit turns on and stays on until the step
(milliseconds) becomes active again.
As an option, select Use Expression and click
Define to enter a numeric expression that
calculates the time at runtime.
Set a flag if a step did LimitLow DINT Enter the time in the Limit Low (LimitLow)
not execute long enough member (milliseconds).
• If the step goes inactive before the Timer (T)
reaches the LimitLow value, the AlarmLow bit
turns on.
• The AlarmLow bit stays on until you reset it.
• To use this alarm function, turn on (select)
the Alarm Enable (AlarmEn) bit.
As an option, enter a numeric expression that
calculates the time at runtime.
AlarmEn BOOL To use the alarm bits, turn on (select) the Alarm
Enable (AlarmEn) bit.
AlarmLow BOOL If the step goes inactive before the Timer (T)
reaches the Limit Low value, the AlarmLow bit
turns on. The bit stays on until you reset it.
To use this alarm function, turn on (select) the
Alarm Enable (AlarmEn) bit.
Set a flag if a step is LimitHigh DINT Enter the time in the Limit High member
executing too long (milliseconds).
• If the Timer (T) reaches the LimitHigh value,
the AlarmHigh bit turns on.
• The AlarmHigh bit stays on until you reset it.
• To use this alarm function, turn on (select)
the Alarm Enable (AlarmEn) bit.
As an option, enter a numeric expression that
calculates the time at runtime.
AlarmEn BOOL To use the alarm bits, turn on (select) the Alarm
Enable (AlarmEn) bit.
AlarmHigh BOOL If the Timer (T) reaches the Limit High value, the
AlarmHigh bit turns on. The bit stays on until you
reset it.
To use this alarm function, turn on (select) the
Alarm Enable (AlarmEn) bit.
Do something while the X BOOL The X bit is on the entire time the step is active
step is active (including (executing).
first and last scan) Typically, we recommend that you use an action
with a N Non-Stored qualifier to accomplish this.
1
Do something one time FS BOOL The FS bit is on during the first scan of the step.
when the step becomes Typically, we recommend that you use an
active action with a P1 Pulse (Rising Edge) qualifier to
accomplish this.
Do something while the SA BOOL The SA bit is on when the step is active except
step is active, except on during the first and last scan of the step.
the first and last scan
1
Do something one time LS BOOL The LS bit is on during the last scan of the step.
on the last scan of the Use this bit only if on the Controller Properties
step dialog box, SFC Execution tab, you set the
Last Scan of Active Step to Don’t Scan or
Programmatic reset.
Determine the target Reset BOOL An SFC Reset (SFR) instruction resets the SFC to a
of an SFC Reset (SFR) step or stop that the instruction specifies.
instruction The Reset bit indicates the step or stop where the
SFC goes to begin executing again.
Once the SFC executes, the Reset bit clears.
Determine the TMax DINT Use this for diagnostic purposes. The controller
maximum time that a clears this value only when you set the Restart
step has been active Position to Restart at initial step and the
during any of its controller changes modes or experiences a power
executions cycle.
Determine how many Count DINT This is not a count of scans of the step.
times a step has • The count increments each time the step
become active becomes active.
• It increments again only after the step goes
inactive and then active again.
• The count resets only if you configure the
SFC to restart at the initial step. With that
configuration, it resets when the controller
changes from program mode to run mode.
Use one tag for the Status DINT For this member Use this bit
various status bits of Reset 22
this step
AlarmHigh 23
AlarmLow 24
AlarmEn 25
OV 26
DN 27
LS 28
SA 29
FS 30
X 31
This diagram shows the relationship of the X, FS, SA, and LS bits.
Execute 1 or more steps in sequence Sequence on page 22 The SFC checks the transition at the end
• One executes repeatedly of the step.
• Then the next executes repeatedly • If TRUE the SFC goes to the next
step.
• If FALSE, the SFC repeats the step.
• Choose between alternative steps or Selection branch on page 23 • It is OK for a path to have no steps
groups of steps depending on logic and only a transition. This lets the
conditions SFC skip the selection branch.
• Execute a step or steps or skip the • By default, the SFC checks from left
step or steps depending on logic to right the transitions that start
conditions each path. It takes the first TRUE
path.
1. The FS and LS bits are only active during a step’s execution. Once a step finishes executing the code within its actions, the FS
or the LS or both bits are reset. If you reference either of these bits in code outside of the SFC routine in a different part of the
project, the bits are always cleared (0).
Execute 2 or more steps at the same Simultaneous branch on page 23 • A single transition ends the branch.
time. All paths must finish before • The SFC checks the ending
continuing the SFC transition after the last step in each
path has executed at least once.
If the transition is FALSE, the SFC
repeats the previous step.
Loop back to a previous step Wire to a previous step on page 24 • Connect the wire to the step or
simultaneous branch to which you
want to go.
• Do not wire into, out of, or between a
simultaneous branch.
Depending on the build code, a station either drills or polishes. Selection Branch
At station 12, the machine drills, taps, and bolts a part. The steps Sequence
occur one after the other.
Sequence
A sequence is a group of steps that execute one after the other.
Selection branch
A selection branch represents a choice between one path (step or group of steps) or another path (an OR structure).
Simultaneous branch
A simultaneous branch represents paths (steps or group of steps) that occur at the same time (an AND structure).
• Only set a bit and program other logic to monitor the bit to Use a Boolean action
determine when to execute.
With non-Boolean actions, you also have the option to postscan (automatically reset) the assignments and
instructions before leaving a step.
• During postscan the controller executes the assignments and instructions as if all conditions are FALSE.
• The controller postscans both embedded structured text and any subroutine that the action calls.
To automatically reset assignments and instructions, see Turn off a device at the end of a step.
You cannot reuse a non-Boolean action within the same SFC except to reset a stored action. Only one instance of a
specific non-Boolean action is permitted per SFC.
With Boolean actions, you have to manually reset the assignments and instructions that are associated with the
action. Since there is no link between the action and the logic that performs the action, the automatic reset option
does not affect Boolean actions.
Example
When the S_Complete_the_Batch step is active, the S_Open_Outlet action executes. When the action is active, its Q bit turns on.
A ladder Logic routine monitors the Q bit (S_Open_Outlet.Q). When the Q bit is on, the JSR instruction executes and opens the outlet
valve.
You can reuse a Boolean action multiple times within the same SFC.
SFC_ACTION structure
Each action (non-Boolean and Boolean) uses a tag to provide information about the action. Access this information
via either the Action Properties dialog box or the Monitor Tags tab of the Tags window.
Determine when the Q BOOL The status of the Q bit depends on whether the
action is active action is a Boolean action or non-Boolean action.
Determine how long an T DINT When an action becomes active, the Timer
action has been active (T) value resets and then starts to count up in
(milliseconds) milliseconds. The timer continues to count up until
the action goes inactive, regardless of the Preset
(PRE) value.
Use one of these PRE DINT Enter the time limit or delay in the Preset (PRE)
time-based qualifiers: L, member. The action starts or stops when the
SL, D, DS, SD Timer (T) reaches the Preset value.
As an option, enter a numeric expression that
calculates the time at runtime.
Determine how many Count DINT This is not a count of scans of the action.
times an action has • The count increments each time the action
become active becomes active.
• It increments again only after the action goes
inactive and then active again.
• The count resets only if you configure the
SFC to restart at the initial step. With that
configuration, it resets when the controller
changes from program mode to run mode.
Use one tag for the Status DINT For this member Use this bit
various status bits of Q 30
this action
A 31
To convert the pseudocode to structured text comments, add these comment symbols.
That spans more than one line (*start of comment . . . end of comment*)
/*start of comment . . . end of comment*/
The default qualifier is N Non-Stored. The action starts when the step is activated and stops when the step is
deactivated.
If you want the action to And Then assign this qualifier Which means
Start a specific time after the Stop when the step is D Time Delayed
step is activated and the step deactivated
is still active Stay active until a Reset action DS Delayed and Stored
turns off this action
Start a specific time after the Stay active until a Reset action SD Stored and Time Delayed
step is activated, even if the turns off this action
step is deactivated before this
time
Execute once when the step is Execute once when the step is P Pulse
activated deactivated
Start when the step is Execute only once P0 Pulse (Falling Edge)
deactivated
If you want the action to And Then assign this qualifier Which means
Example
You want to complete these steps.
1. Turn on 2 compressors. When a compressor is on, the Device1State bit is on.
2. When both compressors are on, go to the next step.
Example
You want to complete these steps.
1. Package the product. When the product is in the package, the package_done bit turns on.
2. Pack the product either 8 per carton or 16 per carton.
Transition tag
Each transition uses a BOOL tag to represent the TRUE or FALSE state of the transition.
- or -
Call a subroutine.
• Signal when the step has run for the required time and the SFC should go to the next step.
• Signal when the step has run too long and the SFC should go to an error step.
The following shows the action of a timer and associated bits of a step.
Description
The following shows the action of the low and high alarms for a step.
Description
AlarmEn is on. To use the low and high alarms turn this bit on.
Turn the bit on via the properties dialog box or the tag for the
step.
Example
Here is an example of the use of the Preset time of a step. The functional specification has these requirements.
1. Cook the ingredients in the tank for 20 seconds.
2. Empty the tank.
Example
Here is an example of the use of the high alarm of a step. The functional specification has these requirements.
1. Home 8 devices.
2. If all 8 devices are not home within 20 seconds, then shutdown the system.
Control which data to clear Execute only P and P0 actions and use Use the don't scan option
them to clear the required data.
Execute all actions and use either of Use the programmatic reset option
these options to clear the required data.
• Status bits of the step or action to
condition logic
• P and P0 actions
Let the controller clear data ------------------------------------------ Use the automatic reset option
--->
The following table compares the different options for handling the last scan of a step.
Execution actions Only P and P0 actions execute. All actions execute according • P and P0 actions execute
They execute according to to their logic. according to their logic.
their logic. • All other actions execute
in Postscan mode.
• On the next scan of
the routine, the P and
P0 actions execute in
Postscan mode.
Retention of data values All data keeps its current All data keeps its current • Data reverts to its values
values. values. for postscan.
• Tags to the left of [:=]
assignments clear to
zero.
Method for clearing data Use P and P0 actions. Use either of these: Use either of these:
• Status bits of the step or • [:=] assignment
action to condition logic (non-retentive
• P and P0 actions assignment)
• Instructions that clear
their data during
postscan
Reset of a nested SFC A nested SFC remains at its A nested SFC remains at its For the Restart Position
current step. current step. property, if you choose the
Restart at initial step option,
then these occur:
• A nested SFC resets to its
initial step
• The X bit of a stop
element in a nested SFC
clears to zero
To turn off a device at the end of a step using the Don't Scan option
1. Make sure that the Last Scan of Active Steps property is set to the Don’t scan option (default).
2. Use a P0 Pulse (Falling Edge) action to clear the required data. Make sure that the P0 action or actions are
last in the order of actions for the step.
During the last scan of the step, the Don’t scan option executes only P and P0 actions. The assignments and
instructions of the actions execute according to their logic conditions.
◦ The controller does not execute a postscan of assignments or instructions.
◦ When the SFC leaves the step, all data keeps its current values.
This example uses an action to turn on a conveyor at the start of a step. A different action turns off the
conveyor at the end of the step.
1. In the Last Scan of Active Steps property, select the Programmatic reset option.
2. Clear the required data using any of these methods.
◦ To your normal logic, add logic that clears the required data. Use the LS bit of the step or the Q bit of
the action to condition the execution of the logic.
◦ Use a P0 Pulse (Falling Edge) action to clear the required data. Make sure that the P0 action or actions
are last in the order of actions for the step.
During the last scan of the step, the Programmatic reset option executes all assignments and instructions according
to logic conditions.
This example uses a single action to turn on and off a conveyor and the LS Bit. The LS bit of the step conditions the
execution of the logic. See SFC STEP Structure.
Example
When the step is not on its last scan (conveyor_fwd.LS = 0), this
statement turns on conveyor_state. When conveyor_state turns
on, the conveyor turns on.
For an action that uses one of the stored qualifiers, use the Q bit of the action to condition your logic.
Example
When the action is not on its last scan (conveyor_start.Q =1), this
statement turns on conveyor_state. When conveyor_state turns
on, the conveyor turns on.
You can also use a P0 Pulse (Falling Edge) action to clear data. This example uses an action to turn on a conveyor at
the start of a step. A different action turns off the conveyor at the end of the step.
Example
Before the SFC leaves the step, the P0 action turns off the
conveyor. On the last scan of the step, conveyor_state turns off.
This turns off the conveyor.
Postscan is similar to prescan in that most instructions are executed as if they are FALSE. Some instructions have
specific postscan behavior.
• In RLL, OTE instructions are turned off and non-retentive timers are reset.
• In structured text, the destination of a non-retentive assignment "[:=]" is cleared.
• A JSR instruction invokes its subroutine but parameters are not passed and the logic in the subroutine is
executed in postscan mode.
• An Add-On Instruction executes its logic routine in postscan mode and then executes its postscan logic in
normal mode (if a postscan routine is configured).
• Any nested SFC (SFC that an action calls as a subroutine) is reset.
IMPORTANT: The postscan of an action actually occurs when the action goes from active to
inactive. Depending on the qualifier of the action, the postscan could occur before or after
the last scan of the step.
As a general rule, the postscan executes instructions as if all conditions are FALSE. For example, the Output Energize
(OTE) instruction clears its data during postscan.
To automatically turn off, or clear, devices at the end of a step using the
automatic reset option
1. In the Last Scan of Active Steps property, select the Automatic reset option.
2. To turn off a device at the end of the step, control the state of the device with an assignment or instruction.
◦ [:=] assignment (non-retentive assignment)
◦ Output Energize (OTE) instruction in a subroutine
Some instructions do not follow the general rule during postscan. For a description of how a specific
instruction executes during postscan, see these publications.
◦ Logix 5000 Controllers General Instructions Reference Manual, publication 1756-RM003
◦ Advanced Process Control and Drives and Phase Sequence Instruction Reference Manual, publication 1756-
RM006
◦ Logix 5000 Motion Controllers Instructions Reference Manual, MOTION-RM002
Here is an example that uses a non-retentive assignment to control a conveyor. It turns on a conveyor
at the start of a step and automatically turns off the conveyor when the step is done.
▪ This action turns on the conveyor. When conveyor_state turns on, the conveyor turns on.
▪ When the SFC leaves the step, conveyor_state turns off. This turns off the conveyor.
Option Example
Option Example
Example
A paint operation completes these actions.
1. Transfers the product into the paint shop.
2. Paints the product using 3 separate paint guns.
3. Cleans the guns.
4. Transfers the product to the paint ovens.
During the entire process, the system must control the shop fans.
Step that starts the action Store the action name that you want to
execute for more than one step
◦ (more steps)
▪ The Reset action only turns
off the stored action. It
does not automatically
turn off the devices of
the action. To turn off the
device, follow the Reset
action with another action
that turns off the device. Or
use the Automatic reset
option described in Use the
automatic reset option.
▪ Before the SFC reaches a
stop element, reset any
stored actions that you
Step that stops the action Reset the same action name as the
stored action
When the SFC leaves the step that stores the action, the Logix Designer application continues to show the stored
action as active. By default, a green border displays around the action. This lets you know that the SFC is executing
the logic of that action.
In this example, a step turns on a fan and then calls another SFC. The nested SFC sequences the remaining functions
of the step. The fan stays on throughout the steps of the nested SFC.
This action calls another SFC. The SFC sequences the remaining
functions of the step.
To Do this
Automatically loop back to an earlier step Wire the last transition to the top of the step to which you want
to go.
• The X bit of the stop element turns on. This signals that the SFC is at the stop element.
• Stored actions remain active.
• Execution stops for part or all of the SFC.
◦ Path within a simultaneous branch Only that path stops while the rest of the SFC continues to
execute.
Example
When the SFC reaches last_step and process_done is TRUE, the
execution of the SFC stops.
Nested (i.e., another SFC calls this SFC as • Automatic reset At the end of the step that calls the
a subroutine) nested SFC, the nested SFC automatically
resets.
• The nested SFC resets to the initial
step.
• The X bit of the stop element in the
nested SFC clears to zero.
Not nested (i.e., no SFC calls this SFC as a -------------------------------> 1. Use an SFC Reset (SFR) instruction to
subroutine) restart the SFC at the required step.
2. Use logic to clear the X bit of the
stop element.
Example
This example shows the use of the SFC Reset (SFR) instruction to restart the SFC and clear the X bit of the stop
element (see Restart (reset) the SFC).
If SFC_a_stop.X = on (SFC_a is at the stop) and SFC_a_reset = on (time to reset the SFC) then for one scan (ons[ 0 ] = on):
Reset SFC_a to SFC_a_Step_1
SFC_a_stop.X = 0
SFC_STOP structure
Each stop uses a tag to provide information about the stop element.
Determine when the SFC X BOOL • When the SFC reaches the stop, the X bit
is at the stop turns on.
• The X bit clears if you configure the SFCs to
restart at the initial step and the controller
changes from program to run mode.
• In a nested SFC, the X bit also clears if you
configure the SFCs for automatic reset and
the SFC leaves the step that calls the nested
SFC.
Determine the target Reset BOOL An SFC Reset (SFR) instruction resets the SFC to a
of an SFC Reset (SFR) step or stop that the instruction specifies.
instruction • The Reset bit indicates to which step or stop
the SFC will go to begin executing again.
• Once the SFC executes, the Reset bit clears.
Determine how many Count DINT This is not a count of scans of the stop.
times a stop has • The count increments each time the stop
become active becomes active.
• It increments again only after the stop goes
inactive and then active again.
• The count resets only if you configure the
SFC to restart at the initial step. With that
configuration, it resets when the controller
changes from program mode to run mode.
Use one tag for the Status DINT For this member Use this bit
various status bits of Reset 22
this stop
X 31
Nest an SFC
One method for organizing your project is to create one SFC that provides a high-level view of your process. Each step
of that SFC calls another SFC that performs the detailed procedures of the step (nested SFC).
This figure shows one way to nest an SFC. In this method, the last scan option of the SFC is configured for either
Programmatic reset or Don’t Scan. If you configure the SFC for Automatic reset, then step 1 in is unnecessary.
Call SFC_b.
Use the X bit of the stop element to signal that SFC_b is done
and it is time to go to the next step.
Pass parameters
To pass parameters to or from an SFC, place a Subroutine/Return element in the SFC.
You have the option of letting the SFC execute until it reaches a false transition. If several transitions are TRUE at the
same time, this option reduces the time to get to the correct step.
Select the Execute until FALSE transition option only when either of these are true:
• You do not have to update JSR parameters before each step. Parameters update only when the SFC returns to
the JSR.
• A FALSE transition occurs within the watchdog timer for the task. If the time that it takes to return to a JSR
and complete the rest of the task is greater than the watchdog timer, a major fault occurs.
Both instructions are available in the ladder logic and structured text programming languages.
Execution diagrams
The following diagrams show the execution of an SFC with different organizations of steps or different selections of
execution options.
• Execution of a sequence
• Execution of a simultaneous branch
• Execution of a selection branch
• When parameters enter and exit an SFC
• Options for execution control
The following diagram shows when parameters enter and exit an SFC
This SFC…
Introduction
Use a force to override data that your logic either uses or produces.
Use forces only as a temporary measure. They are not intended to be a permanent part of your application.
3. To wire (connect) two elements together, click a pin on one of the elements and then click the pin on
IMPORTANT: Use caution when copying and pasting components between different versions
of the Logix Designer application. The application only supports pasting to the same version
or newer. Pasting to a prior version of the application is not supported. When pasting to a
prior version, the paste action may succeed but the results may not be as intended.
Drag elements
From the SFC toolbar, drag the button for the required element to the correct connection point on the SFC. A green
dot shows a valid connection point.
1. On the SFC toolbar, click the button. Drag the new branch to the correct location.
2. To add a path to the branch, click the first step of the path that is to the left of where you want to add the
3. To wire the simultaneous branch to the preceding transition, click the bottom pin of the transition and
then click the horizontal line of the branch . A green dot shows a valid connection point.
4. To wire the simultaneous branch to the transition, click the top pin of the transition and then click the
horizontal line of the branch . A green dot shows a valid connection point.
3. To wire the selection branch to the preceding step, click the bottom pin of the step and then click the
horizontal line of the branch . A green dot shows a valid connection point.
Use the Move buttons to raise or lower the priority of the transition.
3. When all the transitions have the correct priority, click OK.
When you clear the Use default priorities check box, numbers show the priority of each transition.
NOTE:
Click the lower pin of the transition that signals the jump.
Then click the top pin of the step to which you want to go. A
green dot shows a valid connection point.
Hide a wire
If a wire gets in the way of other parts of your SFC, hide the wire to make the SFC easier to read. To hide a wire, right-
click the wire and select Hide Wire.
To see the SFC element to which the wire goes, click the grid location on the wire.
Configure a step
Follow the instructions in this section to configure a step.
2. In the Step Properties dialog box, on the General tab, in the Preset box, enter the time for the step, in
milliseconds.
3. Click OK.
When the step is active for the preset time (Timer = Preset), the DN bit of the step turns on.
To calculate the preset time for a step at runtime, see Use an expression to calculate a time.
3. Enter the time for the high alarm (Limit High) and low alarm (Limit Low), in milliseconds.
4. Click OK.
• Preset
• LimitHigh
• LimitLow
Choose a function
Choose an operator
Create a tag
4. Enter a numeric expression that defines the time. Use the buttons on the right side of the dialog box to help
you complete the expression.
5. Click OK.
6. To close the Step Properties dialog box, click OK.
Program a transition
2. Type the BOOL expression that determines when the transition is TRUE or FALSE.
3. To close the text entry window, press Ctrl+Enter.
This example shows three transitions that use a BOOL expression (see Enter a BOOL expression).
3. Click OK.
Add an action
To add an action to a step, right-click the step in which the action executes and then click Add Action.
Configure an action
Follow the instructions in this section to configure an action.
If you chose a timed qualifier, type the time limit or delay for the action, in milliseconds. These are the timed
qualifiers.
◦ L Time Limited
◦ SL Stored and Time Limited
◦ D Time Delayed
◦ DS Delayed and Stored
◦ SD Stored and Time Delayed
3. Click OK.
Choose a function
Choose an operator
Create a tag
4. Enter a numeric expression that defines the preset time. Use the buttons on the right side of the dialog box
to help you complete the expression.
5. Click OK.
6. To close the Action Properties dialog box, click OK.
3. Click OK.
Program an action
You can use structured text or a subroutine to program an action.
3. To pass a parameter to the routine, click an empty Input Parameters box. Click the down arrow and then
click the tag that contains the parameter.
4. To receive a parameter from the routine, click an empty Return Parameters box. Click the down arrow and
then click the tag in which to store the parameter from the routine.
5. Click OK.
1. Action_000
2. Action_001
3. Action_002
To change the order in which an action executes, drag the action to the correct location in the sequence. A green
bar shows a valid placement location. The following shows dragging Action_002 from after Action_001 to before
Action_001.
Document an SFC
You can document these SFC components.
General information about the SFC -----------------------------------------> Add a text box on page 67
Transition • Download the documentation to the Add structured text comments on page
controller 67
Action Download the documentation to the Add structured text comments on page
controller 67
Language switching
With version 17 and later of the application, you have the option to display project documentation, such as tag
descriptions and rung comments for any supported localized language. You can store project documentation for
multiple languages in a single project file rather than in language-specific project files. You define all the localized
languages that the project supports and set the current, default, and optional custom localized language. The default
language is used if the current language's content is blank for a particular component of the project. However,
you can use a custom language to tailor documentation to a specific type of project file user. Enter the localized
descriptions in your project, either when programming in that language or by using the import/export utility to
translate the documentation off-line and then import it back into the project. Once you enable language switching,
you can dynamically switch between languages as you use the software.
For more information on enabling a project to support multiple translations of project documentation, see the Logix
Designer online help.
That spans more than one line (*start of comment . . . end of comment*)
/*start of comment . . . end of comment*/
3. Select OK.
4. Drag the description box to the correct location on the SFC.
You can also use a text box to capture information that you can refer to later.
2. Drag the text box to a location near the element to which it applies.
3. Double-click the text box and type the note. Then press Ctrl+Enter.
4. As you move the element on the SFC, what do you want the text box to do?
5. Click the pin symbol in the text box and then click the SFC element to which you want to attach the text box. A
green dot shows a valid connection point.
1. Select the check boxes for the features you want to appear on SFC windows.
3. Click OK.
Last step that was running Restart at most recently executed step
The restart position does not apply for major faults. After you clear a major fault, the SFC always restarts at the
initial step.
1. Click OK.
• Force transitions
• Step through the SFC
• Time when you test or un-test edits to coincide with the SFC execution of the initial step.
• Place structured text logic in subroutines to minimize the impact of online edits.
• Use an SFR instruction to programmatically shift SFC execution to the correct step.
Force steps
Introduction
Use a force to override data that your logic either uses or produces.
Use forces only as a temporary measure. They are not intended to be a permanent part of your application.
Precautions
Make sure you understand the following before using forces.
ATTENTION: Forcing can cause unexpected machine motion that could injure personnel. Before you
use a force, determine how the force will affect your machine or process and keep personnel away
from the machine area.
• Enabling SFC forces causes your machine or process to go to a different state or phase.
• Removing forces may still leave forces in the enabled state.
• If forces are enabled and you install a force, the new force immediately takes effect.
Enable forces
For a force to take effect, you enable forces. You can only enable and disable forces at the controller level.
To enable forces
• You can enable I/O forces and SFC forces separately or at the same time.
• You cannot enable or disable forces for a specific module, tag collection, or tag element.
IMPORTANT: If you download a project that has forces enabled, the programming software
prompts you to enable or disable forces after the download completes.
When forces are in effect (enabled), a and TRUE or FALSE appears next to the forced element.
• You can disable or remove I/O and SFC forces at the same time or separately.
• Removing a force on an alias tag also removes the force on the base tag.
ATTENTION: Changes to forces can cause unexpected machine motion that could
injure personnel. Before you disable or remove forces, determine how the change will affect
your machine or process and keep personnel away from the machine area.
The Online toolbar shows the status of forces. It shows the status of I/O forces and SFC forces separately.
Enabled • If the project contains any forces of this type, they are
overriding your logic.
• If you add a force of this type, the new force immediately
takes effect
Disabled Forces of this type are inactive. If the project contains any
forces of this type, they are not overriding your logic.
Force LED
If your controller has a FORCE LED, use the LED to determine the status of any I/O forces.
IMPORTANT: The FORCE LED shows only the status of I/O forces. It does not show the status of SFC
forces.
GSV instruction
This example shows how to use a GSV instruction to get the status of forces.
IMPORTANT: The ForceStatus attribute shows only the status of I/O forces. It does not show the
status of SFC forces.
where:
This option also lets you override one time the false force of a simultaneous path. When you step through the force,
the SFC executes the steps of the path.
Override the conditions of a transition each time the SFC Force a transition.
reaches the transition
Prevent the execution of one or more paths of a simultaneous Force a simultaneous path.
branch
Force a transition
To override the conditions of a transition through repeated executions of an SFC, force the transition. The force
remains until you remove it or disable forces.
Prevent the SFC from going to the next step Force the transition FALSE.
Cause the SFC go to the next step regardless of transition Force the transition FALSE.
conditions
If you force a transition within a simultaneous branch to be FALSE, the SFC stays in the simultaneous branch as long
as the force is active (installed and enabled).
• To leave a simultaneous branch, the last step of each path must execute at least one time and the transition
below the branch must be TRUE.
• Forcing a transition FALSE prevents the SFC from reaching the last step of a path.
• When you remove or disable the force, the SFC can execute the rest of the steps in the path.
If you force a path of a simultaneous branch to be FALSE, the SFC stays in the simultaneous branch as long as the
force is active (installed and enabled).
• To leave a simultaneous branch, the last step of each path must execute at least one time and the transition
below the branch must be TRUE.
• Forcing a path FALSE prevents the SFC from entering a path and executing its steps.
• When you remove or disable the force, the SFC can execute the steps in the path.
ATTENTION: Forcing can cause unexpected machine motion that could injure personnel. Before you
use a force, determine how the force will affect your machine or process and keep personnel away
from the machine area.
• Enabling SFC forces causes your machine or process to go to a different state or phase.
• If forces are enabled and you install a force, the new force immediately takes effect.
If Then
Flashing No SFC forces are active. But at least one force already
exists in your project. When you enable SFC forces, all
existing SFC forces will also take effect.
Solid SFC forces are enabled (active). When you install (add) a
force, it immediately takes effect.
If Then
Yes Stop.
ATTENTION: Changes to forces can cause unexpected machine motion that could injure personnel.
Before you disable or remove forces, determine how the change will affect your machine or process
and keep personnel away from the machine area.
Technical Support Center Find help with how-to videos, FAQs, chat, user forums, and product notification updates. rok.auto/support
Local Technical Support Phone Numbers Locate the telephone number for your country. rok.auto/phonesupport
Literature Library Find installation instructions, manuals, brochures, and technical data publications. rok.auto/literature
Product Compatibility and Download Center Get help determining how products interact, check features and capabilities, and find rok.auto/pcdc
(PCDC) associated firmware.
Documentation feedback
Your comments help us serve your documentation needs better. If you have any suggestions on how to improve our content, complete the form at rok.auto/docfeedback.
Rockwell Automation maintains current product environmental information on its website at rok.auto/pec.
Rockwell Otomasyon Ticaret A.Ş. Kar Plaza İş Merkezi E Blok Kat:6 34752 İçerenköy, İstanbul, Tel: +90 (216) 5698400 EEE Yönetmeliğine Uygundur