You are on page 1of 22

Compiling a project

Compiling a project
Compiling overview.......................................................................................................................1
How to compile a project.................................................................................................................2
Make.....................................................................................................................................2
Patch POU...........................................................................................................................3
Rules and restrictions for patching POUs..............................................................4
Memory reserve settings of a POU........................................................................7
Graphical illustration of the memory reserve usage while patching.......................8
Developing a project using 'Patch POU'................................................................9
IEC defined FUs and FBs which can be patched without previous usage...........12
Patching a POU when working with several resources.......................................18
Compile Worksheet............................................................................................................18
Rebuild Project...................................................................................................................19
Using the message window to display and correct errors and warnings............................20

Compiling overview
When the project is edited you have to compile the project. Compiling means translating and
transforming the contents of the worksheets in special code which can be executed by your PLC.
The compilation process is performed in several steps:
It starts with compiling (i.e. syntax checking) the different worksheets.
During the second main step the compiled worksheets are linked together and an
intermediate IEC code is generated.
The last step generates the PLC code which has to be downloaded to the PLC.
While compiling, the message window displays the compilation process. Any detected errors and
warnings (e.g. syntax errors, memory or file problems) and additional information are also
displayed in the appropriate message window sheet. You can use the message window to access
the suspected code body worksheet by double clicking on the error message.
After compiling you have to download the program to the PLC. The download procedure differs
according to the PLC type you are working with.
The details for downloading are described in the topic Downloading in the PLC specific help
(please refer to the related topics list below).

How to compile a project


You have several possibilities to compile the project when you have finished editing. The
corresponding menu items are provided in the submenu 'Build'. Additionally each command is
available as toolbar icon.
'Make' This is the standard mode for compiling the project when you have finished
editing. The menu item can be used to compile all worksheets which have been edited.
These worksheets are marked with an asterisk in the project tree. After using 'Make' the
PLC specific code is generated and the project is ready for downloading to the PLC.
'Patch POU' This menu item is used to compile changes, which have been made e.g.
after debugging a project. The changes are automatically downloaded to the PLC while
the PLC keeps on running, i.e. the program execution on the PLC is not aborted. So you
can view changes immediately after switching the corresponding worksheet into online
mode. While patching a POU it is not necessary to stop the program execution on the
PLC.
'Compile worksheet' This menu item is used to compile a single worksheet after editing
it. Choosing this menu item means, that syntax errors within the current code body
worksheet and the related variable worksheet are going to be detected by the compiler. All
detected errors and warnings are displayed in the message window. By double clicking on
an error or warning you can open the related worksheet, where the error was detected.
Using only the compiler no code is generated!
Note: When closing or saving a worksheet, the system automatically compiles this
worksheet. Additionally the variables worksheet is compiled.
Due to this automatic compilation each user defined function or function block is available
in the Edit Wizard immediately after saving the corresponding worksheet.
'Rebuild Project' This menu item is used to compile the whole project for the first time or
if a user library has been changed. It should only be used, if 'Make' generates compiler
errors, if you have unzipped your project without the front end code or if changes have
been made in an announced user library.
Using 'Rebuild Project' all worksheets are going to be compiled and linked. Detected
errors and warnings are displayed in the message window. After the syntax checking the
IEC code as well as the PLC specific code is generated automatically. The project is then
ready for downloading to the PLC.

Make
Using the menu item/icon 'Make' or the shortcut <F9> the changed worksheets are compiled, linked
and the changed PLC code is going to be generated. After successful execution the changed
project is ready for downloading to the PLC.
Changed worksheets are marked with an asterisk in the project tree.
'Make' is the standard mode for compiling which should be used normally when you have finished
editing.

How to compile a project

Patch POU

When starting the compilation the message window appears automatically if closed. This window
displays the compilation process, any detected errors and warnings and additional information to
the process.
How to 'make' a project:
Click on the icon 'Make' in the toolbar.
The compilation process is displayed in the sheet 'Build' of the message window. Errors
and warnings detected during compilation are logged in the corresponding sheets of the
message window.
How to stop the compiler:
Click on the icon 'Stop Compile' in the toolbar to abort the compilation process.

Patch POU
To patch a POU means that changes you have made in a project are compiled, the related code is
generated and downloaded automatically to the PLC in one step. During the patch process the PLC
keeps on running, i.e. the code execution on the PLC is not aborted while compiling and
downloading the changes.
The menu item 'Patch POU' is only available if you switch the corresponding worksheet in offline
mode by clicking on the icon 'Debug on/off' in the toolbar.

