You are on page 1of 18

System 800xA Training

Chapter 10 Function Block Diagram

TABLE OF CONTENTS

Chapter 10 Function Block Diagram....................................................................................................................................... 1


10.1 General Information ................................................................................................................................................... 2
10.1.1 Objectives............................................................................................................................................................ 2
10.1.2 Legend................................................................................................................................................................. 2
10.1.3 Reference Documentation .................................................................................................................................... 2
10.2 FBD Editor................................................................................................................................................................. 3
10.2.1 Execution Rules ................................................................................................................................................... 3
10.2.2 Functions in FBD................................................................................................................................................. 4
10.2.3 FBD Pane ............................................................................................................................................................ 5
10.2.4 Toolbar Buttons ................................................................................................................................................... 6
10.2.5 Inserting a Function / Function Block ................................................................................................................... 7
10.2.6 EN Input Parameter.............................................................................................................................................. 8
10.2.7 Editing Parameter Properties ................................................................................................................................ 8
10.2.8 Making Connections ............................................................................................................................................ 9
10.2.9 Inverting Connections .........................................................................................................................................11
10.2.10 Adding Comments ............................................................................................................................................11
10.2.11 Structure Pane...................................................................................................................................................12
10.3 Changing Values Online ............................................................................................................................................13
10.4 Find and Search Tools ...............................................................................................................................................14
10.4.1 Search for Variables in Projects...........................................................................................................................14
10.4.2 Navigating to References ....................................................................................................................................15
10.5 Use of Multiple Pages in FBD....................................................................................................................................16
10.5.1 Page Setup..........................................................................................................................................................16
10.5.2 Insert Page Break................................................................................................................................................17
10.5.3 Delete Page Break...............................................................................................................................................17
10.5.4 Page References..................................................................................................................................................17

Chapter 10 - 1
T314-10 Function Block Diagram - RevC

10.1 General Information

10.1.1 Objectives
On completion of this chapter you will be able to:
• Configure simple application code in FBD
• Use I/O's in application code by connecting variables
• Modify application parameters online
• Organize code in different code blocks and pages

10.1.2 Legend
> Indicates when you go from one menu to a sub-menu
Italic Indicates object and file names
“ “ Indicates dialog box buttons, tabs, menus etc.
Bold Indicates important topics
Indicates start/explanation of student activity

10.1.3 Reference Documentation


3BSE043732 Industrial IT 800xA – Control and I/O
Application Programming – Introduction and Design
3BSE035980 Industrial IT 800xA – Control and I/O
Basic Control Software – Introduction and Configuration
3BSE035981 Industrial IT 800xA – Control and I/O
Extended Control Software – Binary and Analog Handling

Chapter 10 - 2
System 800xA Training

10.2 FBD Editor


Function Block Diagram (FBD) is a high-level graphical programming language. It
describes the POUs in terms of processing elements and displays the signal flow
between them, similar to electronic circuit diagrams.
It represents the function block and functions by graphical symbols (boxes), their input
and output parameters by pins of the boxes and the assignment of parameters by lines
between the pins. A comprehensive basic range of function blocks and functions are
available.
The FBD editor consists of the following major parts:

Structure Pane FBD Pane

10.2.1 Execution Rules


The execution order of function blocks and functions is defined at first by the order of
their creation. The execution order is represented by the order of the graphic symbols
(boxes) in FBD "from the left to the right" and "from the top to the bottom".
You can change the execution order later by moving the selected function blocks and
functions "up" or "down" within the structure pane. Just drag-and-drop the function
block within the structure pane.

Chapter 10 - 3
T314-10 Function Block Diagram - RevC

10.2.2 Functions in FBD


The following basic functions corresponding to operators of textual programming
languages are available in the FBD language:
Assignments
Function Description
Move, := Assigns the value (number, logical or string) of the input parameter to the
output parameter.

