Logix5000 Controllers FBD Programming Manual
Logix5000 Controllers FBD Programming Manual
Controllers
Function Block
Diagram
Programming: Function Block
Diagram
Programming Manual
IMPORTANT
ATTENTION
SHOCK HAZARD
BURN HAZARD
Allen-Bradley, ControlLogix, Rockwell Automation, RSLogix 5000, ControlFlash, TechConnect, and RSLinx are trademarks of Rockwell
Automation, Inc.
Trademarks not belonging to Rockwell Automation are property of their respective companies.
Table of Contents
Important User Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Preface
Chapter 1
Programming a Function Block
Diagram
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Choose the Function Block Elements . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Choose a Tag Name for an Element. . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Define the Order of Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Data Latching. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Order of Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Resolve a Loop. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Resolve Data Flow Between Two Blocks. . . . . . . . . . . . . . . . . . . . 15
Create a One Scan Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Identify any Connectors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Define Program/Operator Control. . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Add a Sheet. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Add a Function Block Element. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Connect Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Show or Hide a Pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Wire Elements Together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Mark a Wire with the Assume Data Available Indicator . . . . . . . . 22
Assign a Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Create and Assign a New Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Assign an Existing Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Assign an Immediate Value (Constant). . . . . . . . . . . . . . . . . . . . . . . . . 24
Use an IREF. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Enter a Value in the Tag of a Block . . . . . . . . . . . . . . . . . . . . . . . . 25
Connect Blocks with an OCON and ICON . . . . . . . . . . . . . . . . . . . . 25
Add an OCON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Add an ICON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Verify the Routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Rockwell Automation Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Installation Assistance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
New Product Satisfaction Return . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Preface
This manual shows how to program Logix5000 controllers with the function
block diagram (FBD) programming language. This manual is one of a set of
related manuals that show common procedures for programming and
operating Logix5000 controllers. For a complete list of common procedures
manuals, see the Logix 5000 Controllers Common Procedures Programming
Manual, publication 1756-PM001.
The term Logix5000 controller refers to any controller that is based on the
Logix5000 operating system, such as:
CompactLogix controllers
ControlLogix controllers
DriveLogix controllers
FlexLogix controllers
SoftLogix5800 controllers
Text that is
Identifies
Italic
courier
Right-click
name_of_program
Press [Enter].
For example
Means
Preface
Notes:
Chapter
Introduction
EXAMPLE
Motor Control Routine
Sheet 1 of 4
motor 1
Sheet 2 of 4
motor 2
Sheet 3 of 4
motor 3
Sheet 4 of 4
motor 4
Function block
Output wire
connector
(OCON)
Input wire
connector
(ICON)
Then use a
Function block
Each function block uses a tag to store configuration and status information
about the instruction.
Specify
Tag
tag_name
tag_name.bit_number
Member of a structure
tag_name.member_name
tag_name[x]
tag_name[x,y]
tag_name[x,y,z]
tag_name.member_name[x]
tag_name[x,y,z].member_name
where:
x is the location of the element in the first dimension.
y is the location of the element in the second dimension.
z is the location of the element in the third dimension.
For a structure within a structure, add an additional member_name.
TIP
You define execution order (flow of data) by wiring elements together and
indicating any input (feedback) wires, if necessary. The location of a block does
not affect the order in which the blocks execute.
Output pin
Wire
Input pin
Output pin
Wire
Input pin
Wire symbols:
SINT, INT, DINT,
or REAL value
BOOL value
(0 or 1)
Data Latching
If you use an IREF to specify input data for a function block instruction, the
data in that IREF is latched for the scan of the function block routine. The
IREF latches data from program-scoped and controller-scoped tags. The
controller updates all IREF data at the beginning of each scan.
IREF
10
In this example, the value of tagA is stored at the beginning of the routines
execution. The stored value is used when Block_01 executes. The same stored
value is also used when Blcock_02 executes. If the value of tagA changes
during execution of the routine, the stored value of tagA in the IREF does not
change until the next execution of the routine.
Block_01
tagA
Block_02
This example is the same as the one above. The value of tagA is stored only
once at the beginning of the routines execution. The routine uses this stored
value throughout the routine.
Block_01
tagA
Block_02
tagA
Starting with RSLogix 5000 software, version 11, you can use the same tag in
multiple IREFs and an OREF in the same routine. Because the values of tags
in IREFs are latched every scan through the routine, all IREFs will use the
same value, even if an OREF obtains a different tag value during execution of
the routine. In this example, if tagA has a value of 25.4 when the routine starts
executing this scan, and Block_01 changes the value of tagA to 50.9, the
second IREF wired into Block_02 will still use a value of 25.4 when Block_02
11
executes this scan. The new tagA value of 50.9 will not be used by any IREFs
in this routine until the start of the next scan.
Order of Execution
The RSLogix 5000 programming software automatically determines the order
of execution for the function blocks in a routine when you:
verify a function block routine.
verify a project that contains a function block routine.
download a project that contains a function block routine.
You define execution order by wiring function blocks together and indicating
the data flow of any feedback wires, if necessary.
If function blocks are not wired together, it does not matter which block
executes first. There is no data flow between the blocks.
If you wire the blocks sequentially, the execution order moves from input to
output. The inputs of a block require data to be available before the controller
can execute that block. For example, block 2 has to execute before block 3
because the outputs of block 2 feed the inputs of block 3.
1
12
Execution order is only relative to the blocks that are wired together. This
example is fine because the two groups of blocks are not wired together. The
blocks within a specific group execute in the appropriate order in relation to
the blocks in that group.
1
Resolve a Loop
To create a feedback loop around a block, wire an output pin of the block to
an input pin of the same block. This example is fine. The loop contains only a
single block, so execution order does not matter.
If a group of blocks are in a loop, the controller cannot determine which block
to execute first. In other words, it cannot resolve the loop.
?
13
To identify which block to execute first, mark the input wire that creates the
loop (the feedback wire) with the Assume Data Available indicator. In this
example, block 1 uses the output from block 3 that was produced in the
previous execution of the routine.
1
The Assume Data Available indicator defines the data flow within the loop.
The arrow indicates that the data serves as input to the first block in the loop.
Do not mark all the wires of a loop with the Assume Data Available indicator.
This is OK
1
This is NOT OK
2
The controller cannot resolve the loop because all the wires use the
Assume Data Available indicator.
The Assume Data Available indicator defines the data flow within
the loop.
14
This is NOT OK
One wire uses the Assume Data Available indicator while the other
wire does not.
15
Summary
A function block routine executes in this order:
1. The controller latches all data values in IREFs.
2. The controller executes the other function blocks in the order
determined by how they are wired.
3. The controller writes outputs in OREFs.
Like wires, connectors transfer data from output pins to input pins. Use
connectors when:
the elements that you want to connect are on different sheets within the
same routine.
a wire is difficult to route around other wires or elements.
you want to disperse data to several points in the routine.
Connector_A
Data
Connector_A
16
Define Program/Operator
Control
Description
.ProgProgReq
.ProgOperReq
.OperProgReq
.OperOperReq
17
The Program request inputs take precedence over the Operator request inputs.
This provides the capability to use the ProgProgReq and ProgOperReq inputs
to lock an instruction in a desired control. For example, lets assume that a
Totalizer instruction will always be used in Operator control, and your user
program will never control the running or stopping of the Totalizer. In this
case, you could wire a literal value of 1 into the ProgOperReq. This would
prevent the operator from ever putting the Totalizer into Program control by
setting the OperProgReq from an operator interface device.
Likewise, constantly setting the ProgProgReq can lock the instruction into
Program control. This is useful for automatic startup sequences when you
want the program to control the action of the instruction without worrying
about an operator inadvertently taking control of the instruction. In this
example, you have the program set the ProgProgReq input during the startup,
and then clear the ProgProgReq input once the startup was complete. Once
the ProgProgReq input is cleared, the instruction remains in Program control
until it receives a request to change. For example, the operator could set the
18
When StartupSequenceActive
is set, the PIDE instruction is
placed in Program control and
Manual mode. The StartupCV
value is used as the loop output.
19
Add a Sheet
Function blocks
20
To add an element:
1. On the Language Element toolbar, click the button for the element that
you want to add.
2. Drag the element to the desired location.
You can also drag the button for the element directly to the desired location.
Connect Elements
21
If you want to
Then
Hide a pin
Show a pin
3. Click OK.
Green dot
Input wire
22
Assign a Tag
4. Click the
button.
9. Click OK.
23
Do this
Tag
Bit number
Then
Use an IREF
Be able to change the value online without editing the Enter a Value in the Tag of a Block
routine
Use an IREF
1. Add an IREF.
2. Wire the IREF to the input pin that gets the value.
3.
24
Add an OCON
1. Add an output wire connector (OCON) and place it near the output pin
that supplies the value.
2. Wire the OCON to the output pin.
3. Double-click the operand area of the OCON.
4. Type a name that identifies the connector and press [Enter].
25
Add an ICON
1. Add an input wire connector (ICON) and place it near the input pin that
gets the value from the corresponding OCON.
2. Wire the ICON to the input pin.
3. Double-click the operand area of the ICON.
4. Select the name of the OCON that supplies the value to this connector
and then click a blank spot on the diagram
26
Rockwell Automation
Support
Rockwell Automation provides technical information on the Web to assist you in using
its products. At http://support.rockwellautomation.com, you can find technical
manuals, a knowledge base of FAQs, technical and application notes, sample code and
links to software service packs, and a MySupport feature that you can customize to
make the best use of these tools.
For an additional level of technical phone support for installation, configuration, and
troubleshooting, we offer TechConnect Support programs. For more information,
contact your local distributor or Rockwell Automation representative, or visit
http://support.rockwellautomation.com.
Installation Assistance
If you experience a problem with a hardware module within the first 24 hours of
installation, please review the information that's contained in this manual. You can also
contact a special Customer Support number for initial help in getting your module up
and running.
United States
1.440.646.3434
Monday Friday, 8am 5pm EST
Outside United
States
United States
Outside United
States
PN 953157-72
Copyright 2007 Rockwell Automation, Inc. All rights reserved. Printed in the U.S.A.