The 'Patch POU' command can be used for two main purposes:
Correcting detected errors.
If you have detected a programming error using the online mode and you have switched
to offline mode to remove the programming error you can use 'Patch POU' to compile
these changes.
Further developing a base project.
In some cases it may be more comfortable to develop a project using the command 'Patch
POU' instead of 'Make'. After 'Making' a base project the first time and downloading it, you
can replenish this raw program (i.e. program shell) by editing the various POU code
worksheets and patch them to the PLC program which is already running on the target.
In both cases
the changes are downloaded automatically while the PLC keeps on running so that you
can view them immediately after switching into online mode.
some rules and restrictions have to be observed.
The memory reserve settings must be defined accordingly. Please refer to the topic
Memory reserve settings and to the graphical illustration.

How to compile a project

Rules and restrictions for patching POUs

How to patch a POU:


Make sure, that the memory reserve of the POU is large enough to patch the user data
(see note below and refer to the graphical illustration). If it is required to increase the
reserve size, the command 'Patch POU' can not be applied. In this case you have to use
'Make' to compile the changed project.
Make sure that the changed worksheet is the active window.
Make sure that the worksheet is in offline mode. In offline mode the corresponding icon
'Debug on/off' appears not pressed.
Edit your worksheet or correct any detected programming errors. Observe the rules and
restrictions before editing.
Click on the submenu 'Build' and select the menu item 'Patch POU' or click on the
corresponding icon in the toolbar.
The compilation process is started and its progress is displayed in the message window.
Detected errors and warnings can be displayed in the corresponding sheets of the
message window.
Patch POU uses the memory reserve
When patching, the system stores the user data of the patched POU in the memory reserve
defined for these POUs. If there is not enough reserve available, an error message appears and
the patch process is aborted.
Use 'Make' after 'Patch POU' failed
If the 'Patch POU' command fails, i.e. errors are reported in the message window, because one of
the rules/restrictions was not obeyed while patching or there is not enough memory reserve
available, you always have to compile the project using 'Make' and initiate a new download. When
compiling with 'Make' the data memory in the PLC is assigned newly, i.e. the reserve memory used
for earlier patches is released.
How to stop the compiler:
Click on the icon 'Stop Compile' in the toolbar to abort the compilation process.

When working with several resources, each instance (i.e. resource) has to be patched separately
by switching the corresponding online worksheet offline, changing the code and executing the
'Patch POU' command.
Rules and restrictions for patching POUs
The following rules must be kept in all programming languages (i.e. graphical and textual
languages) in order to use the command Patch POU. (Please note also the restrictions listed at
the end of this topic.)
Use 'Make' after 'Patch POU' failed
If one of the following rules or restrictions is violated, the patch process is aborted and an
appropriate error message is displayed in the message window.

How to compile a project

Rules and restrictions for patching POUs

Once the 'Patch POU' command is aborted, you have to use 'Make' and initiate a new download
manually before you can patch the next time.
Rules concerning size and usage of the memory reserve:
Size of the memory reserve area:
The memory reserve for a POU you want to patch must be set accordingly. This means,
that you have to assign a data reserve area in the PLC memory which is large enough to
store the user data (not the executable code!) of the variables/instances to be patched.
For detailed information please refer to the topic Memory reserve settings of a POU and to
the graphical illustration.
Resource and POU settings concerning the usage of the reserve:
In the 'Use reserve' dialog area of the resource settings dialog either the radio button 'All
POUs' or 'Marked POUs' must be marked. In the second case ('Marked POUs') the
corresponding checkbox 'User reserve' in the POU properties dialog must be activated in
order to patch the POU.
Using the option 'Marked POUs' makes sense, if there is only less free memory left on the
PLC. In this case you can use this frre memory as reserve only for patching these POUs
which are actually changed.
For dialog descriptions please refer to the related topics list below.
Rules concerning variables:
A POU can be patched after
inserting new local variables.
inserting new global variables.
deleting variables which are not used in *.csv.
Rules concerning functions:
A POU can be patched after
inserting an IEC defined function.
In difference to user defined functions and library functions (see next two items) nearly all
IEC functions can be patched even if they are not already used in the resource. (See also
note below).
inserting an user defined function if the function has already been called in any POU of the
resource before (see also note below).
inserting a function contained in a firmware library or in an user library if the function has
already been called in any POU of the resource before (see also note below).
Patching a POU is only possible for the listed cases if the project has already been compiled using
'Make', was downloaded to the target and the system was already in Online Mode.
Rules concerning function blocks:
Concerning function blocks it must be distinguished between IEC function blocks and user defined