Boolean Operators
Function Description
NOT Negates the Boolean value (1/0, on/off or True/False)
AND, & Boolean AND
XOR, =2k+1 Boolean XOR
OR, >=1 Boolean OR

Arithmetic Operators
Function Description
EXPT, ** Exponential, i.e. raising to the power
MUL, * Multiplication
DIV, / Division
ADD, + Addition
SUB, - Subtraction
MOD Modulus
ABS Absolute value

Relational Operators
Function Description
LT, < Less than
GT, > Greater than
LE, <= Less than or equal to
GE, >= Greater than or equal to
EQ, = Equal to
NE, <> Not equal to

Chapter 10 - 4
System 800xA Training

10.2.3 FBD Pane


The FBD panes are the right upper and lower sub panes within the code pane if you
are working with the FBD editor. They contain the function block diagram of the POU
you are programming.
NOTE! By default only the lower sub pane is shown.
You can drag the separation line just underneath the variable declaration
pane to access the upper sub pane.

The FBD panes contain:


• Graphic symbols of function and function block (boxes)
• Instance names of the function blocks
• Comments attached to the function blocks and functions
• Assignment of parameters in form of connection lines between the graphic
symbols
• Comment of the page and footer

Use the FBD panes to:


• Inspect the function block diagram of the POU you are programming
• Select, copy and paste functions and function blocks
• Create, modify and delete function blocks and functions
• Edit instance name of function blocks and edit comments
• Assign values to the parameters of function blocks and functions

Chapter 10 - 5
T314-10 Function Block Diagram - RevC

10.2.4 Toolbar Buttons


There is a special toolbar in the FBD editor, with shortcuts to many of the commands
found in the menu bar (or in the pop-up menus). You can see a brief explanation (tool
tip) of each button, if you hold the cursor over the button.

Toolbar Menu Command Key Description


button
Insert > Function/Function Ins Insert new function or function
Block block
Tools > Edit Parameters Use this command to assign
>Connect variables and constants to the
selected parameter of a
function block or function.
Tools > Edit Parameters Ctrl + D Use this command to de-assign
>Disconnect a variable or constant from the
selected parameter of a
function block or function.
Tools > Edit Parameters > Use this command to invert a
Invert Boolean input parameter of a
function block or function.

Chapter 10 - 6
System 800xA Training

10.2.5 Inserting a Function / Function Block


There are several ways to insert a function/ function block;

1. Use the toolbar button


2. Choose “Insert > Function/ Function block” from the POU menu
3. Right click in the code pane and choose “Insert Function / Function block”

Insert the Function / Function Block


In the dialog window a list of available functions and function block types is presented
in the drop-down list.
NOTE! Just type the first letters of the function name to jump to
that entry.

It is also possible to use the Browse button to get an explorer-like overview of all
libraries and applications and their functions / function blocks. If you want to choose
from a list of previously used function block types, use the “Local FB Declarations”
button.

Connect Parameters
If it is a function/function block that supports configurable input parameters, these
inputs can be specified in the dialog window.
To go straight to the Connection dialog window, check “Connect Parameters”.
The “EN” checkbox makes the optional Enable parameter available (this is explained
in the next section).

Chapter 10 - 7
T314-10 Function Block Diagram - RevC

10.2.6 EN Input Parameter


The EN property for functions and function blocks in FBD makes it possible to write
code that corresponds to “IF statements” in the Structured Text language.
The EN parameter should be connected to a bool variable just as any other bool
parameter.
When the EN input is true, the function or function block will be executed, otherwise
not. When the EN input becomes false, all outputs will keep their values from the
previous cycle of execution.
NOTE! If a function has an EN input, it must be connected.

The EN parameter can be turned on/off when inserting a new function or function
block (see Insert Function/Function Block dialog section), or when editing the
parameter properties (see below).

10.2.7 Editing Parameter Properties


Some functions or function blocks supports configurable parameters. For instance the
number of inputs on an AND function can be modified.
By clicking with the right mouse button on a function (box) you will see a menu.
Select “Edit Parameter Properties” to change the size or type of the function.

