Logix 5000 Controllers Sequential Function Charts: Programming Manual
Logix 5000 Controllers Sequential Function Charts: Programming Manual
Logix 5000 Controllers Sequential Function Charts: Programming Manual
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.
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).
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.
Global changes
This table identifies changes that apply to all information about a subject in
the manual and the reason for the change. For example, the addition of new
supported hardware, a software design change, or additional reference
material would result in changes to all of the topics that deal with that subject.
Change Topic
Updated Legal notices. Legal notices on page 10
Chapter 1
Design a sequential function Introduction ................................................................................................13
chart What is a sequential function chart? .........................................................13
Define the tasks.......................................................................................... 16
Choose how to execute the SFC ................................................................. 17
Define the steps of the process .................................................................. 17
Step guidelines ..................................................................................... 18
SFC_STEP structure............................................................................. 19
Organize the steps ...................................................................................... 21
Sequence ...............................................................................................23
Selection branch ...................................................................................23
Simultaneous branch .......................................................................... 24
Wire to a previous step ....................................................................... 25
Add actions for each step .......................................................................... 25
How do you want to use the action? .................................................. 26
Use a non-Boolean action ................................................................... 26
Use a Boolean action ........................................................................... 27
SFC_ACTION structure ...................................................................... 28
Describe each action in pseudocode ........................................................ 28
Choose a qualifier for an action ............................................................... 29
Define the transition conditions .............................................................. 30
Transition tag ....................................................................................... 31
How do you want to program the transition? .................................... 31
Use a BOOL expression ........................................................................ 31
Call a subroutine in a transition .........................................................32
Transition after a specified time ...............................................................32
Turn off a device at the end of a step ........................................................ 35
Choose a last scan option .................................................................... 35
Use the Don’t Scan option ................................................................... 37
Use the programmatic reset option .................................................... 37
Use the automatic reset option ...........................................................39
Keep something on from step-to-step ...................................................... 41
How do you want to control the device? ............................................. 41
Use a simultaneous branch ................................................................. 41
Store and reset an action .................................................................... 42
Use one large step ................................................................................43
End the SFC ............................................................................................... 44
Chapter 2
Program a sequential function Introduction ............................................................................................... 53
chart Add and manually connect elements .................................................. 53
Add and automatically connect elements .......................................... 54
Drag elements ......................................................................................54
Create a simultaneous branch ...................................................................54
Start a simultaneous branch ...............................................................54
End a simultaneous branch .................................................................55
Create a selection branch ...........................................................................56
Start a selection branch .......................................................................56
End a selection branch .........................................................................56
Set the priorities of a selection branch ..................................................... 57
Connect a wire to the step ........................................................................ 58
Hide a wire ................................................................................................. 58
Configure a step .........................................................................................59
Assign the preset time for a step .........................................................59
Configure alarms for a step .................................................................59
Use an expression to calculate a time ................................................ 60
Program a transition .................................................................................. 61
Enter a BOOL expression .................................................................... 61
Call a subroutine when programming a transition........................... 61
Add an action ............................................................................................. 62
Configure an action................................................................................... 62
Change the qualifier of an action....................................................... 62
Calculate a preset time at runtime .....................................................63
Mark an action as a BOOLean action .................................................63
Program an action ......................................................................................63
Enter structured text .......................................................................... 64
Call a subroutine in an action ............................................................ 64
Assign the execution order of actions .......................................................65
Document an SFC.......................................................................................65
Language switching ............................................................................ 66
Add structured text comments .......................................................... 66
Chapter 3
Force steps Introduction ............................................................................................... 71
Precautions ................................................................................................. 71
Enable forces ............................................................................................... 71
Disable or remove a force ......................................................................... 72
Check force status ..................................................................................... 72
Force LED.............................................................................................. 73
GSV instruction .................................................................................... 73
Step through a transition or a force of a path .......................................... 73
When to use an SFC force ..........................................................................74
Force a transition .................................................................................74
Force a simultaneous path................................................................... 75
Add an SFC force ........................................................................................76
Remove or disable forces ........................................................................... 77
Disable all SFC forces ........................................................................... 77
Remove all SFC forces .......................................................................... 77
Index
Studio 5000 environment 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.
Logix 5000 Controllers Process and Drives Instructions Describes how to program a Logix 5000 controller for
Reference Manual, publication 1756-RM006 process or drives applications.
Logix 5000 Controllers Motion Instruction Set Reference Describes how to program a Logix 5000 controller for
Manual, publication MOTION-RM002 motion applications.
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.
What is a sequential A sequential function chart (SFC) is similar to a flowchart. It uses steps and
function chart? transitions to perform specific operations or actions. This example shows the
elements of an SFC. The SFC continues on the following page.
A step represents a major function of your process. It contains the actions that occur at a particular time,
phase, or station.
An action is one of the functions that a step performs.
A transition is the TRUE or FALSE condition that tells the SFC when to go to the next step.
A qualifier determines when an action starts and stops.
A simultaneous branch executes more than 1 step at the same time.
JSR instruction calls a subroutine.
A text box lets you add descriptive text or notes to your SFC.
Define the tasks The first step in the development of an SFC is to separate the configuration
and regulation of devices from the commands to those devices. Logix 5000
controllers let you divide your project into one continuous task and multiple
periodic tasks and event tasks.
Choose how to execute the To execute an SFC, either configure it as the main routine for a program or
SFC call it as a subroutine.
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.
Define the steps of the A step represents a major function of your process. It contains the actions
that occur at a particular time, phase, or station.
process
A transition ends a step. The transition defines the physical conditions that
must occur or change in order to go to the next step.
• When you first open an SFC routine, it contains an initial step and
transition. Use this step to initialize your process.
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.
If you want to Then select or set this Data type Details
member
Determine how long a step has been T DINT When a step becomes active, the Timer (T) value resets and then starts to count up
active (milliseconds) in milliseconds. The Timer continues to count up until the step goes inactive,
regardless of the Preset (PRE) value.
Set a flag when the step has been active PRE DINT Enter the time in the Preset (PRE) member. When the Timer (T) reaches the Preset
for a specific length of time (milliseconds) value, the Done (DN) bit turns on and stays on until the step becomes active again.
As an option, select Use Expression and click Define to enter a numeric expression
that calculates the time at runtime.
DN BOOL When the Timer (T) reaches the Preset (PRE) value, the Done (DN) bit turns on and
stays on until the step becomes active again.
Set a flag if a step did not execute long LimitLow DINT Enter the time in the Limit Low (LimitLow) member (milliseconds).
enough • 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 executing too long LimitHigh DINT Enter the time in the Limit High member (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 step is active X BOOL The X bit is on the entire time the step is active (executing).
(including first and last scan) Typically, we recommend that you use an action with a N Non-Stored qualifier to
accomplish this.
Do something one time when the step FS1 BOOL The FS bit is on during the first scan of the step.
becomes active Typically, we recommend that you use an action with a P1 Pulse (Rising
Edge) qualifier to accomplish this.
Do something while the step is active, SA BOOL The SA bit is on when the step is active except during the first and last scan of the
except on the first and last scan step.
Do something one time on the last scan of LS1 BOOL The LS bit is on during the last scan of the step.
the step Use this bit only if on the Controller Properties dialog box, SFC Execution tab, you set
the Last Scan of Active Step to Don’t Scan or Programmatic reset.
Typically, we recommend that you use an action with a P0 Pulse (Falling
Edge) qualifier to accomplish this.
Determine the target of an SFC Reset Reset BOOL An SFC Reset (SFR) instruction resets the SFC to a step or stop that the instruction
(SFR) instruction specifies.
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 maximum time that a step TMax DINT Use this for diagnostic purposes. The controller clears this value only when you set
has been active during any of its the Restart Position to Restart at initial step and the controller changes modes or
executions experiences a power cycle.
Determine if the Timer (T) value rolls over OV BOOL Use this for diagnostic purposes.
to a negative value
Determine how many times a step has Count DINT This is not a count of scans of the step.
become active • The count increments each time the step 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 various status bits of Status DINT For this member Use this bit
this step
Reset 22
AlarmHigh 23
AlarmLow 24
AlarmEn 25
OV 26
DN 27
LS 28
SA 29
FS 30
X 31
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).
This diagram shows the relationship of the X, FS, SA, and LS bits.
Organize the steps Once you define the steps of your process, organize them into sequences,
simultaneous branches, selection branches, or loops.
To Use this structure With these considerations
Execute 1 or more steps in sequence Sequence on page 23 The SFC checks the transition at the end of the step.
• One executes repeatedly • If TRUE the SFC goes to the next step.
• Then the next executes repeatedly • If FALSE, the SFC repeats the step.
• Choose between alternative steps or groups of steps Selection Branch on page 23 • It is OK for a path to have no steps and only a transition.
depending on logic conditions This lets the SFC skip the selection branch.
• Execute a step or steps or skip the step or steps • By default, the SFC checks from left to right the transitions
depending on logic conditions that start each path. It takes the first TRUE path.
• If no transitions are TRUE, the SFC repeats the previous
step.
• The Logix Designer application lets you change the order
in which the SFC checks the transitions.
Execute 2 or more steps at the same time. All paths Simultaneous Branch on page 24 • A single transition ends the branch.
must finish before continuing the SFC • The SFC checks the ending 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 25 • 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.
Station 45 and 46 of an assembly line work on parts simultaneously. When both Simultaneous Branch
stations are done, the parts move down 1 station.
Depending on the build code, a station either drills or polishes. Selection Branch
In a heat treating area, the temperature ramps up at a specific rate, maintains that Sequence
temperature for a specific duration, and then cools at a specific rate.
At station 12, the machine drills, taps, and bolts a part. The steps occur one after the Sequence
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).
• Only one path executes.
• By default the SFC checks the transitions from left to right.
• The SFC takes the first TRUE path.
See also
Program a Sequential Function Chart on page 53
Simultaneous branch A simultaneous branch represents paths (steps or group of steps) that occur at
the same time (an AND structure).
• All paths execute.
• All paths must finish before continuing with the SFC.
• The SFC checks the transition after the last step of each path has
executed at least once.
Wire to a previous step You can also connect a step to a previous point in your SFC.
• Loop back and repeat steps
• Return to the beginning of the SFC and start over
Add actions for each step Use actions to divide a step into the different functions that the step
performs, such as commanding a motor, setting the state of a valve, or
placing a group of devices in a specific mode.
How do you want to use the There are two types of actions.
See also
Use a non-Boolean action on page 26
Use a Boolean action on page 27
Use a non-Boolean action A non-Boolean action contains the logic for the action. It uses structured text
to execute assignments and instructions or call a subroutine.
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.
To program a non-Boolean action, you have these options.
If you want to Then
When the S_Complete_the_Batch step is active, the S_Open_Outlet action executes. The action sets the
Outlet.ProgCommand tag equal to 1, which opens the outlet valve.
When the S_Complete_the_Batch step is active, the S_Open_Outlet action executes. The action calls the
Open_Outlet routine.
Open_Outlet Routine
When the Open_Outlet routine executes, the OTE instruction sets the Outlet.ProgCommand tag equal to 1, which
opens the outlet valve.
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.
See also
Turn off a device at the end of a step on page 35
Use a Boolean action A Boolean action contains no logic for the action. It simply sets a bit in its tag
(SFC_ACTION structure). To do the action, other logic must monitor the bit
and execute when the bit is on.
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.
If you want to Then select or set this Data type Details
member
Determine when the action is active Q BOOL The status of the Q bit depends on whether the action is a Boolean action or
non-Boolean action.
If the action is Then the Q bit is
Boolean On (1) the entire time the action is active, including the
last scan of the action
Non-Boolean On (1) while the action is active but
Off (0) at the last scan of the action
Use one of these time-based qualifiers: L, PRE DINT Enter the time limit or delay in the Preset (PRE) member. The action starts or stops
SL, D, DS, SD when the Timer (T) reaches the Preset value.
As an option, enter a numeric expression that calculates the time at runtime.
Determine how many times an action has Count DINT This is not a count of scans of the action.
become active • The count increments each time the action 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 various status bits of Status DINT For this member Use this bit
this action
Q 30
A 31
Describe each action in To organize the logic for an action, first you describe the action in
pseudocode.
pseudocode
• Use a series of short statements that describe what should happen.
• Use terms or symbols, such as: if, then, otherwise, until, and, or, =, >, <.
• Sequence the statements in the order that they should execute.
• If necessary, name the conditions to check first (the "when to act" first)
and then the action to take second (the "what to do" second).
Enter the pseudocode into the body of the action.
• Refine the pseudocode so it executes as structured text.
• Use the pseudocode to design your logic and leave the pseudocode as
comments. Since all structured text comments download to the
Choose a qualifier for an Each action (non-Boolean and Boolean) uses a qualifier to determine when it
starts and stops.
action
The default qualifier is N Non-Stored. The action starts when the step is
activated and stops when the step is deactivated.
To change when an action starts or stops, assign a different qualifier.
If you want the action to And Then assign this Which means
qualifier
Start when the step is activated Stop when the step is deactivated N Non-Stored
Execute only once P1 Pulse (Rising
Edge)
Stop before the step is deactivated or when the step is deactivated L Time Limited
Stay active until a Reset action turns off this action S Stored
Stay active until a Reset action turns off this action SL Stored and Time
Or a specific time expires, even if the step is deactivated Limited
Start a specific time after the step is activated and the Stop when the step is deactivated D Time Delayed
step is still active
Stay active until a Reset action turns off this action DS Delayed and
Stored
Start a specific time after the step is activated, even if Stay active until a Reset action turns off this action SD Stored and Time
the step is deactivated before this time Delayed
Execute once when the step is activated Execute once when the step is deactivated P Pulse
Start when the step is deactivated Execute only once P0 Pulse (Falling
Edge)
Turn off (reset) a stored action ----------------------------------------------------> R Reset
• S Stored
• SL Stored and Time Limited
• DS Delayed and Stored
• SD Stored and Time Delayed
Define the transition The transition is the physical conditions that must occur or change in order to
go to the next step.
conditions
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.
If the transition is The value is And
How do you want to To program the transition, you have the following options.
See also
Use a BOOL expression on page 31
Use a BOOL expression The simplest way to program the transition is to enter the conditions as a
BOOL expression in structured text. A BOOL expression uses BOOL tags,
relational operators, and logical operators to compare values or check if
conditions are TRUE or FALSE. For example, tag1>65.
- or -
Call a subroutine.
Check for the required conditions. When those conditions are TRUE, turn on a BOOL tag.
Use an EOT instruction to set the state of the transition equal to the value of the BOOL tag. When the BOOL
tag is on (TRUE), the transition is TRUE.
Transition after a specified Each step of the SFC includes a millisecond timer that runs whenever the step
is active. Use the timer to for these situations.
time
• 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.
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.
Step becomes active.
X bit turns on.
Timer (T) begins to increment.
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.
Turn off a device at the end When the SFC leaves a step, you have several options on how to turn off
devices that the step turned on.
of a step
Programmatic reset Automatic reset
Control which data to clear Execute only P and P0 actions and use them to clear the Use the don't scan option
required data.
Execute all actions and use either of these options to clear Use the programmatic reset option
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.
Characteristic During the last scan of a step, this option does
Don’t scan Programmatic reset Automatic reset
Execution actions Only P and P0 actions execute. They All actions execute according to their logic. • P and P0 actions execute according to
execute 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 values. All data keeps its current values. • Data reverts to its 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 action to • [:=] assignment (non-retentive
condition logic assignment)
• P and P0 actions • Instructions that clear their data during
postscan
Reset of a nested SFC A nested SFCs remains at its current step. A nested SFCs remains at its current step. For the Restart Position 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
See also
Use the don’t scan option on page 37
Use the programmatic reset option on page 37
Use the automatic reset option on page 39
Use the Don’t Scan option The default option for handling the last scan of a step is Don’t scan. With this
option, all data keeps its current values when the SFC leaves a step. This
requires you to use additional assignments or instructions to clear any data
that you want to turn off at the end of a step.
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.
This action turns on the conveyor. When conveyor_state turns on, the conveyor turns on.
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.
Use the programmatic reset An optional method to programmatically turn off (clear) devices at the end of
a step is to execute all actions on the last scan of the step. This lets you execute
option your normal logic as well as turn off (clear) devices at the end of a 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.
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.
On the last scan of the step (conveyor_fwd.LS =1), this statement turns off conveyor_state. When
conveyor_state turns off, the conveyor turns off.
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.
On the last scan of the action (conveyor_start.Q =0), this statement turns off conveyor_state. When
conveyor_state turns off, the conveyor turns off.
Example
This action turns on the conveyor. When conveyor_state turns on, the conveyor turns on.
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.
See also
SFC_STEP structure on page 19
Use the automatic reset Automatic reset provides a system-defined cleanup of actions (known as
postscan) when they are shut down when any of the following occur.
option
• transition out of the associated step
• reset of a stored action
• reset of an SFC routine
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.
• 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.
See also
Logix 5000 Controllers General Instructions Reference Manual,
publication 1756-RM003
Advanced Process Control and Drives and Phase and Sequence
Instruction Reference Manual, publication 1756-RM006
Logix 5000 Motion Controllers Instructions Reference Manual,
publication MOTION-RM002
Keep something on from To provide bumpless control of a device during more than one time or phase
(step), do one of the following options.
step-to-step
How do you want to control
the device?
Option Example
Use a simultaneous branch on page 41
Make a separate step that controls the device.
Use a simultaneous branch A simple way to control a device or devices during one or more steps is to
create a separate step for the devices. Then use a simultaneous branch to
execute the step during the rest of the process.
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.
Store and reset an action Typically, an action turns off (stops executing) when the SFC goes to the next
step. To keep a device on from step to step without a bump, store the action
that controls the device.
• (more steps)
Reset the same action name as
the stored action
Step that stops
the 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.
When using a stored action, follow these guidelines.
• The Reset action only turns off the stored action. It does not
automatically turn off the devices of the action. To turn off the
To turn the fan back on, the SFC has to jump back to step_1.
See also
Use the automatic reset option on page 39
Use one large step If you use one large step for multiple functions, then use additional logic to
sequence the functions. One option is to nest an SFC within the large step.
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.
Use a Large Step
This action calls another SFC. The SFC sequences the remaining functions of the step.
End the SFC Once an SFC completes its last step, it does not automatically restart at the
first step. You must tell the SFC what to do when it finishes the last 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.
See also
Use a stop element on page 44
Use a stop element Use the stop element to stop the execution of an entire SFC or of a path of a
simultaneous branch and wait to restart.
Example
Use a stop element on page 44
When the SFC reaches last_step and process_done is TRUE, the execution of
the SFC stops.
Restart (reset) the SFC Once at the stop element, you have several options to restart the SFC.
If the SFC is And the Last Scan of the Active Steps Then
option is
Nested (i.e., another SFC calls this SFC as • Automatic reset At the end of the step that calls the nested SFC, the nested SFC automatically resets.
a subroutine) • The nested SFC resets to the initial step.
• The X bit of the stop element in the nested SFC clears to zero.
• Programmatic reset 1. Use an SFC Reset (SFR) instruction to restart the SFC at the required step.
• Don’t scan 2. Use logic to clear the X bit of the stop element.
Not nested (i.e., no SFC calls this SFC as a -------------------------------> 1. Use an SFC Reset (SFR) instruction to restart the SFC at the required step.
subroutine) 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.
If you want to Then check or set this Data type Details
member
Determine when the SFC is at the stop X BOOL • When the SFC reaches the stop, the X bit 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 of an SFC Reset Reset BOOL An SFC Reset (SFR) instruction resets the SFC to a step or stop that the instruction
(SFR) instruction specifies.
• 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 times a stop has Count DINT This is not a count of scans of the stop.
become active • The count increments each time the stop 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 various status bits of Status DINT For this member Use this bit
this stop
Reset 22
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.
Stop SFC_b. This sets the X bit of the stop element.
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.
Configure when to return to By default, an SFC executes a step or group of simultaneous steps and then
returns to the operating system (OS) or the calling routine (JSR).
the OS/JSR
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.
Pause or reset an SFC Two optional instructions are available that give you further control over the
execution of your SFC.
If you want to Then use this instruction
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 the execution of a sequence.
The following diagram shows when parameters enter and exit an SFC
Add and manually connect Use these steps to add and manually connect element.
elements
To add and manually connect elements
1. On the SFC toolbar, click the button for the item that you want to add.
2. Drag the element to the required location on the SFC.
Add and automatically Select an existing element and add a new element to easily join those
elements.
connect elements
Create a simultaneous Use the instructions in this section to create a simultaneous branch.
branch
branch 1. On the SFC toolbar, click the button. Drag the new branch to
the correct location.
Create a selection branch Follow the instructions in this section to create a selection branch.
Start a selection branch 1. On the SFC toolbar, click the button. Then drag the new
branch to the correct location.
2. To add a path to the branch, click the first transition of the path that is
to the left of where you want to add the new path. Click .
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.
Set the priorities of a By default, the SFC checks the transitions that start a selection branch from
selection branch left to right. If you want to check a different transition first, assign a priority
to each path of the selection branch. For example, it is a good practice to
check for error conditions first. Then check for normal conditions.
Use the Move buttons to raise or lower the priority of the transition.
3. When all the transitions have the correct priority, click OK.
Connect a wire to the step You may have to reposition a wire after you connect it to a step. This example
shows how to go to Step_001 from Tran_003.
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.
To make the jump easier to read, drag its horizontal bar above the step to which the jump goes. You may
also have to reposition some of the SFC elements.
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.
Location to which the wire goes
Assign the preset time for a Use these steps to assign the present time for a step.
step
To assign the present time for a step
1. Click the button of the 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.
See also
Use an expression to calculate a time on page 60
Configure alarms for a step Follow these steps to turn on an alarm if a step executes too long or not long
enough.
3. Enter the time for the high alarm (Limit High) and low alarm (Limit
Low), in milliseconds.
4. Click OK.
Use an expression to To calculate a time based on tags in your project, enter the time as a numeric
calculate a time expression. You can use an expression to calculate these values.
• Preset
• LimitHigh
• LimitLow
Program a transition The simplest way to program the transition is to enter the conditions as a
BOOL expression in structured text.
Enter a BOOL expression
To enter a BOOL expression
1. Double-click the text area of the transition.
This example shows three transitions that use a BOOL expression (see
Enter a BOOL expression).
See also
Enter a BOOL expression on page 61
Call a subroutine when Use the Set JSR option to call a subroutine when you program a transition.
programming a transition
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.
Change the qualifier of an A qualifier determines when an action starts and stops. The default qualifier
is N Non-Stored. The action starts when the step is activated and stops when
action the step is deactivated.
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
Mark an action as a Use a Boolean action to only set a bit when the action executes.
BOOLean action
Mark an action as a Boolean action
1. Click the button in the action.
2. In the Action Properties dialog box, select the Boolean check box.
3. Click OK.
Program an action You can use structured text or a subroutine to program an action.
Enter structured text The easiest way to program an action is to write the logic as structured text
within the body of the action. When the action turns on, the controller
executes the structured text.
Call a subroutine in an Use a Jump to Subroutine (JSR) instruction to execute a subroutine when the
action action is active.
Assign the execution order Actions execute in the order in which they appear.
of actions
General information about the SFC -----------------------------------------> Add a text box on page 67
Step -----------------------------------------> Add a text box on page 67
-or-
Add a tag description on page 67
Transition • Download the documentation to the controller Add structured text comments on page 66
• Have the option of showing or hiding the documentation Add a text box on page 67
• Position the documentation anywhere in the SFC -or-
Add a tag description on page 67
Action Download the documentation to the controller Add structured text comments on page 66
Stop -----------------------------------------> Add a text box on page 67
-or-
Other element (such as a selection branch) ----------------------------------------->
Add a tag description on page 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.
Project documentation that supports multiple translations includes these
variables:
• Component descriptions in tags, routines, programs, Equipment
Phases, Equipment Sequences, user-defined data types, and Add-On
Instructions
• Engineering units and state identifiers added to tags, user-defined
data types, or Add-On Instructions
• Trends
• Controllers
• Alarm Messages (in configuration of ALARM_ANALOG and
ALARM_DIGITAL tags)
• Tasks
• Property descriptions for module in the Controller Organizer
• Rung comments, SFC text boxes, and FBD text boxes
For more information on enabling a project to support multiple translations
of project documentation, see the online help.
Add structured text Comments embedded in the structured text section of an action are
downloaded into controller memory and are available for upload.
comments
1. Double-click the text area of the action.
That spans more than one line (* start of comment . . . end of comment*)
/* start of comment . . . end of comment*/
3. To close the text entry window, press Ctrl+Enter.
Add a tag description Add tag descriptions to help identify each tag's purpose.
3. Select OK.
4. Drag the description box to the correct location on the SFC.
Add a text box A text box lets you add notes that clarify the function of an SFC element (step,
transition, or stop). Text boxes are only stored in the offline, ACD project file.
Text boxes are not downloaded into controller memory.
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.
Show or hide text boxes or You have the option of showing or hiding both text boxes and tag
tag descriptions descriptions. If you select to show descriptions, the SFC window only shows
the descriptions for steps, transitions, and stops (not actions).
1. From the Tools menu, select Options.
2. Under SFC Editor, select the Display category.
3. Select the check boxes for the features you want to appear on SFC
windows.
Hide an individual tag Follow these steps to hide the description of a specific element while showing
description other descriptions.
3. Click OK.
Configure the execution of The SFC Execution tab of the controller properties lets you configure these
the SFC decisions.
• What to do when a transition is TRUE.
• Where to start after a transition to the Run mode or recovery from a
power loss.
• What to do on the last scan of a step.
1. On the Online toolbar, click the controller properties button.
Last step that was running Restart at most recently executed step
Initial step Restart at initial step
The restart position does not apply for major faults. After you clear a
major fault, the SFC always restarts at the initial step.
• What to do on the last scan of a step (Last Scan of Active Steps).
4. Click OK.
Verify the routine As you program your routine, periodically verify your work.
e. Repeat step 1.
3. To close the Results window, press Alt+1.
To check your SFC, you can use either of these options.
• Force transitions
• Step through the SFC
See the chapter on Force steps.
See also
Force steps on page 71
Edit an SFC online Firmware revision 13 added support for editing SFCs online. When you
transition the controller to test or un-test edits, the controller resets the SFC
and starts execution at the initial step. Keep these guidelines in mind if you
edit an SFC online.
• 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.
Maintain active SFC step As of firmware revision 18, the following online edits to an SFC no longer
reset the SFC to the initial step.
• Modify structured text in actions and transitions
• Physically move steps, actions, and transitions on SFC sheets without
changing the wiring
• Add, delete, or modify text and description boxes
• Modify indicator tags
• Add, delete or modify an SBR/RET
• Add, delete or modify any step or action expression
Force steps
Introduction Use a force to override data that your logic either uses or produces.
• Test and debug your logic.
• Temporarily keep your process functioning when an input device has
failed.
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.
Disable or remove a force To stop the effect of a force and let your project execute as programmed,
disable or remove the force.
• 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.
Check force status Before you use a force, determine the status of forces for the controller.
To determine the status of Use any of the following
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.
Installed At least one force of this type exists in the project.
None Installed No forces of this type exist in the project.
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:
Force_Status is a DINT tag.
To determine if Examine this bit For this value
Step through a transition or To override a false transition one time and go from an active step to the next
step, use the Step Through option.
a force of a path
• You do not have to add, enable, disable, or remove forces.
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 Force a simultaneous path.
simultaneous branch
Prevent the SFC from going to the next step Force the transition FALSE.
Cause the SFC go to the next step regardless of transition conditions Force the transition FALSE.
Force a simultaneous path To prevent the execution of a path of a simultaneous branch, force the path
FALSE. When the SFC reaches the branch, it executes only the un-forced
paths.
This path executes. This path does not
execute.
If Then
Solid SFC forces are enabled (active). When you install (add) a force, it immediately takes effect.
No From the Logic menu, choose SFC Forcing > Enable All SFC Forces. Then choose Yes to
confirm.
Yes Stop.
Remove or disable forces Make sure you understand the following before using forces.
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.
Disable all SFC forces From the Logic menu, click SFC Forcing and then click
Disable All SFC Forces. Then click Yes to confirm.
Remove all SFC forces From the Logic menu, click SFC Forcing and then click
Remove All SFC Forces. Then click Yes to confirm.
Index expression
BOOL expression 31, 60
numeric expression 60, 62
F
A force
disable 72
action 63 enable 71
assign qualifier 62 LED 72
boolean 27 monitor 72
call a subroutine 64 remove 72
choose between boolean and function block diagram
non-boolean 26 force a value 71
data type 27
non-boolean 26 J
program 26
reset 42 jump
store 42 sequential function chart 25
use expression 62
use of boolean action 27 L
use of structured text 63
ladder logic
alarm
force a value 71
sequential function chart 32, 59
override a value 71
automatic reset
last scan
sequential function chart 39
sequential function chart 34
B LED
force 72
BOOL expression
sequential function chart 31, 60 M
boolean action 27, 63
mark as boolean 63
program 27
monitor
branch
forces 72
sequential function chart 21
N
C
numeric expression 60, 62
call a subroutine 32, 61, 64
configure P
alarm 59
step 59 periodic task
application for 16
D postscan
sequential function chart 34
disable
program
force 72
action 26
documentation
boolean action 27
show or hide in sequential function chart
programmatic reset option 37
67
don't scan Q
sequential function chart 37
qualifier
E assign 62
enable
Rockwell Automation Publication 1756-PM006K-EN-P - March 2022 79
Index
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.
Allen-Bradley, expanding human possibility, Logix, Rockwell Automation, and Rockwell Software are trademarks of Rockwell Automation, Inc.
Trademarks not belonging to Rockwell Automation are property of their respective companies.
Rockwell Otomayson Ticaret A.Ş. Kar Plaza İş Merkezi E Blok Kat:6 34752, İçerenkÖy, İstanbul, Tel: +90 (216) 5698400 EEE YÖnetmeliğine Uygundur