How to compile a project

Rules and restrictions for patching POUs

function blocks.
A POU can be patched after
inserting an user defined function block if an instance of this user FB has already been
declared before in the variables worksheet of any POU in the resource. It is sufficient if the
instance declaration is entered in the variables worksheet, i.e. the instance has not to be
used (called) in a code body (see also note below).
inserting an IEC defined function block. In difference to user defined FBs and library FBs,
it is not necessary that the IEC FB instance is declared in the resource before. (See also
note below).
When inserting a function block contained in a firmware library or user library the same
rules apply as for user defined FBs (see also note below).
Patching a POU is only possible for the listed cases if the project has already been compiled using
'Make', was downloaded to the target and the system was already in Online Mode.
Additionally the following rules apply to the different programming languages:
Language
each

A POU can be patched after ...


new, empty lines have been inserted.
comments have been changed or added.

IL

IL operators have been changed or inserted.


the nesting level has been changed.

ST

statements or expressions have been changed.

FBD

networks have been changed or inserted.

LD

networks have been changed or inserted.

SFC

FBD networks, LD networks or variables connected to direct transitions have


been changed.
the time interval of time action qualifier has been changed.
the variable name in action blocks has been changed.

Restrictions: 'Patch POU' cannot be used


after changing string constants or user defined strings.
after changing variables properties.
in conjunction with an initial value of a variable (see note below).
after changing the formal parameters of functions and function blocks (VAR_INPUT,
VAR_OUTPUT and VAR_IN_OUT) or adding new formal parameters.

How to compile a project

Memory reserve settings of a POU

after deleting POUs or libraries.


after changing the physical hardware.
Why initializing variables and patching POUs won't go together:
When compiling a project using 'Make' the system generates a socalled init module. This module
is only processed one time by the PLC, actually when performing a cold start.
If you are trying to patch a variable in conjunction with a new or changed initial value, the PLC does
not consider the init module. So changed or newly added initial values are not possible and the
compiler generates an error message while patching.
You can find a remedy by using a recipe instead of initial values. In this case you have to edit the
desired values in the recipe manually. For detailed information please refer to the related topics list
below.
Memory reserve settings of a POU
For each POU in the project tree a PLC memory area can be allocated, which is called 'Reserve'.
This memory area is used to store the user data of newly inserted variables, functions or FB
instances while patching (see graphical illustration).
The reserve memory area is only used for storing user data but not for the executable POU code.
The reserve memory area is only used when compiling using 'Patch POU'. While using 'Make' the
user data memory in the PLC is assigned newly.
Important notes concerning the reserve memory:
The user data of the variables, functions or FB instances to be patched must not exceed
the available reserve memory space of the POU, in which they are used.
Example: In the POU 'Main' 500 Bytes of memory reserve are free. If you are trying to
patch a function block call in a code worksheet of this POU but the data size of this FB
POU is > 500 Byte, the compiler generates an error message and the patch process is
aborted. In this case you have to increase the memory reserve of the affected POU (see
procedure below).
Note: When inserting a function block call into a POU by patching, not only the data size
of the called FB instance is stored in the reserve memory of the patched POU. Also the
reserve of the inserted FB instance must be considered!
Please refer to the numbers 3 and 4 in the graphical illustration.
Each time the 'Patch POU' command is executed for a POU, the reserve memory space is
reduced by the size of the new inserted data.
Please refer to the numbers 3 and 4 in the graphical illustration.
Compiling a project using the 'Make' command releases the reserve memory area used
for patching, because 'Making' a project results in a new allocation of the PLC memory.
Due to this, you should compile a project using 'Make' if not enough reserve memory size
is left for the data to be patched or after the patch process has failed.
The actually available reserve memory size of each POU can be displayed. For that
purpose, click on the button 'Info' in the resource control dialog to call the dialog
'Resource: Resource_name' and open the tab 'POUs'. For detailed information about this

How to compile a project

Graphical illustration of the memory reserve usage while patching

dialog please refer to the related topics list below.