Activate the checkbox Enable parameter, if required.

Insert / Delete Parameter


Right click on a parameter (pin) of the function block or function. Select “Insert
Parameter” to add a new, last parameter (pin). Select “Delete Parameter” to delete the
parameter (pin).
NOTE! This is only possible if the function or function block is
expandable.

Chapter 10 - 8
System 800xA Training

10.2.8 Making Connections


If a parameter is to be connected to another parameter, one of them must be an output
parameter and the other one an input parameter.
NOTE! An output parameter can be assigned to any number of
input parameters but never to another output
parameter.
There are basically two ways of connecting the parameters (pins) of a function or
function block: Either you connect the parameters one-by-one or you connect them all
at once.

Connect each Parameter Separately


Right click on the parameter (pin) of the function block or function (box) to which you
want to assign a variable or a constant and select “Connect…” from the context menu.

Fill in the “To” field with a constant value or a variable name. To display a list of all
available variables, press Ctrl+J.
NOTE! If you want to connect an OUT parameter to several
variables, separate the names with ‘,’ (comma).
For example: Start1, Start2

Press “OK” to close the dialog window or “Apply/Next” to apply the connection and
go the next parameter.

The “Direction” setting together with the value in the “Next:” drop-down list
determine what will happen when the “Next” button is pressed. In the example in the
figure pressing “Apply/Next” will move the selection forward to the next unconnected
parameter.

If the user enters a name that is not recognized by the system (i.e. not declared) and
presses “OK” or “Apply/Next”, the system will ask the user if the unknown name
should be declared by the system.

Chapter 10 - 9
T314-10 Function Block Diagram - RevC

Access to Variables with Structured Data Types


You gain access to the components by using the syntax:
<main_identifier>.<component>
For instance: NxxTemp is a RealIO variable. Type “NxxTemp” as main identifier and
then a “.” to see the structured variables.

Connect All Parameters


To connect several of the parameters in one action, it is best to bring up the Parameter
Connections editor. Right click and select “Edit Parameter List”.

Fill in the name of the variable in the actual “Parameter” field. Use the button to
get a tree-like overview of the POU and its variables.

Connect from one Function Block to Another


To connect two parameters to each other, select one parameter (pin) by clicking on it
with the left mouse button. Press the Ctrl key while clicking with the left mouse
button on the other parameter (pin) that you want to connect to.
NOTE! Be sure that you select one input parameter and one
output parameter.

Connect to a Previous Selection


To connect a parameter to another parameter, select the first parameter by clicking on
it with the left mouse button. Click on another parameter (pin) that you want to
connect to with the right mouse button.
By this, you select the second parameter, though the selection of the first one remains,
and you open the context menu. Select “Connect to Previous Selection” from the
context menu to accomplish the connection.

Chapter 10 - 10
System 800xA Training

10.2.9 Inverting Connections


To invert inputs to a function or function block right click on the input parameter, and
select “Invert” from the menu.

A small circle (bubble) will appear on the input parameter.

Signal Inverted

10.2.10 Adding Comments


It is possible to write comments to functions/function blocks and pages.
Edit Comments of Function Blocks and Functions
Select the function block or function to which you want to assign or edit a comment.
Select “Edit Comment…” from the context menu and type in your comment.

Edit Page Comments


If you want to add a comment for a page in FBD, just right click and select “Edit Page
Comment…” from the context menu.

Chapter 10 - 11
T314-10 Function Block Diagram - RevC

10.2.11 Structure Pane


The structure pane is the left sub pane within the code pane. It contains a list of all
function blocks and functions of the current POU.
Use the structure pane to:
• Get an overview of the POU.
• Select, copy and paste function blocks and functions.
• Create, modify and delete function blocks and functions.
• Edit instance name of function blocks, edit comments.
• Change the pagination and page comments.
• Navigate within the program.
• Change the order of execution in the FBD code pane.

The structure pane consists of the following sizable and movable columns:
• Item shows the type name of the function block or function with their properties
in parentheses
• Comment shows the comment attached to the function block or function
• Page Comment shows the comment on the top of the corresponding Function
Block Diagram page
• Page No is given at the first function block or function of every page of the
Function Block Diagram
• Instance shows the name of function blocks

Chapter 10 - 12
System 800xA Training

10.3 Changing Values Online


When a controller project is in online mode and test mode, it is possible to inspect the
code while running it, and interact with the code. From the Project Explorer in online
mode, you have access to editors similar to those in offline mode.
You can open one or several new online editor windows from the Project Explorer by
double-clicking on the Program Organization Unit you want to view.

By using the online editors the code currently running in the controller(s) can be
inspected. Variable values and parameters can be changed.

Chapter 10 - 13
T314-10 Function Block Diagram - RevC

10.4 Find and Search Tools


The Find and Search tools provide fast access to text/variables in Declaration pane,
Code pane, Message pane or Project by clicking on the following icons:

Toolbar Menu Command Key Description


button
Edit > Find… Ctrl + F Find text in the using Pane in
the POU editor and jump to the
first occurrence
Edit > Find Next F3 Jump to the next occurrence in
the using Pane
Edit > Find in Editor… Find all text in the using POU
editor and list results in
Message Pane. You can jump
to the occurrence by double
clicking on the result
Edit > Search… Alt + F12 Powerful search tool. See next
section

10.4.1 Search for Variables in Projects


The Search and Navigation dialog can be accessed by clicking icon, selecting it from
the “Edit” menu, or by right-clicking on a Project Explorer object (not Tasks) and
select “Search…”

Chapter 10 - 14
System 800xA Training

Search For:
Enter the text to search for. Search options (see below) can be selected for the entered
text. An empty text or an asterisk (*) character in the text field search for all texts. All
texts are case-insensitive, that is, a search for the texts "my", "My", "mY" and "MY"
gives the same search results.

Search In:
The selection in the drop-down list specifies the scope of the search. By default it
searches in the POU where you started the search.

10.4.2 Navigating to References


In the references pane you can double click on the blue texts. A POU editor opens on
the right code pane. If the code is written in for instance FBD you will also be shown
the right page of this code tab. On the page you will have to look for the exact
location. If necessary you can do a “Find” to find it on the page.

Chapter 10 - 15
T314-10 Function Block Diagram - RevC

10.5 Use of Multiple Pages in FBD

10.5.1 Page Setup


It is possible to change the layout of the FBD pane by selecting “Tools > Page Layout
> Page Setup” in the menu bar. The settings in this page determine the page layout of
the currently displayed code block. The settings will be remembered by the system
even if the editor is closed.

The “Template” setting determines the page orientation and size.

If you want to change the default layout when inserting new FBD code blocks, go to
“Tools > Setup” and select the “FBD/LD” tab.

Chapter 10 - 16
System 800xA Training

10.5.2 Insert Page Break


Select the function block or function to which you want to attach a page break. Right
click on it and select “Insert Page Break” from the context menu.

NOTE! This action can only be done in the Structure Pane.


The FBD editor inserts the page break above this function block or function and
repaginates the Function Block Diagram code block.

10.5.3 Delete Page Break


Select the first function block or function on the page which you want to delete. B
Right click on it and select “Delete Page Break” from the context menu.

10.5.4 Page References


Select a line that connects the pins of function blocks and functions. Right click near
to an input pin, use the “Go To Source” command to navigate to the source of the
variable that is assigned to the selected parameter.

Chapter 10 - 17
T314-10 Function Block Diagram - RevC

If you have right clicked near to an output pin, use the “Go To Sink” command to
navigate to the parameter(s) to which the selected parameter is assigned.

In case of multiple sinks browse with the "<-" and "->" buttons in the Go To Sink
dialog box.

Chapter 10 - 18

You might also like