Setting the reserve memory area of a POU
There are two possibilities for setting the reserve memory size:
See also the graphical illustration explaining the reserve memory size.
Changing the default reserve size (for all POUs)
By default, each new POU is inserted with a default reserve memory size (factory setting
is 500 Byte). This default size is defined in the dialog 'Data Area' (see related topics list
below). Changing this value in the 'Data Area' dialog applies to all POUs which are still set
to the default values. Those POUs for which an individual reserve memory size has been
defined in the POU properties dialog are not affected (see next item).
Please refer to the number 1 in the graphical illustration.
Changing the reserve memory size for a single POU:
You can change the memory reserve size for each POU individually. For that purpose
click with the right mouse button on the desired POU icon in the project tree to open the
context menu. Select the menu item 'Properties'. In the appearing properties dialog open
the tab 'Type' (see related topics list below). Enter the desired values into the text fields
'Retain' and 'NonRetain'. You can either specify absolute Byte values or percentage
values (see next item).
Please refer to the number 2 in the graphical illustration.
Entering the reserve size in Byte or % ?
In the dialog 'Data Area' as well as in the POU properties dialog the reserve size can be
entered either as absolute values (Byte) or as percentage values.
When developing a project from the beginning using 'Patch POU' it is recommended to
use absolute values.
If you are only modifying an existing project and you have some expercience concerning
the actual user data size, it may be easier to work with percentage values.
Always use 'Make' after changing the reserve!
After changing the memory reserve size (default as well as for single POUs), you have to compile
the project using 'Make' and download the recompiled project to the target. Afterwards you can
see the set reserve values in the tab 'POUs' of the dialog 'Resource: Resource_name' (for detailed
information about this dialog please refer to the related topics list below.
Graphical illustration of the memory reserve usage while patching
The following figure illustrates how the memory reserve is used while patching a POU and how the
reserve size can be set.
The numbers shown in the figure have the following meaning:
1
2

The default memory reserve size of each new inserted POU is defined in the dialog 'Data
Area'.
Using the POU properties dialog the default reserve size can be changed for each POU
individually. The equation for calculating the required size is shown at the bottom of the figure.
In our example the reserve is changed for the program POU 'Main', because two function

How to compile a project

3
4

Developing a project using 'Patch POU'

block calls (FB1 and FB2) are to be patched.


Patch of the function block call FB1 in the POU 'Main'. The FB1 user data as well as the FB1
reserve are stored in the 'Main' reserve.
Patch of the function block call FB2 in the POU 'Main'. The FB2 user data as well as the FB2
reserve are stored in the 'Main' reserve.

Developing a project using 'Patch POU'


In some cases it may be more comfortable to develop a project using the command 'Patch POU'
instead of 'Make'.
However, the following conditions must be met:
The structure of a project including the used (empty) Program, FB and FU POUs and of
course the input/output parameters of each POU are already defined.
The raw project was compiled using 'Make', downloaded to the target and a cold start was
performed.
When patching, the system stores the user data of the patched POU in the memory
reserve defined for this POU. The memory reserve size of the POU to be patched must be

How to compile a project

Developing a project using 'Patch POU'

large enough. If there is not enough reserve available, an error message appears and the
patch process is aborted. If it is required to increase the reserve size, the command 'Patch
POU' can not be applied. In this case you have to use 'Make' to compile the changed
project.
If all conditions are met you can replenish the raw program (i.e. program shell) by editing the
various POU code worksheets and patch them to the PLC program which is already running on the
target.
This is possible due to the following features:
IEC FB instances can be patched with no restrictions.
An user FB call can be patched if an instance of this user FB is already declared in the
variables worksheet of any POU. It is not necessary to use the instance in a code
worksheet before patching.
How to insert and patch a new User FB into a project
Insert a new FB POU in the project tree but don't edit the code worksheet.
In the variables worksheet of the FB POU declare each input and output parameter, which
will be used within this FB later.
Note: Be careful when planning and declaring these FB parameters, because they can
not be changed later using the 'Patch POU' command.
(Instead of patching you then have to 'Make' the project, stop the PLC and start a new
download.)
Close both, the FB variables worksheet and the empty code worksheet.
Open the variables worksheet of the POU, in which the new FB should be called later.
Insert a new line and declare the new FB instance.
It is recommended to use the instance name 'FB_name_1', because this is the instance
name, which the system will later propose when inserting the FB instance in the code
worksheet.
Choose the type 'FB_name' and close the variables worksheet.
Make sure that the memory reserve of the POU which calls the user FB is large enough to
patch the FB user data.
For displaying the current reserve size you can use the tab 'POUs' of the dialog
'Resource: Resource_name' (for detailed information about this dialog please refer to the
related topics list below).
For changing the reserve size open the tab 'Type' of the POU properties dialog (context
menu item 'Properties..' of the POU icon in the project tree).
Note: When changing the reserve size afterwards, patching is no longer possible. After
each modification of the reserve size 'Make' must be used.
Compile the project using 'Make'. A warning appears in the message window for each new
declared input/output variable and FB instance declaration, because these
variables/instances are not yet used in the project.

10

How to compile a project

Developing a project using 'Patch POU'

Download the project to the PLC and perform a cold start.


Now, that the new user FB is once downloaded to the target you can edit the empty FB
code worksheet as well as the function block call(s).
Keep in mind, that the already declared input/output variables must not be changed. If it is
necessary to modify these FB parameters you have to compile the project using 'Make'
and initiate the download manually.
Compile the changes using 'Patch POU'.
The procedure above describes the steps to patch a user FB. In addition to that, it is possible to
develop an entire project this way.
Basic steps for developing a project using 'Patch POU'
First you have to create a project shell. This raw project must contain all POUs you will
need.
For each POU, all input and output variables must be declared. This means, that the
program shell has already fixed "interfaces" between the different POUs. This is
necessary because variables with the usage 'VAR_INPUT', 'VAR_OUTPUT' and
'VAR_IN_OUT' can not be patched.
Then an instance for each user FB must be declared in the variables worksheet of a
program POU as described above.
Compile the raw project using 'Make', download it to the target and initiate a PLC cold
start.
Now the conditions are created, which make it possible to replenish the empty POUs in
the project with code, to insert the calls of the user FBs into the code, etc.
While editing the code, some rules and restrictions have to be obeyed!
The edited POUs can be compiled and downloaded without stopping the PLC using the
command 'Patch POU'.
Use 'Make' after 'Patch POU' failed
If the 'Patch POU' command fails, i.e. errors are reported in the message window, because one of
the rules/restrictions was not obeyed while patching or there is not enough memory reserve
available, you always have to compile the project using 'Make' and initiate a new download. When
compiling with 'Make' the data memory in the PLC is assigned newly, i.e. the reserve memory used
for earlier patches is released.
Inserting and patching a new function into a project
For functions the procedure described above is not applicable.
Here it must be decided between IEC defined functions and user defined/library functions:
User defined functions and library functions can only be patched if they are used (i.e. called) at
least one time in any POU of the project, which is already compiled using 'Make' and is running on
the target.
IEC defined functions can be patched even if they are not already used.

11

How to compile a project

IEC defined FUs and FBs

IEC defined FUs and FBs which can be patched without previous usage
This topic provides a list of all IEC defined functions and function blocks, which can be patched,
even if they are not already used in the current project / resource.
Further information can be found in the sections Rules concerning functions and Rules
concerning FBs of the topic Rules and restrictions for patching POUs.
Type conversion functions
Function
REAL_TO_STRING
SINT_TO_STRING
INT_TO_STRING
DINT_TO_STRING
TIME_TO_STRING
BYTE_TO_STRING
WORD_TO_STRING
DWORD_TO_STRING
BOOL_TO_BYTE
BOOL_TO_WORD
BOOL_TO_DWORD
BOOL_TO_SINT
BOOL_TO_INT
BOOL_TO_DINT
BOOL_TO_USINT
BOOL_TO_UINT
BOOL_TO_UDINT
BOOL_TO_REAL
BYTE_TO_BOOL
BYTE_TO_WORD
BYTE_TO_DWORD
BYTE_TO_SINT
BYTE_TO_INT
BYTE_TO_DINT
BYTE_TO_USINT
BYTE_TO_UINT
BYTE_TO_UDINT
BYTE_TO_REAL
DINT_TO_BOOL
DINT_TO_BYTE
DINT_TO_WORD
DINT_TO_DWORD
DINT_TO_SINT

Short description
Converts REAL to STRING
Converts SINT to STRING
Converts INT to STRING
Converts DINT to STRING
Converts TIME to STRING
Converts BYTE to STRING
Converts WORD to STRING
Converts DWORD to STRING
Converts BOOL to BYTE
Converts BOOL to WORD
Converts BOOL to DWORD
Converts BOOL to SINT
Converts BOOL to INT
Converts BOOL to DINT
Converts BOOL to USINT
Converts BOOL to UINT
Converts BOOL to UDINT
Converts BOOL to REAL
Converts BYTE to BOOL
Converts BYTE to WORD
Converts BYTE to DWORD
Converts BYTE to SINT
Converts BYTE to INT
Converts BYTE to DINT
Converts BYTE to USINT
Converts BYTE to UINT
Converts BYTE to UDINT
Converts BYTE to REAL
Converts DINT to BOOL
Converts DINT to BYTE
Converts DINT to WORD
Converts DINT to DWORD
Converts DINT to SINT

12

How to compile a project

DINT_TO_INT
DINT_TO_REAL
DINT_TO_TIME
DINT_TO_USINT
DINT_TO_UINT
DINT_TO_UDINT
DWORD_TO_BOOL
DWORD_TO_BYTE
DWORD_TO_WORD
DWORD_TO_SINT
DWORD_TO_INT
DWORD_TO_DINT
DWORD_TO_REAL
DWORD_TO_USINT
DWORD_TO_UINT
DWORD_TO_UDINT
INT_TO_BOOL
INT_TO_BYTE
INT_TO_WORD
INT_TO_DWORD
INT_TO_SINT
INT_TO_DINT
INT_TO_REAL
INT_TO_USINT
INT_TO_UINT
INT_TO_UDINT
REAL_TO_BOOL
REAL_TO_BYTE
REAL_TO_WORD
REAL_TO_DWORD
REAL_TO_SINT
REAL_TO_INT
REAL_TO_DINT
REAL_TO_USINT
REAL_TO_UINT
REAL_TO_UDINT
SINT_TO_BOOL
SINT_TO_BYTE
SINT_TO_WORD
SINT_TO_DWORD
SINT_TO_INT
SINT_TO_DINT
SINT_TO_REAL

IEC defined FUs and FBs

Converts DINT to INT


Converts DINT to REAL
Converts DINT to TIME
Converts DINT to USINT
Converts DINT to UINT
Converts DINT to UDINT
Converts DWORD to BOOL
Converts DWORD to BYTE
Converts DWORD to WORD
Converts DWORD to SINT
Converts DWORD to INT
Converts DWORD to DINT
Converts DWORD to REAL
Converts DWORD to USINT
Converts DWORD to UINT
Converts DWORD to UDINT
Converts INT to BOOL
Converts INT to BYTE
Converts INT to WORD
Converts INT to DWORD
Converts INT to SINT
Converts INT to DINT
Converts INT to REAL
Converts INT to USINT
Converts INT to UINT
Converts INT to UDINT
Converts REAL to BOOL
Converts REAL to BYTE
Converts REAL to WORD
Converts REAL to DWORD
Converts REAL to SINT
Converts REAL to INT
Converts REAL to DINT
Converts REAL to USINT
Converts REAL to UINT
Converts REAL to UDINT
Converts SINT to BOOL
Converts SINT to BYTE
Converts SINT to WORD
Converts SINT to DWORD
Converts SINT to INT
Converts SINT to DINT
Converts SINT to REAL

13

How to compile a project

SINT_TO_USINT
SINT_TO_UINT
SINT_TO_UDINT
STRING_TO_BYTE
STRING_TO_DINT
STRING_TO_DWORD
STRING_TO_INT
STRING_TO_REAL
STRING_TO_SINT
STRING_TO_TIME
STRING_TO_UDINT
STRING_TO_UINT
STRING_TO_USINT
STRING_TO_WORD
TIME_TO_DINT
TRUNC_INT
TRUNC_DINT
TRUNC_SINT
USINT_TO_BOOL
UINT_TO_BOOL
UDINT_TO_BOOL
USINT_TO_BYTE
UINT_TO_BYTE
UDINT_TO_BYTE
USINT_TO_DINT
UINT_TO_DINT
UDINT_TO_DINT
USINT_TO_DWORD
UINT_TO_DWORD
UDINT_TO_DWORD
USINT_TO_INT
UINT_TO_INT
UDINT_TO_INT
USINT_TO_REAL
UINT_TO_REAL
UDINT_TO_REAL
USINT_TO_SINT
UINT_TO_SINT
UDINT_TO_SINT
UDINT_TO_UINT
UDINT_TO_USINT
UINT_TO_UDINT
UINT_TO_USINT

IEC defined FUs and FBs

Converts SINT to USINT


Converts SINT to UINT
Converts SINT to UDINT
Converts STRING to BYTE
Converts STRING to DINT
Converts STRING to DWORD
Converts STRING to INT
Converts STRING to REAL
Converts STRING to SINT
Converts STRING to TIME
Converts STRING to UDINT
Converts STRING to UINT
Converts STRING to USINT
Converts STRING to WORD
Converts TIME to DINT
Truncates REAL to INT
Truncates REAL to DINT
Truncates REAL to SINT
Converts USINT to BOOL
Converts UINT to BOOL
Converts UDINT to BOOL
Converts USINT to BYTE
Converts UINT to BYTE
Converts UDINT to BYTE
Converts USINT to DINT
Converts UINT to DINT
Converts UDINT to DINT
Converts USINT to DWORD
Converts UINT to DWORD
Converts UDINT to DWORD
Converts USINT to INT
Converts UINT to INT
Converts UDINT to INT
Converts USINT to REAL
Converts UINT to REAL
Converts UDINT to REAL
Converts USINT to SINT
Converts UINT to SINT
Converts UDINT to SINT
Converts UDINT to UINT
Converts UDINT to USINT
Converts UINT to UDINT
Converts UINT to USINT

14

How to compile a project

USINT_TO_UDINT
UDINT_TO_STRING
UINT_TO_STRING
USINT_TO_STRING
USINT_TO_UINT
USINT_TO_WORD
UINT_TO_WORD
UDINT_TO_WORD
WORD_TO_BOOL
WORD_TO_BYTE
WORD_TO_DWORD
WORD_TO_SINT
WORD_TO_INT
WORD_TO_DINT
WORD_TO_REAL
WORD_TO_USINT
WORD_TO_UINT
WORD_TO_UDINT

IEC defined FUs and FBs

Converts USINT to UDINT


Converts UDINT to STRING
Converts UINT to STRING
Converts USINT to STRING
Converts USINT to UINT
Converts USINT to WORD
Converts UINT to WORD
Converts UDINT to WORD
Converts WORD to BOOL
Converts WORD to BYTE
Converts WORD to DWORD
Converts WORD to SINT
Converts WORD to INT
Converts WORD to DINT
Converts WORD to REAL
Converts WORD to USINT
Converts WORD to UINT
Converts WORD to UDINT

Numerical functions
Function
ABS
ACOS
ASIN
ATAN
COS
EXP
LN
LOG
SIN
SQRT
TAN

Short description
Truncation of Sign
Arc Cosine
Arc Sine
Arc Tangent
Cosine
Exponent
Natural Logarithm
Base10 Logarithm
Sine
Square Root
Tangent

Arithmetic functions
Function
ADD
ADD_T_T
DIV
DIV_T_AI
DIV_T_AN

Short description
Addition
TIMEAddition
Division
TIME by ANY_INT Division
TIME by ANY_NUM Division

15

How to compile a project

DIV_T_R
EXPT
MOD
MOVE
MUL
MUL_T_AN
MUL_T_AI
MUL_T_R
NEG
SUB
SUB_T_T

IEC defined FUs and FBs

TIME by REAL Division


Exponentiation
Modulo Divison
Assigns Value
Multiplication
TIME with ANY_NUM Multiplication
TIME with ANY_INT Multiplication
TIME with REAL Multiplication
Inversion of Sign
Subtraction
TIMESubtraction

Bitwise Boolean functions


Function
AND
NOT
OR
XOR

Short description
Bitwise AND
Complement
Bitwise OR
Bitwise Exclusive OR

Bitstring functions
Function
ROL
ROR
SHL
SHR

Short description
Rotate Left
Rotate Right
Shift Left
Shift Right

Selection functions
Function
LIMIT
MAX
MIN
SEL

Short description
Limit Selection
Maximum
Minimum
Binary Selection

Comparison functions
Function
EQ
GE

Short description
Equal: =
Greater Than Equal: >=

16

How to compile a project

GT
LE
LT
NE

IEC defined FUs and FBs

Greater Than: >


Less Than Equal: <=
Less Than: <
Not Equal: <>

Character string functions


Function
CONCAT
DELETE
EQ_STRING
FIND
GE_STRING
GT_STRING
INSERT
LE_STRING
LEFT
LEN
LIMIT_STRING
LT_STRING
MAX_STRING
MID
MIN_STRING
NE_STRING
REPLACE
RIGHT
SEL_STRING

Short description
Concatenates Strings
Deletes Substring
Equal STRING: =
Searches Substring
Greater Than Equal STRING: >=
Greater Than STRING: >
Inserts Characters
Less Than Equal STRING: <=
Leftmost Characters
String Length
Limit Selection of Strings
Less Than STRING: <
Maximum of Strings
Middle Characters
Minimum of Strings
Not Equal STRING: <>
Replaces Characters
Rightmost Characters
Binary Selection of Strings

Bistable function blocks


Function block
SR
RS

Short description
Set Dominant
Reset Dominant

Edge detection function blocks


Function block
F_TRIG
R_TRIG

Short description
Falling Edge Detection
Rising Edge Detection

Counter function blocks

17

How to compile a project

Function block
CTU
CTD
CTUD

Patching a POU when working with several resources

Short description
Counter Up
Counter Down
Counter Up/Down

Timer function blocks


Function block
TP
TON
TOF

Short description
Pulse
Timer OnDelay
Timer OffDelay

Patching a POU when working with several resources


If a project runs on several resources (i.e. there is one program instance per resource), the
following has to be observed when patching a POU:
Assuming that the PLC program is currently executed on several resources, one online
worksheet can be opened for each instance (resource).
Since you have to switch a worksheet offline in order to change the code and patch the POU, the
patch command can only be applied to one instance at the same time, i.e. to this specific instance
for which you have switched the worksheet into offline mode.
As a result of this operation, the patched program instance differs from all other instances.
Additionally these resources for which the code has not yet been patched are executing the
"old/unchanged" code, which is no longer diplayed in the Logical POU code worksheet.
When switching such a worksheet into online mode, the online worksheet contains the new code
(which has already been patched for one instance) although the related resource executes the
origin notpatched code. Due to this, the online values might be incorrect.
For that reason, each instance (i.e. resource) has to be patched separately by switching the
corresponding online worksheet offline, changing the code and executing the patch POU
command.
If the same code changes should be applied to all resources, these changes are already contained
in the code body worksheet within the Logical POU after patching the first instance. In order to
execute the command 'Patch POU' you can perform a change with no influence on the code
execution, such as moving an object in the worksheet. Having done this, the menu item 'Patch
POU' becomes active and can be executed.

Compile Worksheet
Using the menu item/icon 'Compile Worksheet' can be used to compile a worksheet in order to
check the syntax during editing. Choosing this command means that syntax errors are going to be
detected by the compiler.

18

How to compile a project

Rebuild Project

Using 'Compile Worksheet' no code is generated!


When closing or saving a worksheet, the system automatically compiles this worksheet.
Additionally the variables worksheet is compiled.
Due to this automatic compilation each user defined function or function block is available in the
Edit Wizard immediately after saving the corresponding worksheet.
How to compile a worksheet:
Make sure that the worksheet to be compiled is the active window or mark the
corresponding worksheet icon in the project tree.
Click on the icon 'Compile Worksheet' in the toolbar.
The compilation process is started and its progress is displayed in the message window.
Detected errors and warnings can be displayed in the corresponding sheets of the
message window.
How to stop the compiler:
Click on the icon 'Stop Compile' in the toolbar to abort the compilation process.

Rebuild Project
'Rebuild Project' is used to compile the whole project for the first time or if an announced user
library has been changed.
Using 'Rebuild Project' all worksheets are going to be compiled and linked. Detected errors and
warnings are displayed in the message window. After the syntax checking the IEC code as well as
the PLC specific code is generated automatically. The project is then ready for downloading to the
PLC.
The command 'Rebuild Project' should only be used if 'Make' generates compiling errors or you
have unzipped your project without the frontend code.
How to rebuild a project:
Select the menu item 'Rebuild Project' in the submenu 'Build'.
The compilation process is started and its progress is displayed in the message window.
Detected errors and warnings can be displayed in the corresponding sheets of the
message window.
How to stop the compiler:
Click on the icon 'Stop Compile' in the toolbar to abort the compilation process.

19

How to compile a project

Using the message window to display and correct errors and warnings

Using the message window to display and correct errors and warnings
In most cases while compiling for a first time the different compilers detect programming errors,
such as a variable name which has been used twice or typing errors.
In those cases a message appears in the sheet 'Build' of the message window, announcing the
number of detected errors and warnings.
If the message window is closed when starting the compilation it appears automatically.
To display the detected errors, click on the tab 'Errors' in the message window. The error list is then
shown in the message window.
In order to display the list of warnings, just click on the tab 'Warnings'.
In most cases double clicking on a displayed error/warning will open directly the worksheet where
the programming error/the reason for the warning is occurred. The corresponding line or the object
is marked. You can also mark the error and press <F1> to get the corresponding help topic with
information about the cause of the error and what steps have to be done now.
Having corrected the first error you can press <CTRL> + <F12> to go directly to the worksheet with
the next error.

20

You might also like