SoMachine HVAC Programming Guide
SoMachine HVAC Programming Guide
Programming Guide
09/2014
Quick Start
Developer
EIO0000002036 00
The information provided in this documentation contains general descriptions and/or technical characte-
ristics of the performance of the products contained herein. This documentation is not intended as a
substitute for and is not to be used for determining suitability or reliability of these products for specific
user applications. It is the duty of any such user or integrator to perform the appropriate and complete
risk analysis, evaluation and testing of the products with respect to the relevant specific application or use
thereof. Neither Schneider Electric nor any of its affiliates or subsidiaries shall be responsible or liable for
misuse of the information contained herein.
If you have any suggestions for improvements or amendments or have found errors in this publication,
please notify us.
No part of this document may be reproduced in any form or by any means, electronic or mechanical,
including photocopying, without express written permission of Schneider Electric.
All pertinent state, regional, and local safety regulations must be observed when installing and using this
product. For reasons of safety and to help ensure compliance with documented system data, only the
manufacturer should perform repairs to components.
When devices are used for applications with technical safety requirements, the relevant instructions must
be followed.
Failure to use Schneider Electric software or approved software with our hardware products may result
in injury, harm, or improper operating results.
2 EIO0000002036 09/2014
TABLE OF CONTENTS
PART 1. CONNECTION.................................................................................................................. 7
PART 2. APPLICATION................................................................................................................. 59
PART 3. USER INTERFACE......................................................................................................... 301
PART 4. SIMULATION.................................................................................................................. 446
EIO0000002036 09/2014 3
SAFETY INFORMATION
Important Information
Read these instructions carefully, and look at the equipment to become familiar with the device before trying to install, operate, or
maintain it. The following special messages may appear throughout this documentation or on the equipment to inform of potential
hazards or to call attention to information that clarifies or simplifies a procedure.
The addition of this symbol to a Danger safety label indicates that an electrical hazard exists, which will result
in personal injury if the instructions are not followed.
This is the safety alert symbol. It is used to alert you to potential personal injury hazards.
Obey all safety messages that follow this symbol to avoid possible injury or death.
DANGER
DANGER indicates an imminently hazardous situation which, if not avoided, results in death or serious injury.
WARNING
WARNING indicates a potentially hazardous situation which, if not avoided, can result in death or serious injury.
CAUTION
CAUTION indicates a potentially hazardous situation which, if not avoided, can result in minor or moderate injury.
NOTICE
NOTICE is used to address practices not related to physical injury.
PLEASE NOTE
Electrical equipment should be installed, operated, serviced, and maintained only by qualified personnel.
No responsibility is assumed by Schneider Electric for any consequences arising out of the use of this material.
A qualified person is one who has skills and knowledge related to the construction and operation of electrical equipment and its
installation, and has received safety training to recognize and avoid the hazards involved.
4 EIO0000002036 09/2014
ABOUT THE BOOK
Document Scope
This document is aimed at designers and developers and requires a knowledge of one or more IEC61131-3 stan-
dard programming languages and is designed to provide a first-level overview of the installation, functions and use
of SoMachine HVAC.
Validity Note
This document is valid for SoMachine HVAC.
Related Documents
Title of Documentation Reference Document Code
Modicon M171 Performance Logic Controllers Hardware User Manual EIO0000002030 (ENG)
Modicon M171 Optimized Logic Controllers Hardware User Manual EIO0000002032 (ENG)
SoMachine HVAC software Quick Start EIO0000002035 (ENG)
You can download these technical publications and other technical information from our website at:
www.schneider-electric.com
5 EIO0000002036 09/2014
Product Related Information
WARNING
LOSS OF CONTROL
• The designer of any control scheme must consider the potential failure modes of control paths and, for certain critical
control functions, provide a means to achieve a safe state during and after a path failure. Examples of critical control
functions are emergency stop and overtravel stop, power outage and restart.
• Separate or redundant control paths must be provided for critical control functions.
• System control paths may include communication links. Consideration must be given to the implications of unantici-
pated transmission delays or failures of the link.
• Observe all accident prevention regulations and local safety guidelines.(1)
• Each implementation of this equipment must be individually and thoroughly tested for proper operation before being
placed into service.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
(1) For additional information, refer to NEMA ICS 1.1 (latest edition), “Safety Guidelines for the Application, Installation, and
Maintenance of Solid State Control” and to NEMA ICS 7.1 (latest edition), “Safety Standards for Construction and Guide
for Selection, Installation and Operation of Adjustable-Speed Drive Systems” or their equivalent governing your particular
location.
WARNING
UNINTENDED EQUIPMENT OPERATION
• Only use software approved by Schneider Electric for use with this equipment.
• Update your application program every time you change the physical hardware configuration.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
6 EIO0000002036 09/2014
SoMachine HVAC - Connection
Contents
1. Basic concepts 13
3. Managing projects 23
EIO0000002036 09/2014 7
SoMachine HVAC - Connection
5. Technical reference 53
8 EIO0000002036 09/2014
SoMachine HVAC - Connection
5.2.1 Overview 56
5.2.2 Data types 56
5.2.3 Function codes 57
5.2.4 Error detection and CRC 57
5.2.5 Protocol versions 57
EIO0000002036 09/2014 9
SoMachine HVAC - Connection
SAFETY INFORMATION
Important Information
Read these instructions carefully, and look at the equipment to become familiar with the device
before trying to install, operate, or maintain it. The following special messages may appear
throughout this documentation or on the equipment to inform of potential hazards or to call
attention to information that clarifies or simplifies a procedure.
The addition of this symbol to a Danger safety label indicates that an electrical hazard
exists, which will result in personal injury if the instructions are not followed.
This is the safety alert symbol. It is used to alert you to potential personal injury
hazards.
Obey all safety messages that follow this symbol to avoid possible injury or death.
DANGER
DANGER indicates an imminently hazardous situation which, if not avoided, results in death
or serious injury.
WARNING
WARNING indicates a potentially hazardous situation which, if not avoided, can result in
death or serious injury.
CAUTION
CAUTION indicates a potentially hazardous situation which, if not avoided, can result in
minor or moderate injury.
NOTICE
NOTICE is used to address practices not related to physical injury.
PLEASE NOTE
Electrical equipment should be installed, operated, serviced, and maintained only by qualified
personnel.
No responsibility is assumed by Schneider Electric for any consequences arising out of the use of
this material.
You can download these technical publications and other technical information from our website at:
www.schneider-electric.com
10 EIO0000002036 09/2014
SoMachine HVAC - Connection
WARNING
LOSS OF CONTROL
• The designer of any control scheme must consider the potential failure modes of control
paths and, for certain critical control functions, provide a means to achieve a safe state
during and after a path failure. Examples of critical control functions are emergency stop and
overtravel stop, power outage and restart.
• Separate or redundant control paths must be provided for critical control functions.
• System control paths may include communication links. Consideration must be given to the
implications of unanticipated transmission delays or failures of the link.
• Observe all accident prevention regulations and local safety guidelines.(1)
• Each implementation of this equipment must be individually and thoroughly tested for proper
operation before being placed into service.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
(1) For additional information, refer to NEMA ICS 1.1 (latest edition), “Safety Guidelines for the
Application, Installation, and Maintenance of Solid State Control” and to NEMA ICS 7.1 (latest
edition), “Safety Standards for Construction and Guide for Selection, Installation and Operation
of Adjustable-Speed Drive Systems” or their equivalent governing your particular location.
WARNING
UNINTENDED EQUIPMENT OPERATION
• Only use software approved by Schneider Electric for use with this equipment.
• Update your application program every time you change the physical hardware configuration.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
EIO0000002036 09/2014 11
SoMachine HVAC - Connection
12 EIO0000002036 09/2014
SoMachine HVAC - Connection
1. BASIC CONCEPTS
EIO0000002036 09/2014 13
SoMachine HVAC - Connection
14 EIO0000002036 09/2014
SoMachine HVAC - Connection
EIO0000002036 09/2014 15
SoMachine HVAC - Connection
In some situations (for example compilation errors) you can double-click on the error in
the output window and you will be brought just at the source of the error, that will be
highlighted with a red box.
16 EIO0000002036 09/2014
SoMachine HVAC - Connection
EIO0000002036 09/2014 17
SoMachine HVAC - Connection
The Project window shows the elements of the current project in the form a tree, making
easy to see the master/slave and parent/child relationship between them.
Click on the + and - icons next to each item (or press to corresponding keys) to expand
or collapse each item; or press the * key to expand all children of the current item in
depth.
Left-clicking an item opens its configuration page in the Main window (if there is one),
and shows in the Catalog window all objects that can be inserted under the current item
(if there are).
Right-clicking an item selects it and opens its context menu (if there is one), showing
some operations you can do on the current tree item, like Add/Remove/Copy/Paste and
so on.
Pressing the Delete key also triggers the Remove command.
A single left-click of the item name (or the F2 key) triggers the in-place rename of the
object (if it supports it).
This window shows a list of objects that can be inserted in the project under the currently
selected item in the Project window; selecting a different item in Project window re-
freshes this list.
By default, only the “major” version number of each device is shown, and the highest
minor version number is implicitly selected; for example, if three different versions of the
same device are present in the catalog (10.0, 10.1, 10.2), the Catalog will show only the
10 (without the minor version) but will select the 10.2 (the highest).
This behavior can be changed by selecting the Show all versions in catalog option in
18 EIO0000002036 09/2014
SoMachine HVAC - Connection
the Options menu in the menu bar; if you activate this option ALL the available versions
(even the older ones) will be shown in the Catalog and you will have the chance to manu-
ally select and add in the project older versions of each device.
To add an object, drag and drop it from the Catalog window to the Project window, over
the currently selected item (a + icon will appear); it will be added as its last child.
Another way to add an object is to right-click an item in the Project window and choose
Add; a pop-up window will appear, showing the same list of the Catalog window. In this
way you can add an object without having the Catalog visible, useful for example if you
are working with a very small screen.
This window also has a Show all versions option, that behaves like the flag in the Op-
tions menu described before.
EIO0000002036 09/2014 19
SoMachine HVAC - Connection
20 EIO0000002036 09/2014
SoMachine HVAC - Connection
Shift key or by moving the toolbar next to the vertical border of any window.
You can also make the toolbar float, either by pressing the CTRL key or by moving the
toolbar away from any window border.
EIO0000002036 09/2014 21
SoMachine HVAC - Connection
You can make the tool window float, by double-clicking on its name, or by pressing the
CTRL key, or by moving the tool window away from the main window borders.
A tool window can be resized by clicking-and-dragging on its border until the desired size
is reached.
22 EIO0000002036 09/2014
SoMachine HVAC - Connection
3. MANAGING PROJECTS
In the second tab of the Main page, named Networks list, you can manage a list of all
the “virtual networks” to be used in your project with the devices that will be connected
with Binding I/O.
For each network you have to choose a name, the protocol to use (CANopen or Ethernet/
ModbusTCP) and symbolic color to show as a small circle in the project tree; each device
connected to the same network will be shown with the same color.
While by default you already have two predefined networks (one CANopen and one Ether-
net) you can add any number of other networks, to build complex scenarios.
EIO0000002036 09/2014 23
SoMachine HVAC - Connection
In the above example, the folder C:\Projects\Example1\ will be created and the project
will be saved as C:\Projects\Example1\Example1.CON.
If you want to save the project with another name, you can choose the command File /
Save as... and specify a new name and location for the .CON file.
IMPORTANT: only the .CON project file is saved, no folder is created nor the linked com-
ponents (PLC or HMI) are copied or moved.
24 EIO0000002036 09/2014
SoMachine HVAC - Connection
When you press the Build project button in the toolbar (or the F7 key), Connection will
examine the current project and will:
-- Print in the output window any error it found in the checking process; you can then
double-click the error to see the source position.
-- Generate specific configuration files for each device (for example CONNEC.PAR for M171
Perf. Display, with Field and Binding configuration settings).
-- Generate a single .CFN file to be used in Device; this file will contain all the sub-com-
ponents of the current project (devices configurations, PLC applications and HMI pages)
all contained inside the CFN, in a redistributable form; this file will have the same name
of the .CON project and will reside in the same folder.
Choosing the Tools / Open with Device command, Device will be launched with the
generated CFN file opened.
IMPORTANT: before executing compilation, please make sure that all the PLC and HMI
sub-project have been built with the respective tools (Application and UserInterface). In
fact Connection will include in the CFN the last compilation output of each sub-compo-
nent, so you have to build them BEFORE compiling the Connection project.
NOTE: be sure to eliminate all compiler errors and warnings before downloading your
application to your controller or other device.
EIO0000002036 09/2014 25
SoMachine HVAC - Connection
26 EIO0000002036 09/2014
SoMachine HVAC - Connection
It can run both a PLC application and HMI pages on the same CPU and has a lot of con-
nectivity capabilities, in terms of on-board connectors and may optional plug-ins.
EIO0000002036 09/2014 27
SoMachine HVAC - Connection
4.1.1 PLC
This tree item lets you create or associate a PLC project to the M171 Perf. Display; the
associated page shows the relative path of the associated PPJS file (Application project).
If you do a right-click on the PLC, a pop-up menu will appear with the command Open
with Application; if the device has no associated project, you will be prompted for the
name to give to the new application (by default, the name of the device with the _PLC
suffix).
Otherwise if a PLC project has already been associated, Application will be launched and
the existing PLC project opened.
If you want to manually associate an existing PLC project to the device, you can choose
between a project on the disk in a particular folder or choosing from the local catalog of
applications.
If a PLC project has been associated, the Export to catalog command in the pop-up
menu will be enabled, allowing you to export the application in the catalog for further
reuse.
4.1.2 HMI
This tree item lets you create or associate a HMI project to the M171 Perf. Display; the as-
sociated page shows the relative path of the associated PAJX file (UserInterface project).
28 EIO0000002036 09/2014
SoMachine HVAC - Connection
If you do a right-click on the HMI, a pop-up menu will appear with the command Open
with UserInterface; if the device has no associated project, you will be prompted for
the name to give to the new application (by default, the name of the device with the _HMI
suffix).
Otherwise if a HMI project has already been associated, UserInterface will be launched
and the existing HMI project opened.
If you want to manually associate an existing HMI project to the device, you can choose
between a project on the disk in a particular folder or choosing from the local catalog of
applications.
If a HMI project has been associated, the Export to catalog command in the pop-up
menu will be enabled, allowing you to export the application in the catalog for further
reuse.
If in your HMI pages project you have imported one or more parameter map, you can
configure the real address of the remote device here.
In fact by default any parameter map is considered as “local”, and if you want to view
in your page any parameter of a remote device you have to insert here (and so outside
and independently from UserInterface) the used protocol (Modbus RTU, Modbus TCP or
CANopen) and address.
In this way you can design the HMI pages in UserInterface as they were “local” and then
later change the real address of the remote device without even recompiling the PAJX
project (the change is made only in Connection).
To load or update the list of remote devices (parameter maps) inserted in the UserInter-
face project, press the Reload device list button; please remember to build the PAJX
project with UserInterface to have an updated list before doing this.
4.1.3 CANOPEN
M171 Perf. Display has one on-board CANopen port, plus another one available as an ex-
ternal plug-in. Each port can be configured as Not used (disabled), Master (field), Slave
(binding).
4.1.3.1 FIELD
When you configure the CANopen port as Master the M171 Perf. Display will act as a
CANopen master on this port, so you can attach any number of CANopen slave devices
here and exchange data with Field I/O.
EIO0000002036 09/2014 29
SoMachine HVAC - Connection
For a CANopen master port, you have to configure (see 5.1 for further information):
-- Baud rate used in this CANopen network (in Kb/s).
-- Node ID for the master (1..127), by default is 127.
-- Heartbeat time in ms, by default 0 (heartbeat producer disabled): it is the master pro-
ducer heartbeat time.
-- The SYNC COBID to use, by default 128.
-- The period for the SYNC cycle in ms, by default 0 (sync disabled).
Example of possible slaves are the Modicon M171 Perf. Expansion 27 I/Os module (see
4.5) or generic custom devices imported from their EDS files (CAN custom, see 4.4).
After you added and configured the various CANopen slaves, you can establish the “link”
between the remote objects of the slave and the internal PLC variables to read or write.
The set of PLC objects you can read or write is made of:
-- Status variables, created with Application (not BIOS).
-- Field variables, created with Application.
4.1.3.2 BINDING
When you configure the CANopen port as Slave the M171 Perf. Display will act as a CANo-
pen slave on this port, so you can exchange data with Binding I/O with other M171 Perf.
Display devices on the CANopen network.
30 EIO0000002036 09/2014
SoMachine HVAC - Connection
EIO0000002036 09/2014 31
SoMachine HVAC - Connection
Once you inserted the remote objects to read, you have to assign the local destination
locations to write to, choosing with the list in the Dest parameter column or manually
inserting the Address.
IMPORTANT: please remember to rebuild the PLC project with Application to see an up-
dated list of public objects here.
4.1.4 RS485
M171 Perf. Display has one on-board RS485 port, plus another one available as an exter-
nal plug-in. Each port can be configured as Not used (disabled) or Master (field).
4.1.4.1 FIELD
When you configure the RS485 port as Master the M171 Perf. Display will act as a Mod-
busRTU master on this port, so you can attach any number of Modbus slave devices here
and exchange data with Field I/O.
32 EIO0000002036 09/2014
SoMachine HVAC - Connection
Example of possible slaves are the Modicon M171 Perf. Expansion 27 I/Os module (see
4.5), Generic Modbus devices (see 4.2), or custom devices created with the ModbusCus-
tomEditor tool (see 4.3).
After you added and configured the various Modbus slaves, you can establish the “link”
between the remote objects of the slave and the internal PLC variables to read or write.
The set of PLC objects you can read or write is made of:
-- Status variables, created with Application (not BIOS).
-- Field variables, created with Application.
4.1.5 ETHERNET
M171 Perf. Display can have one Ethernet port, available as an external plug-in. The port
always acts a Modbus TCP slave, and additionally can be configured also as Master (bind-
ing).
4.1.5.1 BINDING
EIO0000002036 09/2014 33
SoMachine HVAC - Connection
Please refer to 4.1 - M171 Perf. Display chapter for a full description of all M171 Perf. Blind
features.
Usage example
In this scenario M171 Perf. Blind_1 device has a PLC project and has an HMI Remote proj-
ect that makes available M171 Perf. Blind pages for linked keyboards.
M171 Perf. Blind HMI Remote pages can be remoted and shown by Display for M171
34 EIO0000002036 09/2014
SoMachine HVAC - Connection
Perf._1 via CANopen field and by M171 Perf. Flush Mounting_1 via Ethernet network.
EIO0000002036 09/2014 35
SoMachine HVAC - Connection
-- Start address: address of the first modbus object to read or write (1..65536).
-- Polling time: the message will be processed with this period (ms); for writing opera-
tions, 0 means to write it only on variation of the value, for reading operations 0 means
maximum speed.
-- Timeout: the operation will be unsuccesful when this time-out expires (ms).
-- Wait before send: this is an additional timeout, to be used with slow slaves that do not
answer if the messages are sent too fast.
Beside the General tab, each different message has a second tab where you can config-
ure the list of objects to read or write.
Using the Add button, insert one row for each Modbus object to read or write, up to 16 ele-
ments; the first row has the address configured in the Start address box in the General
tab, and the other rows increment and follow.
For each row, press the Assign button to choose the PLC object to link and to be read or
written with this Modbus message; you can not leave unassigned rows in the message.
IMPORTANT: please remember to rebuild the PLC project with Application to see an up-
dated list of PLC variables here.
36 EIO0000002036 09/2014
SoMachine HVAC - Connection
EIO0000002036 09/2014 37
SoMachine HVAC - Connection
-- When the device you want to edit is visible in the Catalog window (for example when
a RS485 node is selected and is in Master mode), you can right-click on it and choose
the Edit device command; the ModbusCustomEditor will be launched and the selected
device opened.
38 EIO0000002036 09/2014
SoMachine HVAC - Connection
-- Wait before send: this is an additional timeout, to be used with slow slaves that do
not answer if the messages are sent too fast.
Here you can notice that for Modbus custom the Polling time, Timeout and Wait before
send are generic for the whole device, while for the Generic Modbus you can put specific
different values for each single message. This is because with the Modbus custom the
low-level Modbus messages are automatically calculated and you do not have to worry
about them, but as a side-effect you can not “fine-tune” them, because these settings
are global.
Then, in the Input and Output tabs you can insert one row for each Modbus object to
read or write; press the Add button and choose the parameters to exchange (multi selec-
tion is supported), and use the Assign button to link them to the PLC object to be read
or written to.
Insert in the Input tab the Modbus objects to READ from the Modbus slave (and to put
into PLC variables), and insert in the Output tab the Modbus objects to WRITE to the
Modbus slave (and to get from the PLC variables).
IMPORTANT: please remember to rebuild the PLC project with Application to see an up-
dated list of PLC variables here.
Connection will create the correct Modbus messages analyzing the sequence of addresses
and types; if the addresses are consequent and the types are homogenous, different ob-
jects will be grouped in single messages to optimize the communication.
The maximum number of registers configured with the ModbusCustomEditor is also con-
sidered, along with the maximum number of registers per message of the master (that is
16 for the M171 Perf. Display).
The grouping and generation of the Modbus messages is totally automatic and recalcu-
lated at each compilation, so you do not have to know technical details of the Modbus
protocol.
EIO0000002036 09/2014 39
SoMachine HVAC - Connection
40 EIO0000002036 09/2014
SoMachine HVAC - Connection
In the General tab you can configure (see 5.1 for further information):
-- Node number (1..127).
-- Node guard period in ms (default 200ms), 0 to disable node guard for this slave; if not
zero is the interval of node guarding packets sent by the master to the slave.
-- Life time factor (default 3x), 0 to disable node guard for this slave; if not zero, mul-
tiplied for the Node guarding period is the maximum amount of time the master will
wait for the slave answer of the node guard.
-- Boot time elapsed: this is the maximum amount of time in ms that the master will
wait for the slave to become pre-operational at boot (default 10s), before signaling an
error.
-- Node heartbeat producer time in ms, default is 0 (heartbeat disabled); if not zero
the master will enable the heartbeat error handling check for this node.
-- Node heartbeat consumer time in ms, default is 0 (heartbeat disabled); it is the
maximum amount of time the slave will wait for the heartbeat produced by the master,
before timing out. This should be greater than the Heartbeat time of the master.
EIO0000002036 09/2014 41
SoMachine HVAC - Connection
In this page you can insert a list of objects and values to send to the slave at boot for
configuration purpose, using SDO packets.
Press the Add button, choose the objects to send and then insert their Value in the grid.
Some objects are handled automatically, for example the Transmission type and Event
timer are configured automatically depending on the PDO Tx comm settings and PDO Rx
comm settings in the General tab.
42 EIO0000002036 09/2014
SoMachine HVAC - Connection
In the PDO Tx - Input tab you configure the PDOs (Process Data Object) that the slave
transmits, and so the master will receive in input; in the PDO Rx - Output you configure
the PDOs that the slave receives, and so the master will send in output.
If the CAN custom device was imported with the Dynamic PDO mapping enabled, you will
be able to edit the PDO mapping by adding and removing objects and manually edit the
PDO and Bit columns; otherwise, the Add and Remove buttons will not be available and
you have to use the PDO configuration as-is.
If you check the Split single bits option, the object you choose will be inserted as
splitted single bits to be linked to BOOL variables (that is the default for digital I/O objects
in the DS401 standard).
IMPORTANT: please note that the PDO mapping configuration you enter here is NOT sent
to the device, its only purpose is to match an already configured PDO mapping on the
device.
Then with the Assign button you can link each CAN object with the PLC variable to read
(PDO Tx) or write (PDO Rx).
IMPORTANT: please remember to rebuild the PLC project with Application to see an up-
dated list of PLC variables here.
4.6.1 CANOPEN
Display for M171 Perf. can be connected to M171 Perf. Display or to M171 Perf. Blind in
field mode or in network mode.
EIO0000002036 09/2014 43
SoMachine HVAC - Connection
In this connection mode Display for M171 Perf. has to be considered a slave of M171 Perf.
Display. Display for M171 Perf. will be able to show only the remote pages of the master
device which is linked to.
To configure network in this way select M171 Perf. Display or M171 Perf. Blind and add it
as first level node; then configure its PLC, HMI, and HMI Remote projects normally.
The project associated to M171 Perf. Display_1 - HMI Remote node will be shown by Dis-
play for M171 Perf. device.
Click on CANopen and select Master (for field) option in Mode tab and configure CANopen
settings. Then Display for M171 Perf. device can be selected from Catalog, dragged and
dropped over CANopen node.
Select Display for M171 Perf._1 device child node and adjust network settings.
44 EIO0000002036 09/2014
SoMachine HVAC - Connection
Display for M171 Perf._1 device communicates with M171 Perf. Display_1 using this CAN
nodeID. This node ID will be used for navigating remote pages.
In this connection mode Display for M171 Perf. can be linked to one of the remote de-
vices that are available on the network to navigate HMI Remote pages provided by other
devices.
Using Connection it is possible to do so indicating one of the available HMI Remote device
of the network. Let’s see how with an example.
We have a CANOpen network with M171 Perf. Display_1 and M171 Perf. Blind_1, then add
as first level node Display for M171 Perf._1 to the network taking it from Catalog panel.
Click on CANOpen node of Display for M171 Perf._1 and select Master (for HMI remoting)
node, assign univoque Node ID and select network CANOpen1.
Once linked to the CANopen1 network it is possible to select the HMI remote pages to
navigate with Display for M171 Perf._1.
Click on the device node then click on Add. Window Add HMI Remote pages will be shown.
It is possible to select to navigate pages of M171 Perf. Display_1 or M171 Perf. Blind_1
because they are on the same network of the keyboard and provide HMI Remote pages.
EIO0000002036 09/2014 45
SoMachine HVAC - Connection
Click on M171 Perf. Display_1, then click on OK. Selected device will be added to HMI
Remote Pages. It is not possible to navigate more than one remote device at a time.
4.7.1 PLC
M171 Perf. Flush Mounting can run PLC. This configuration step can be done in the same
way of M171 Perf. Display and is fully described in section 4.1.1 - PLC.
4.7.2 HMI
M171 Perf. Flush Mounting can run local HMI project with its own pages. This configuration
step can be done in the same way of M171 Perf. Display and is fully described in section
4.1.2 - HMI.
46 EIO0000002036 09/2014
SoMachine HVAC - Connection
4.7.4 CANOPEN
M171 Perf. Flush Mounting can be connected using CANopen in field mode or in network
mode.
To connect M171 Perf. Flush Mounting in this mode select M171 Perf. Display or M171
Perf. Blind CANopen node and select the option Master (for field) then take M171 Perf.
Flush Mounting device from Catalog tab and drop it over CANopen node.
Select M171 Perf. Flush Mounting_1 child node and configure Network settings.
Probes
M171 Perf. Display_1 can access on board M171 Perf. Flush Mounting_1 on-board probes.
To do so select Probes-Input tab then it is possible to map a M171 Perf. Display_1 pa-
rameter to let it obtain the value of an on-board M171 Perf. Displayprobe.
Choose one of the probe and click on Assign button. Take one of the M171 Perf. Display_1
INT parameter and click OK button.
EIO0000002036 09/2014 47
SoMachine HVAC - Connection
HMI
It is possible to associate to a M171 Perf. Flush Mounting (configured as CANopen field
slave) an HMI project with local pages. M171 Perf. Flush Mounting would be able to show
its own target variables and parameters of the master CANopen which belongs to.
In this connection mode M171 Perf. Flush Mounting can be linked to one of the remote
devices that are available on the network to navigate HMI Remote pages provided by
other devices.
Using Connection it is possible to do so by indicating one of the available HMI Remote
device of the network. Let’s see how with an example.
We have a CANopen network with M171 Perf. Display_1 and M171 Perf. Blind_1 then add
as first level node M171 Perf. Flush Mounting_1 to the network taking it from Catalog
panel.
Click on CANOpen node of M171 Perf. Flush Mounting_1 and select Master (for HMI remot-
ing and binding) node, assign univoque Node ID and select network CANOpen1.
Binding of variables between M171 Perf. Flush Mounting_1 and M171 Perf. Blind_1 and
M171 Perf. Display_1 is allowed in a network of this type (see 4.1.3.2 for more details).
48 EIO0000002036 09/2014
SoMachine HVAC - Connection
To add HMI Remote pages select M171 Perf. Flush Mounting_1 node, then press Add
on the HMI Remote pages box thus all available devices will be shown and the user can
select the pages to navigate.
4.7.5 RS485
The usage of this communication feature is the same of M171 Perf. Display (see 4.1.4 -
RS485 paragraph).
4.7.6 ETHERNET
M171 Perf. Flush Mounting is provided with on-board Ethernet. Ethernet configuration
and features for this kind of device is similar to the configuration of the Ethernet plugin of
M171 Perf. Display (see 4.1.5 – Ethernet).
EIO0000002036 09/2014 49
SoMachine HVAC - Connection
Modicon M171 Perf. Expansion 27 I/Os configuration is quite similar to CAN Custom con-
figuration (see 4.5.3 - Using a CAN custom device) with dynamic PDO mapping feature
disabled. Available Input/Output objects that can be mapped on M171 Perf. Display PLC
variables via PDO are listed in PDO TX-Input and PDO RX-Output.
Connection knows the Modicon M171 Perf. Expansion 27 I/Os dictionary. Each object can
be here linked to M171 Perf. Display_1 PLC variable as it has been done in the above fig-
ure for Analogue Input 1 signal.
50 EIO0000002036 09/2014
SoMachine HVAC - Connection
Modicon M171 Perf. Expansion 27 I/Os_1 configuration is quite similar to a Modbus Cus-
tom device configuration (see 4.4.4 - Using a Modbus custom device) in which it is pos-
sible to assign available Modicon M171 Perf. Expansion 27 I/Os dictionary I/O objects to
M171 Perf. Display_1 PLC variables.
Connection knows the Modicon M171 Perf. Expansion 27 I/Os dictionary. Input and Out-
put objects can be added, removed, assigned, unassigned or changed in position. Only
assigned objects will be requested by M171 Perf. Display_1 device.
The first keyboard on the network communicates to the destination M171 Perf. Display
device using ch_1, channel ch_2 is dedicated to the second.
Example:
addr = 1 -> ch_1 = 124, ch_2 = 123
addr = 2 -> ch_1 = 122, ch_2 = 121
EIO0000002036 09/2014 51
SoMachine HVAC - Connection
52 EIO0000002036 09/2014
SoMachine HVAC - Connection
5. TECHNICAL REFERENCE
EIO0000002036 09/2014 53
SoMachine HVAC - Connection
54 EIO0000002036 09/2014
SoMachine HVAC - Connection
EIO0000002036 09/2014 55
SoMachine HVAC - Connection
Via the Stop Remote Node command the master can force the slave(s) to the stopped
state. In this state no services besides network and error control mechanism are avail-
able.
The command Reset Communication resets the communication on the node: all commu-
nication parameters will be set to their defaults.
The application will be reset by Reset Node command, that resets all application param-
eter and then calls Reset Communication command.
56 EIO0000002036 09/2014
SoMachine HVAC - Connection
EIO0000002036 09/2014 57
SoMachine HVAC - Connection
58 EIO0000002036 09/2014
SoMachine HVAC - Application
Contents
1. Overview 67
2.2 Toolbars 73
2.2.1 Showing/hiding toolbars 73
2.2.2 Moving toolbars 73
3. Managing projects 83
EIO0000002036 09/2014 59
SoMachine HVAC - Application
3.6.4 Download 89
3.6.5 Debug 89
3.6.6 Build events 90
4.2 Variables 99
4.2.1 Global variables 99
4.2.2 Local variables 105
4.2.3 Create multiple 106
60 EIO0000002036 09/2014
SoMachine HVAC - Application
6. Compiling 149
EIO0000002036 09/2014 61
SoMachine HVAC - Application
8. Debugging 163
62 EIO0000002036 09/2014
SoMachine HVAC - Application
EIO0000002036 09/2014 63
SoMachine HVAC - Application
64 EIO0000002036 09/2014
SoMachine HVAC - Application
SAFETY INFORMATION
Important Information
Read these instructions carefully, and look at the equipment to become familiar with the device
before trying to install, operate, or maintain it. The following special messages may appear
throughout this documentation or on the equipment to inform of potential hazards or to call
attention to information that clarifies or simplifies a procedure.
The addition of this symbol to a Danger safety label indicates that an electrical hazard
exists, which will result in personal injury if the instructions are not followed.
This is the safety alert symbol. It is used to alert you to potential personal injury
hazards.
Obey all safety messages that follow this symbol to avoid possible injury or death.
DANGER
DANGER indicates an imminently hazardous situation which, if not avoided, results in death
or serious injury.
WARNING
WARNING indicates a potentially hazardous situation which, if not avoided, can result in
death or serious injury.
CAUTION
CAUTION indicates a potentially hazardous situation which, if not avoided, can result in
minor or moderate injury.
NOTICE
NOTICE is used to address practices not related to physical injury.
PLEASE NOTE
Electrical equipment should be installed, operated, serviced, and maintained only by qualified
personnel.
No responsibility is assumed by Schneider Electric for any consequences arising out of the use of
this material.
You can download these technical publications and other technical information from our website at:
www.schneider-electric.com
EIO0000002036 09/2014 65
SoMachine HVAC - Application
WARNING
LOSS OF CONTROL
• The designer of any control scheme must consider the potential failure modes of control
paths and, for certain critical control functions, provide a means to achieve a safe state
during and after a path failure. Examples of critical control functions are emergency stop and
overtravel stop, power outage and restart.
• Separate or redundant control paths must be provided for critical control functions.
• System control paths may include communication links. Consideration must be given to the
implications of unanticipated transmission delays or failures of the link.
• Observe all accident prevention regulations and local safety guidelines.(1)
• Each implementation of this equipment must be individually and thoroughly tested for proper
operation before being placed into service.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
(1) For additional information, refer to NEMA ICS 1.1 (latest edition), “Safety Guidelines for the
Application, Installation, and Maintenance of Solid State Control” and to NEMA ICS 7.1 (latest
edition), “Safety Standards for Construction and Guide for Selection, Installation and Operation
of Adjustable-Speed Drive Systems” or their equivalent governing your particular location.
WARNING
UNINTENDED EQUIPMENT OPERATION
• Only use software approved by Schneider Electric for use with this equipment.
• Update your application program every time you change the physical hardware configuration.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
66 EIO0000002036 09/2014
SoMachine HVAC - Application
1. OVERVIEW
EIO0000002036 09/2014 67
SoMachine HVAC - Application
Build
The Build panel displays the output of the following activities:
-- opening a project;
-- compiling a project;
-- downloading code to a target.
Find in project
This panel shows the result of the Find in project activity.
Debug
The Debug panel displays information about advanced debugging activities (for example,
Workspace
breakpoints). Depending on the Source
targetcode
device Document
you are interfacing
bar with,window
Watch Application can
window editors
print on this output window every PLC run-time error (for example, division by zero), lo-
cating the exact position where the error occured.
Resources
The Resources panel displays messages related to the specific target device Application
is interfacing with.
68 EIO0000002036 09/2014
SoMachine HVAC - Application
This panel lists basic language elements, such as operators and functions defined by the
IEC 61131-3 standard.
EIO0000002036 09/2014 69
SoMachine HVAC - Application
This panel lists all the system variables, also called target variables, which are the inter-
face between firmware and PLC application code.
This panel lists all the system functions and function blocks available on the specific target
device.
The panels described in the preceding paragraphs are usually always available in the Li-
brary window. However, other panels may be added to this window, one for each library
included in the current Application project. For example, the picture above was taken from
a Application project having two included libraries, basic.pll and thermmodel.pll (see
also Paragraph 3.7).
70 EIO0000002036 09/2014
SoMachine HVAC - Application
1.1.6.1 PROJECT
1.1.6.2 DEFINITIONS
The Definitions panel contains the definitions of all user-defined data types, such as
structures or enumerated types.
1.1.6.3 RESOURCES
The contents of the Resources panel depends on the target device Application is interfac-
ing with: it may include configuration elements, schemas, wizards, and so on.
EIO0000002036 09/2014 71
SoMachine HVAC - Application
The definition of both global and local variables is supported by specific spreadsheet-like
editors.
72 EIO0000002036 09/2014
SoMachine HVAC - Application
This chapter shows you how to deal with the many UI elements Application is composed
of, in order to let you set up the IDE in the way which best suits to your specific develop-
ment process.
2.2 TOOLBARS
2.2.1 SHOWING/HIDING TOOLBARS
In details, in order to show (or hide) a toolbar, open the View>Toolbars menu and select
the desired toolbar (for example, the Function Block Diagram bar).
EIO0000002036 09/2014 73
SoMachine HVAC - Application
You can change the shape of the toolbar, from horizontal to vertical, either by pressing the
Shift key or by moving the toolbar next to the vertical border of any window.
You can also make the toolbar float, either by pressing the CTRL key or by moving the
toolbar away from any window border.
74 EIO0000002036 09/2014
SoMachine HVAC - Application
EIO0000002036 09/2014 75
SoMachine HVAC - Application
You can make the tool window float, by double-clicking on its name, or by pressing the
CTRL key, or by moving the tool window away from the main window borders.
A tool window can be resized by clicking-and-dragging on its border until the desired size
is reached.
76 EIO0000002036 09/2014
SoMachine HVAC - Application
You can show or hide the Document bar with the menu option of the same name in the
menu View>Toolbars.
EIO0000002036 09/2014 77
SoMachine HVAC - Application
Moreover, this menu supplies a few commands to automate some basic tasks, such as
closing all windows.
You can switch on and off the full screen mode with the Full screen option of the menu
View or with the corresponding command of the Main toolbar.
78 EIO0000002036 09/2014
SoMachine HVAC - Application
General
Autosave: if the Enable Autosave box is checked, Application periodically saves the
whole project. You can specify the period of execution of this task by entering the number
of minutes between two automatic savings in the Autosave interval text box.
Graphic Editor
This panel lets you edit the properties of the LD, FBD, and SFC source code editors.
Text Editors
Language
You can change the language of the environment by selecting a new one from the list
shown in this panel.
After selecting the new language, press the Select button and confirm by clicking OK.
This change will be effective only the next time you start Application.
Tools
You can add up to 16 commands to the Tools menu. These commands can be associated
with any program that will run on your operating system. You can also specify arguments
for any command that you add to the Tools menu. The following procedure shows you
how to add a tool to the Tools menu.
EIO0000002036 09/2014 79
SoMachine HVAC - Application
1) Type the full path of the executable file of the tool in the Command text box. Other-
wise, you can specify the filename by selecting it from Windows Explorer, which you
open by clicking the Browse button.
2) In the Arguments text box, type the arguments - if any - to be passed to the execut-
able command mentioned at step 1. They must be separated by a space.
3) Enter in Menu string the name you want to give to the tool you are adding. This is
the string that will be displayed in the Tools menu.
4) Press Add to effectively insert the new command into the suitable menu.
5) Press OK to confirm, or Cancel to quit.
For example, let us assume that you want to add Windows calculator to the Tools
menu:
-- Fill the fields of the dialog box as displayed.
-- Press Add. The name you gave to the new tool is now displayed in the list box at the
top of the panel.
80 EIO0000002036 09/2014
SoMachine HVAC - Application
Merge
Here you can set the merge function behavior.
EIO0000002036 09/2014 81
SoMachine HVAC - Application
82 EIO0000002036 09/2014
SoMachine HVAC - Application
3. MANAGING PROJECTS
You are required to enter the name of the new project in the Name control. The string you
enter will also be the name of the folder which will contain all the files making up the Ap-
plication project. The pathname in the Directory control indicates the default location
of this folder.
Target selection allows you to specify the target device which will run the project.
Finally, you can make the project case-sensitive by activating the related option. Note
that, by default, this option is not active, in compliance with IEC 61131-3 standard: when
you choose to create a case-sensitive project, it will not be standard-compliant.
When you confirm your decision to create a new project and the whole required informa-
tion has been provided, Application completes the operation, creating the project direc-
tory and all project files; then, the project is opened.
The list of devices from which you can select the target for the project you are creating
depends on the contents of the catalog of target devices available to Application.
When the desired target is missing, either you have run the incorrect setup executable
or you have to run a separate setup which is responsible to update the catalog to include
the target device. In both cases, you should contact your hardware supplier for support.
EIO0000002036 09/2014 83
SoMachine HVAC - Application
In order to upload the project from the target device, follow the procedure below:
1) Select the item Import project from target in the menu File.
2) Select the target device you are connecting to, from the list shown in the Target list
window.
3) Configure connection (see paragraph 7.1 for more details).
4) You may optionally test the connection with the target device.
Application tries to establish the connection and reports the test result.
84 EIO0000002036 09/2014
SoMachine HVAC - Application
5) If the connection is available confirm the operation by clicking on the upload sources
button. When the application upload completes successfully, the project is open for edit-
ing.
Application asks you to select the new destination (which must be an empty directory),
then saves a copy of the project to that location and opens this new project file for editing.
EIO0000002036 09/2014 85
SoMachine HVAC - Application
Note that Application prevents you from applying changes to elements of a project, when
at least one of the following conditions holds:
-- You cannot modify any object of the project if you are in debug mode.
-- You cannot edit an object of an included library, whereas you can modify an object that
you imported from a library.
-- The project is opened in read-only mode (view project).
To close the project, select the item Close project from the File menu; Application
shows the Welcome page, so that you can rapidly start a new working session.
Application notifies you of the name of the RSM file and lets you choose whether to protect
the file with a password or not. If you choose to protect the file, Application asks you to
insert the password.
86 EIO0000002036 09/2014
SoMachine HVAC - Application
-- Case sensitivity: you can set the project as case-sensitive checking this option. Note
that, by default, this option is not active.
-- Check FB external variables: if this option is checked you must declare all function
blocks as external variables.
EIO0000002036 09/2014 87
SoMachine HVAC - Application
-- Print debug information: prints on the output window some significant debug info.
-- Allow only integer indexes for arrays: if this option is checked you cannot use
BYTE, WORD or DWORD as array indexes.
-- Run-time check of array bounds: if this option is checked some check code is added
to verify that array indexes are not out of bounds during run-time. This option is set-
table depending on target device.
-- Run-time check of division by zero: if this option is checked some check code is
added to verify that divisions by zero are not performed on arrays during run-time. This
option is settable depending on target device.
-- Enable WAITING statement (standard extension): if this option is checked the WAIT-
ING construct for the ST language is added as IEC 61131-3 extension. See paragraph
11.7.3 for more details.
-- Disable warning emission: if this option is checked warning emissions are not printed
on the output window.
-- Disable warning codes: if this option is checked some specified warning emissions are
not printed on the output window.
Listing section
-- Generate listing file: if this option is checked the compiler will generate a listing
file named as projectname.lst.
-- Include source code (active only if Generate listing file is checked): if this op-
tion is checked the source code will be inserted as visible in the lst file. Otherwise the
source code will be hidden.
88 EIO0000002036 09/2014
SoMachine HVAC - Application
-- Source code (active only if Create downloadable target files is checked): this field
specifies the name of the Source code binary file. By default projectname._source.
bin.
-- Debug (active only if Create downloadable target files is checked): this field speci-
fies the name of the Debug symbol binary file. By default projectname._debug.bin
3.6.4 DOWNLOAD
Here you can edit some significant properties of the download behavior. See paragraph
7.3.1 for more information.
3.6.5 DEBUG
Here you can edit some significant properties of the debug behavior.
-- Polling period for debug function (ms): specifies the period how often functions
are seen in what state they are.
-- Number of displayed array elements without alert message: specifies the maxi-
mum number of array element to be added in watch window without being alerted.
-- Polling period between more variables (ms): specifies the period between vari-
ables before are seen in what state they are.
EIO0000002036 09/2014 89
SoMachine HVAC - Application
-- Autosave watch list: if checked (by default no) the watch list status will be saved into
a file, when the project is closed. See paragraph 9.1.7 for more details.
90 EIO0000002036 09/2014
SoMachine HVAC - Application
The library manager lists all the libraries currently included in a Application project. It also
allows you to include or remove libraries.
To access the library manager, click Library manager in the Project menu.
The following procedure shows you how to include a library in a Application project, which
results in all the library’s objects becoming available to the current project.
Including a library means that a reference to the library’s .pll file is added to the cur-
rent project, and that a local copy of the library is made. Note that you cannot edit the
elements of an included library, unlike imported objects.
If you want to copy or move a project which includes one or more libraries, make sure
that references to those libraries are still valid in the new location.
1) Click Library manager in the Project menu, which opens the Library manager
dialog box.
2) Press the Add button, which causes an explorer dialog box to appear, to let you select
the .pll file of the library you want to open.
3) When you have found the .pll file, open it either by double-clicking it or by press-
ing the Open button. The name of the library and its absolute pathname are now
displayed in a new row at the bottom of the list in the white box.
4) Repeat step 1, 2, and 3 for all the libraries you wish to include.
5) When you have finished including libraries, press either OK to confirm, or Cancel to
quit.
EIO0000002036 09/2014 91
SoMachine HVAC - Application
The following procedure shows you how to remove an included library from the current
project. Remember that removing a library does not mean erasing the library itself, but
the project’s reference to it.
1) Click Library manager in the Project menu of the Application main window, which
opens the Library manager dialog box.
Select the library you wish to remove by clicking its name once. The Remove button
is now enabled.
2) Click the Remove button, which causes the reference to the selected library to disap-
pear from the Project library list.
3) Repeat for all the libraries you wish to remove. Alternatively, if you want to remove
all the libraries, you can press the Remove all button.
4) When you have finished removing libraries, press either OK to confirm, or Cancel not
to apply changes.
92 EIO0000002036 09/2014
SoMachine HVAC - Application
3) Enter the destination library by specifying the location of its .pll file. You can do
this by:
-- typing the full pathname in the white text box;
-- clicking the Browse button , in order to open an explorer dialog box which allows
you to browse your disk and the network.
4) You may optionally choose to encrypt the source code of the POU you are exporting,
in order to protect your source code.
5) Click OK to confirm the operation, otherwise press Cancel to quit.
If at Step 3 of this procedure you enter the name of a non-existing .pll file, Application
creates the file, thus establishing a new library.
So far, it is not possible to undo export to a library. The only possibility to remove an ob-
ject is to create another library containing all the objects of the current one, except the
one you wish to delete.
EIO0000002036 09/2014 93
SoMachine HVAC - Application
3) Select the tab of the type of the object(s) you want to import. You can also make
simple queries on the objects in each tab by using Filters. However, note that only
the Name filter actually applies to libraries. To use it, select a tab, then enter the name
of the desired object(s), even using the * wildcard, if necessary.
4) Select the object(s) you want to import, then press the Import object button.
5) When you have finished importing objects, press indifferently OK or Cancel to close
the Library browser.
When you import an object in a Application project, you actually make a local copy of that
object. Therefore, you just need to delete the local object in order to undo import.
When you import objects in a Application project or insert a copied mapped variable, you
may encounter an overlapping address or duplicate naming warning.
By setting the corresponding environment options (see paragraph 2.6 for more details)
you can choose the behavior that Application should keep when encountering those prob-
lems.
The possible actions are:
Take from Do
Ask Automatic
library nothing
If different types X X X
Naming If same type but not
X X X
behavior variables
If both variables X X X
If address overlaps X X X
Address
behavior Copy/paste mapped
X X
variable
94 EIO0000002036 09/2014
SoMachine HVAC - Application
This chapter shows you how to deal with the elements which compose a project, namely:
Program Organization Units (briefly, POUs), tasks, derived data types, and variables.
2) Specify what kind of POU you want to create by clicking one of the items in the sub-
menu which pops up.
3) Select the language you will use to implement the POU.
EIO0000002036 09/2014 95
SoMachine HVAC - Application
5) After creating a new program, an alert icon (interrogation mark) appears below the
new program icon.
This alert icon indicates that the program is not yet associated to a task. Refer to
paragraph 4.3.1 to assign the program to the desired task.
When creating a new program, Application gives you the chance to assign that program
to a task at the same time: select the task you want the program to be assigned to from
the list shown in the Task section of the New program window.
2) Double-click the name of the object you want to edit. The relative editor opens and
lets you modify the source code of the POU.
96 EIO0000002036 09/2014
SoMachine HVAC - Application
EIO0000002036 09/2014 97
SoMachine HVAC - Application
3) Click Delete object in the context menu, then press Yes to confirm your choice.
2) Enter the password twice (to avoid any problem which may arise from typos) and
confirm the operation.
98 EIO0000002036 09/2014
SoMachine HVAC - Application
To decrypt a POU, right-click the POU name in the project tree and choose Decrypt from
the contextual menu.
4.2 VARIABLES
There are two classes of variables in Application: global variables and local variables.
This paragraph shows you how to add to the project, edit, and eventually remove both
global and local variables.
Global variables are listed in the project tree, in the Global variables folder, where they
are further classified according to their properties as Automatic variables, Mapped vari-
ables, Constants, and Retain variables.
-- Automatic variables include all the variables that the compiler automatically allocates to
an appropriate location in the target device memory.
-- Mapped variables, on the other way, do have an assigned address in the target device
logical addressing system, which shall be specified by the developer.
-- Constants list all the variables which the developer declared as having the CONSTANT
attribute, so that they cannot be written.
-- Retain variables list all the variables which the developer declared as having the RE-
TAIN attribute, so that their values are stored in a persistent memory area of the target
device.
EIO0000002036 09/2014 99
SoMachine HVAC - Application
You can further categorize the set of all global variables by grouping them according to
application-specific criteria. In order to define a new group, follow this procedure:
1) Select Group from the Variables menu (note that this menu is available only if the
Global variables editor is open).
2) Enter the name of the new variable group, then click Add.
3) You can now use the variable group in the declaration of new global variables.
3) Choose the class of the variable you want to declare (Automatic variables, Mapped
variables, Constants, or Retain variables).
4) Enter the name of the variable (remember that some characters, such as ‘?’, ‘.’, ‘/’,
and so on, cannot be used: the variable name must be a valid IEC 61131-3 identifier).
or by selecting it from the list that Application displays when you click on the Browse
button.
8) Finally, you can add a brief description and then confirm the operation.
If you create a new mapped variable, you are required to specify the address of the vari-
able during its definition. In order to do so, you may do one of the following actions:
-- Click on the button to open the editor of the address, then enter the desired value.
-- Select from the list that Application shows you the memory area you want to use: the
tool automatically chooses the address of the first free memory location of that area.
2) Double-click the name of the variable you want to edit: the global variables editor
opens and lets you modify its definition.
2) Right-click the name of the variable you want to delete. A context menu appears re-
ferred to the selected variable.
3) Click Delete variable in the context menu, then press Yes to confirm you choice.
In order to create, edit, and delete local variables, you have to open the Program Organi-
zation Unit for editing and use the local variables editor.
Refer to the corresponding section in this manual for details (see Paragraph 5.6.1.2).
4.3 TASKS
4.3.1 ASSIGNING A PROGRAM TO A TASK
Read the instructions below to know how to make a task execute a program.
1) The tasks running on the target device are listed in the Project tab of the Work-
space window. Right-click the name of the task you want to execute the program and
choose Add program from the contextual menu.
2) Select the program you want the task to execute from the list which shows up and
confirm your choice.
3) The program has been assigned to the task, as you can see in the project tree.
Note that you can assign more than a program to a task. From the contextual menu you
can sort and, eventually, remove program assignments to tasks.
2) In the Task configuration window you can edit the task execution period.
4.4.1 TYPEDEFS
The following paragraphs show you how to manage typedefs.
(if you want to define an alias for an array type, you shall choose the array size).
4) Enter a meaningful description (optional) and confirm the operation.
The typedefs of the project are listed under the TypeDefs folder. In order to edit a typedef
you just have to double-click on its name.
4.4.2 STRUCTURES
The following paragraphs show you how to manage structures.
The structures of the project are listed under the Structures folder. In order to edit a
structure (for example, to define its fields) you have to double-click on its name.
4.4.3 ENUMERATIONS
The following paragraphs show you how to manage enumerations.
The enumerations of the project are listed under the Enumerations folder. In order to edit
an enumeration (for example, to define its values) you have to double-click on its name.
4.4.4 SUBRANGES
The following paragraphs show you how to manage subranges.
The subranges of the project are listed under the Subranges folder. In order to edit a
subrange you just have to double-click on its name.
This tool is context dependent, this implies that the kind of objects that can be selected
and that the available operations on the objects in the different context are not the same.
Object browser can be opened in these three main ways:
-- Browser mode.
-- Import object mode.
-- Select object mode.
User interaction with Object browser is mainly the same for all the three modes and is
described in the next paragraph.
This section describes the features and the usage of the Object browser that are com-
mon to every mode in which Object browser can be used.
Objects filter
This is the main filter of the Object browser. User can check one of the available (ena-
bled) object items.
In this example, Programs, Function Blocks, Functions are selected, so objects of this
type are shown in the object list. Variables and User types objects can be selected
by user but objects of that type are not currently shown in the object list. Operators,
Standard functions, Local variables, and Basic types cannot be checked by user
(because of the context) so cannot be browsed.
User can also click Check all button to select all available objects at one time or can click
Check none button to deselect all objects at one time.
Other filters
Selected objects can be also filtered by name, symbol location, specific library and var
type.
Filters are all additive and are immediately applied after setting.
Name
Function Filters objects on the base of their name.
Set of legal values All the strings of characters.
Type a string to display the specific object whose name
matches the string. Use the * wildcard if you want to
display all the objects whose name contains the string in
Use the Name text box. Type * if you want to disable this filter.
Press Enter when edit box is focused or click on the OK
button near the edit box to apply the filter.
Applies to All object types.
Symbol location
Function Filters objects on the base of their location.
Set of legal values All, Project, Target, Library, Aux. Sources.
All= Disables this filter.
Project= Objects declared in the Application project.
Target= Firmware objects.
Use
Library= Objects contained in a library. In this case, use
simultaneously also the Library filter, described below.
Aux sources= Shows aux sources only.
Applies to All objects types.
Library
Completes the specification of a query on objects contained
Function in libraries. The value of this control is relevant only if the
Symbol location filter is set to Library.
Set of legal values All, libraryname1, libraryname2, ...
All= Shows objects contained in whatever library.
Use LibrarynameN= Shows only the objects contained in the
library named librarynameN.
Applies to All objects types.
Vars Type
Filters global variables and system variables (also known
Function
as firmware variables) according to their type.
Set of legal values All, Normal, Constant, Retain
All= Shows all the global and system variables.
Normal= Shows normal global variables only.
Use
Constant= Shows constants only.
Retain= Shows retain variables only.
Applies to Variables.
Object list
Object list shows all the filtered objects. List can be ordered in ascending or discend-
ing way by clicking on the header of the column. So it is possible to order items by Name,
Type, or Description.
Double-clicking on an item allows the user to perform the default associated operation
(the action is the same of the OK, Import object, or Open source button actions).
When item multiselection is allowed, Select all and Select none buttons are visible.
It is possible to select all objects by clicking on Select all button. Select none dese-
lects all objects.
If at least an item is selected on the list operation, buttons are enabled.
Resize
Window can be resized, the cursor changes along the border of the dialog and allows the
user to resize window. When reopened, Object browser dialog takes the same size and
position of the previous usage.
Close dialog
You have two options for closing the Object browser:
-- Press the button near the right-end border of the caption bar.
To use Object browser in this way click on Object browser in the Project menu. This
causes the Object browser dialog box to appear, which lets you navigate between the
objects of the currently open project.
Available objects
In this mode you can list objects of these types:
-- Programs.
-- Function Blocks.
-- Functions.
-- Variables.
-- User types.
These items can be checked or unchecked in Objects filter section to show or to hide
the objects of the chosen type in the list.
Other types of objects (Operators, Standard functions, Local variables, Basic types) can-
not be browsed in this context so they are unchecked and disabled).
Available operations
Export to library
Function To export an object to a library.
Select the objects you want to export, then press the
Use
Export to library button.
Delete objects
Function Allows you to delete an object.
Select the object you want to delete, then press the
Use
Delete object button.
Multi selection
Multi selection is allowed for this mode, Select all and Select none buttons are visible.
Object browser is also used to support objects importation in the project from a desired
external library. Select Import object from library in the Project menu, then choose
the desired library.
Available objects
In this mode you can list objects of these types:
-- Programs.
-- Function blocks.
-- Functions.
-- Variables.
-- User types.
These items can be checked or unchecked in Objects filter section to show or to hide
the objects of the chosen type in the list.
Other types of objects (Operators, Standard functions, Local variables, Basic types) can-
not be imported so they are unchecked and disabled.
Available operations
Import objects is the only operation supported in this mode. It is possible to import
selected objects by clicking on Import objects button or by double-clicking on one of
the objects in the list.
Multi selection
Multi selection is allowed for this mode, Select all and Select none buttons are visible.
Object browser dialog is useful for many operations that requires the selection of a single
PLC object. So Object browser can be used to select the program to add to a task, to se-
lect the type of a variable, to select an item to find in the project, etc..
Available objects
Available objects are strictly dependent on the context, for example in the program as-
signment to a task operation the only available objects are programs objects.
It is possible that not all available objects are selected by default.
Available operations
In this mode it is possible to select a single object by double-clicking on the list or by click-
ing on the OK button, then the dialog is automatically closed.
Multi selection
Multi selection is not allowed for this mode, Select all and Select none buttons are
not visible.
2) In the Find what text box, type the name of the object you want to look for.
Otherwise, click the Browse button to the right of the text box, and select the name
of the object from the list of all the existing items.
3) Select one of the values listed in the Location combo box, so as to specify a con-
straint on the location of the objects to be inspected.
4) The frame named Filters contains 7 checkboxes, each of which, if ticked, enables
research of the string among the object it refers to.
5) Tick Match whole word only if you want to compare your string to entire word only.
6) Tick Match case if you want your search to be case-sensitive.
The results will be printed in the Find in project tab of the Output window.
Information about these features may be found in a separate document: refer to your
hardware supplier for details.
The IL editor allows you to code and modify POUs using IL (i.e., Instruction List), one of
the IEC-compliant languages.
5.1.4 BOOKMARKS
You can set bookmarks to mark frequently accessed lines in your source file. Once a book-
mark is set, you can use a keyboard command to move to it. You can remove a bookmark
when you no longer need it.
Move the insertion point to the line where you want to set a bookmark, then press
Ctrl+F2. The line is marked in the margin by a light-blue circle.
Move the cursor to anywhere on the line containing the bookmark, then press Ctrl+ F2.
The ST editor allows you to code and modify POUs using ST (i.e. Structured Text), one of
the IEC-compliant languages.
5.2.5 BOOKMARKS
You can set bookmarks to mark frequently accessed lines in your source file. Once a book-
mark is set, you can use a keyboard command to move to it. You can remove a bookmark
when you no longer need it.
Move the insertion point to the line where you want to set a bookmark, then press
Ctrl+F2. The line is marked in the margin by a light-blue circle.
Move the cursor to anywhere on the line containing the bookmark, then press Ctrl+F2.
The LD editor allows you to code and modify POUs using LD (i.e. Ladder Diagram), one of
the IEC-compliant languages.
On each LD network the right and the left power rail are represented, according to the LD
language indication.
On the new LD network a horizontal line links the two power rails. It is called the “power
link”. On this link, all the LD elements (contacts, coils and blocks) are to be placed.
You can perform the following operations on networks:
-- To add a new blank network, click Network>New in the Scheme menu, or press one of
the equivalent buttons in the Network toolbar.
-- To assign a label to a selected network, give the Network>Label command from the
Scheme menu. This enables jumping to the labeled network.
-- To display a background grid which helps you to align objects, press View grid in the
Network toolbar.
-- To add a comment, press the Comment button in the FBD toolbar.
This causes a dialog box to appear, where you can type the label you want to associate
with the selected network.
If you press OK, the label is printed in the top left-hand corner of the selected network.
-- Drag a boolean variable to the desired place over a connection. For example, global
variables can be taken from the Workspace window, whereas local variables can be se-
lected from the local variables editor. The dialog box shown below will appear, request-
ing to define whether the variable should be inserted as a contact, coil or variable (like
FBD schemes). Choose the appropriate contact type. Contacts inserted with drag and
drop will always be inserted in series.
-- Drag a boolean variable on the network. For example, global variables can be taken
from the Workspace window, whereas local variables can be selected from the local vari-
ables editor. A dialog box will appear, requesting to indicate whether the variable should
be inserted as a contact, coil or variable. Choose the appropriate coil type.
-- Click Enable EN/ENO pins in the Scheme menu, or press the EN/ENO button in the FBD
toolbar, to display the enable input and output pins.
-- Click Object . Instance name in the Scheme menu, or press the FBD properties but-
ton in the FBD toolbar, to change the name of an instance of a function block.
The FBD editor allows you to code and modify POUs using FBD (i.e. Function Block Dia-
gram), one of the IEC-compliant languages.
This causes a dialog box to appear, which lets you type the label you want to associate
with the selected network.
If you press OK, the label is printed in the top left-hand corner of the selected network.
If you delete a block, its connections are not removed automatically, but they become in-
valid and they are redrawn red. Click Delete invalid connection in the Scheme menu,
or type Ctrl+B on your keyboard.
-- Click Enable EN/ENO pins in the Scheme menu, or press the EN/ENO button in the FBD
toolbar, to display the enable input and output pins.
-- Click Object>Instance name in the Scheme menu, or press the FBD properties button
in the FBD toolbar, to change the name of an instance of a function block.
for steps;
for transitions;
for jumps.
To start implementing an action, you need to open an editor. Do it by applying one of the
following procedures:
-- Click Code object>New action in the Scheme menu.
-- Right-click on the name of the SFC POU in the Workspace window. A context menu ap-
pears, from which you can select the New Action command.
In either case, Application displays a dialog box like the one shown below.
Select one of the languages and type the name of the new action in the text box at the
bottom of the dialog box. Then either confirm by pressing OK, or quit by clicking Cancel.
If you press OK, Application opens automatically the editor associated with the language
you selected in the previous dialog box and you are ready to type the code of the new
action.
Note that you are not allowed to declare new local variables, as the module you are now
editing is a component of the original SFC module, which is the POU where local variables
can be declared. The scope of local variables extends to all the actions and transitions
making up the SFC diagram.
When you have finished writing the code, double-click the step you want to assign the
new action to. This causes the following dialog box to appear.
From the list shown in the Code N box, select the name of the action you want to execute
if the step is active. You may also choose, from the list shown in the Code P (Pulse) box,
the name of the action you want to execute each time the step becomes active (that is,
the action is executed only once per step activation, regardless of the number of cycles
the step remains active). Confirm the assignments by pressing OK.
In the SFC schema, action to step assignments are represented by letters on the step
block:
-- action N by letter N in the top right corner;
-- action P by letter P in the bottom right corner.
If later you need to edit the source code of the action, you can just double-click these
letters. Alternatively, you can double-click the name of the action in the Actions folder of
the Workspace window.
Select True if you want this transition to be constantly cleared, False if you want the PLC
program to keep executing the preceding block.
Instead, if you select Variable the transition will depend on the value of a Boolean vari-
able. Click the corresponding bullet, to make the text box to its right available, and to
specify the name of the variable.
To this purpose, you can also make use of the objects browser, that you can invoke by
pressing the Browse button shown here below.
In either case, Application displays a dialog box similar the one shown in the following
picture.
Note that you can use any language except SFC to code a condition. Select one of the
languages and type the name of the new condition in the text box at the bottom of the
dialog box. Then either confirm by pressing OK, or quit by clicking Cancel.
If you press OK, Application opens automatically the editor associated with the language
you selected in the previous dialog box and you can type the code of the new condition.
Note that you are not allowed to declare new local variables, as the module you are now
editing is a component of the original SFC module, which is the POU where local variables
can be declared. The scope of local variables extends to all the actions and transitions
making up the SFC diagram.
When you have finished writing the code, double-click the transition you want to assign
the new condition to. This causes the following dialog box to appear.
Select the name of the condition you want to assign to this step. Then confirm by press-
ing OK.
If later you need to edit the source code of the condition, you can double-click the name
of the transition in the Transitions folder of the Workspace window.
In order to open the Global variables editor, double-click on Global variables in the
project tree.
To open a local variables editor, just open the Program Organization Unit the variables you
want to edit are local to.
Alternatively, you may access the Variables menu and choose Insert.
2) Change the variable type, either by editing the type name in the corresponding cell
or by clicking on the button in that cell and select the desired type from the list that
pops up.
3) Edit the address of the variable by clicking on the button in the corresponding cell
and entering the required information in the window that shows up. Note that, in the
case of global variables, this operation may change the position of the variable in the
project tree.
4) In the case of global variables, you can assign the variable to a group, by selecting
it from the list which opens when you click on the corresponding cell. This operation
will change the position of the variable in the project tree.
5) Choose whether a variable is an array or not; if it is, edit the size of the variable.
6) Edit the initial values of the variable: click on the button in the corresponding cell and
enter the values in the window that pops up.
8) Type a description for the variable in the corresponding cell. Note that, in the case of
global variables, this operation may change the position of the variable in the project
tree.
9) Save the project to persist the changes you made to the declaration of the variable.
WARNING
UNINTENDED EQUIPMENT OPERATION
• Ensure that all variables are initialized to an appropriate value before their first use as array
indices.
• Write programming instructions to test the validity of operands intended to be used as array
indices.
• Do not attempt to access an array element outside the defined bounds of the array.
• Do not attempt to assign a value to an array name without using an appropriate index into
the array.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
Alternatively, you may access the Variables menu and choose Delete.
6. COMPILING
Compilation consists of taking the PLC source code and automatically translating it into
binary code, which can be executed by the processor on the target device.
When this pre-condition does not hold, compilation aborts with a meaningful error mes-
sage.
In order to start compilation, click the Compile button in the Project toolbar.
Alternatively, you can choose Compile from the Project menu or press F7 on your key-
board.
Note that Application automatically saves all changes to the project before starting the
compilation.
If the target is connected when compilation is started, the compiler seeks the image file
directly on the target. Otherwise, it loads the local copy of the image file from the work-
ing folder. If the target device is disconnected and there is no local copy of the image file,
compilation cannot be carried out: you are then required to connect to a working target
device.
Condition Description
Compiler error(s). The PLC code contains one or more serious errors,
n>0
which cannot be worked around by the compiler.
Emission of warning(s). The PLC code contains one or more minor
errors, which the compiler automatically spotted and worked around.
However, you are informed that the PLC program may act in a
n=0, m>0
different way from what you expected: you are encouraged to get rid
of these warnings by editing and re-compiling the application until no
warning messages are emitted.
PLC code entirely correct, compilation accomplished. You should
n=m=0
always work with 0 warnings, 0 errors.
NOTE: Be sure to eliminate all compiler errors and wornings before downloading your application
to your controller or other device.
In order to download and debug the application, you have to establish a connection with
the target device. This chapter focuses on the operations required to connect to the target
and to download the application, while the wide range of Application’s debugging tools
deserves a separate chapter (see Chapter 8).
The elements in the list of communication protocols you can select from depend on
the setup executable(s) you have run on your PC (refer to your hardware provider if
a protocol you expect to appear in the list is missing).
2) Choose the appropriate protocol and make it the active protocol.
3) Fill in all the protocol-specific settings (e.g., the address or the communication
timeout - that is how long Application must wait for an answer from the target before
displaying a communication error message).
Now you can establish communication by clicking Connect in the Communication menu,
or by pressing the Connect button in the Project toolbar.
When you try to connect to the target device, the state of communication becomes one
of the following:
-- Error: the communication cannot be established. You should check both the physical
link and the communication settings.
-- Diff. code: the application currently executing on the target device is not the same as
the one currently open in the IDE; moreover, no debug information consistent with the
running application is available: thus, the values shown in the watch window or in the
oscilloscope are not valid and the debug mode cannot be activated.
-- Diff. code, Symbols OK: the application currently executing on the target device is
not the same as the one currently open in the IDE; however, some debug information
consistent with the running application is available (for example, because that applica-
tion has been previously downloaded to the target device from the same PC): the values
shown in the watch window or in the oscilloscope are valid, but the debug mode still
cannot be activated.
-- Source OK: the application currently executing on the target device is the same as the
one currently open in the IDE: the debug mode can be activated.
Alternatively, you can choose Download code from the Project menu or press the F5 key.
Application checks whether the project has unsaved changes. If this is the case, it auto-
matically starts the compilation of the application. The binary code is eventually sent to
the target device, which then undergoes automatic reset at the end of transmission. Now
the code you sent is actually executed by the processor on the target device.
You may want to protect the source code downloaded to the target device with a pass-
word, so that Application will not open the uploaded project unless the correct password
is entered.
Open the Project options window (Project > Options ... menu) and set the pass-
word.
From the following select menu you can set the Source code download time.
Choosing:
-- On PLC application download: the Source code will be downloaded to the target to-
gether with PLC application.
-- Before disconnection: the Source code will be downloaded before target disconnec-
tion.
-- Never: the Source code will be never downloaded to the target.
As well as Source code the Debug symbols download time can be set using the following
select menu with the same options.
7.4 SIMULATION
Depending on the target device you are interfacing with, you may be able to simulate the
execution of the PLC application with Application’s integrated simulation environment:
Simulation.
In order to start the simulation, just click on the appropriate item on the Project toolbar.
7.5.1 HALT
You can stop the PLC execution selecting the following item in the project bar:
8. DEBUGGING
Application provides several debugging tools, which help the developer to check whether
the application behaves as expected or not.
All these debugging tools basically allow the developer to watch the value of selected vari-
ables while the PLC application is running.
Application debugging tools can be gathered in two classes:
-- Asynchronous debuggers. They read the values of the variables selected by the devel-
oper with successive queries issued to the target device. Both the manager of the de-
bugging tool (that runs on the PC) and, potentially, the task which is responsible to an-
swer those queries (on the target device) run independently from the PLC application.
Thus, there is no guarantee about the values of two distinct variables being sampled in
the same moment, with respect to the PLC application execution (one or more cycles
may have occurred); for the same reason, the evolution of the value of a single variable
is not reliable, especially when it changes fast.
-- Synchronous debuggers. They require the definition of a trigger in the PLC code. They
refresh simultaneously all the variables they have been assigned every time the proces-
sor reaches the trigger, as no further instruction can be executed until the value of all
the variables is refreshed. As a result, synchronous debuggers obviate the limitations
affecting asynchronous ones.
This chapter shows you how to debug your application using both asynchronous and syn-
chronous tools.
Alternatively, you can click on the Close button in the top right corner of the Watch win-
dow.
In both cases, closing the Watch window means simply hiding it, not resetting it. As a
matter of fact, if you close the Watch window and then open it again, you will see that it
still contains all the variables you added to it.
Follow this procedure to add a variable to the Watch window from a textual (that is, IL or
ST) source code editor: select a variable, by double-clicking on it, and then drag it into
the watch window.
The same procedure applies to all the variables you wish to inspect.
Follow this procedure to add a variable to the Watch window from a graphical (that is, LD,
FBD, or SFC) source code editor:
1) Press the Watch button in the FBD bar.
2) Click on the block representing the variable you wish to be shown in the Watch win-
dow.
3) A dialog box appears listing all the currently existing instances of debug windows, and
asking you which one is to receive the object you have just clicked on.
In order to display the variable in the Watch window, select Watch, then press OK.
The variable name, value, and location are now displayed in a new row of the Watch win-
dow.
The same procedure applies to all the variables you wish to inspect.
Once you have added to the Watch window all the variables you want to observe, you
should click on the Select/Move button in the FBD bar: the mouse cursor turns to its
original shape.
In order to add a variable to the Watch window, you can select the corresponding record
in the variables editor and then either drag-and-drop it in the Watch window
In order to add a variable to the Watch window, you can select it in the project tree and
then either drag-and-drop it in the Watch window
You can also click on the appropriate item of the Watch window inner toolbar, in order to
add a variable to it.
You shall type (or select by browsing the project symbols) the name of the variable and
its location (where it has been declared).
The watch window manager reads periodically from memory the value of the variables.
However, this action is carried out asynchronously , that is it may happen that a higher-
priority task modifies the value of some of the variables while they are being read. Thus,
at the end of a refreshment process, the values displayed in the window may refer to dif-
ferent execution states of the PLC code.
If the target device is disconnected, the Value column contains three dots.
If the PLC code changes and Application cannot retrieve the memory location of an object
in the Watch window, then the Value column contains three dots.
If you try to add to the Watch window a symbol which has not been allocated, Application
gives the following error message.
To impose another format than the one assigned by Application, press the Format value
button in the toolbar.
2) Enter the file name and choose its destination in the file system.
You can load a watch list from file, removing the opened one, following this procedure:
1) Click on the corresponding icon in the Watch window toolbar.
2) Browse the file system and select the watch list file.
The set of symbols in the watch list is added to the Watch window.
You can load a watch list from file, appendig to the opened one, following this procedure:
1) Click on the corresponding icon in the Watch window toolbar.
2) Browse the file system and select the watch list file.
The set of symbols in the watch list is added to the Watch window.
You can clear the current opened watch list by clicking on the following icon:
8.2 OSCILLOSCOPE
The Oscilloscope allows you to plot the evolution of the values of a set of variables. Be-
ing an asynchronous tool, the Oscilloscope cannot guarantee synchronization of samples.
Opening the Oscilloscope causes a new window to appear next to the right-hand border
of the Application frame. This is the interface for accessing the debugging functions that
the Oscilloscope makes available. The Oscilloscope consists of three elements, as shown
in the following picture.
The toolbar allows you to better control the Oscilloscope. A detailed description of the
function of each control is given later in this chapter.
The Chart area includes several items:
-- Plot: area containing the curve of the variables.
-- Vertical cursors: cursors identifying two distinct vertical lines. The values of each vari-
able at the intersection with these lines are reported in the corresponding columns.
-- Scroll bar: if the scale of the x-axis is too large to display all the samples in the Plot
area, the scroll bar allows you to slide back and forth along the horizontal axis.
The lower section of the Oscilloscope is a table consisting of a row for each variable.
Alternatively, you can click on the Close button in the top right corner of the Oscillo-
scope window.
In both cases, closing the Oscilloscope means simply hiding it, not resetting it. As a mat-
ter of fact, if you open again the Oscilloscope after closing it, you will see that plotting of
the curve of all the variables you added to it starts again.
Follow this procedure to add a variable to the Oscilloscope from a textual (that is, IL or
ST) source code editor: select a variable by double-clicking on it, and then drag it into the
Oscilloscope window.
The same procedure applies to all the variables you wish to inspect.
Follow this procedure to add a variable to the Oscilloscope from a graphical (that is, LD,
FBD, or SFC) source code editor:
1) Press the Watch button in the FBD bar.
2) Click on the block representing the variable you wish to be shown in the Oscilloscope.
3) A dialog box appears listing all the currently existing instances of debug windows, and
asking you which one is to receive the object you have just clicked on.
Select Oscilloscope, the press OK. The name of the variable is now displayed in the
Track column.
The same procedure applies to all the variables you wish to inspect.
Once you have added to the Oscilloscope all the variables you want to observe, you should
click on the Select/Move button in the FBD bar: the mouse cursor turns to its original
shape.
In order to add a variable to the Oscilloscope, you can select the corresponding record in
the variables editor and then either drag-and-drop it in the Oscilloscope
or press the F10 key and choose Oscilloscope from the list of debug windows which pops
up.
In order to add a variable to the Oscilloscope, you can select it in the project tree and then
either drag-and-drop it in the Oscilloscope
or press the F10 key and choose Oscilloscope from the list of debug windows which
pops up.
The Oscilloscope manager periodically reads from memory the value of the variables.
However, this action is carried out asynchronously, that is it may happen that a higher-
priority task modifies the value of some of the variables while they are being read. Thus,
at the end of a sampling process, data associated with the same value of the x-axis may
actually refer to different execution states of the PLC code.
If the target device is disconnected, the curves of the dragged-in variables get frozen,
until communication is restored.
When you add a variable to the Oscilloscope, data acquisition begins immediately.
The curve freezes (while the process of data acquisition is still running in background),
until you click on Restart acquisition.
In this case, when you click on Restart acquisition, the evolution of the value of the
variable is plotted from scratch.
When you open the Oscilloscope, Application applies a default scale to the axes. However,
if you want to set a different scale, you may follow this procedure:
1) Open the graph properties by clicking on the corresponding item in the toolbar.
2) Set the scale of the horizontal axis, which is common to all the tracks.
3) For each variable, you may specify a distinct scale for the vertical axis.
4) Confirm your settings. The graph adapts to reflect the new scale.
You can also zoom in and out with respect to both the horizontal and the vertical axes.
Finally, you may also quickly adapt the scale of the horizontal axis, the vertical axis, or
both to include all the samples, by clicking on the corresponding item of the toolbar.
When you are watching the evolution of two or more variables, you may want to split the
respective tracks. For this purpose, click on the Vertical split item in the Oscillo-
scope toolbar.
If you click on the Show samples item in the Oscilloscope toolbar, the tool highlights
the single values detected during data acquisition.
You can click on the same item again, in order to go back to the default view mode.
The Oscilloscope includes two measure bars, which can be exploited to take some meas-
ures on the chart; in order to show and hide them, click on the Show measure bars item
in the Oscilloscope toolbar.
If you want to measure a time interval between two events, you just have to move one
bar to the point in the graph that corresponds to the first event and the other to the point
that corresponds to the second one.
The time interval between the two bars is shown in the top left corner of the chart.
You can use a measure bar also to read the value of all the variables in the Oscilloscope
at a particular moment: move the bar to the point in the graph which corresponds to the
instant you want to observe.
In the table below the chart, you can now read the values of all the variables at that par-
ticular moment.
You can further customize the appearance of the Oscilloscope by clicking on the Graph
properties item in the toolbar.
In the window that pops up you can choose whether to display or not the Background
grid, the Time slide bar, and the Track list.
You can save the samples acquired by the Oscilloscope to a file, in order to further analyze
the data with other tools.
1) You may want to stop acquisition before saving data to a file.
2) Click on the Save tracks data into file in the Oscilloscope toolbar.
3) Choose between the available output file format: OSC is a simple plain-text file, con-
taining time and value of each sample; OSCX is an XML file, that includes more
complete information, which can be further analyzed with another tool, provided
separately from Application.
4) Choose a file name and a destination directory, then confirm the operation.
Follow this procedure to print a view of the data plotted in the Oscilloscope:
1) Either suspend or stop the acquisition.
2) Move the time slide bar and adjust the zoom, in order to include in the view the ele-
ments you want to print.
Alternatively, you can choose Debug mode from the Project menu.
The status bar shows whether the debug mode is active or not.
Note that you cannot enter the debug mode if the connection status differs from Con-
nected.
In the left column, a portion of an SFC network is shown, diagram animation being off.
In the right column the same portion of network is displayed when the live debug mode
is active. The picture in the right column shows that steps S1 and S3 are currently active,
whereas Init, S2, and S4 are inactive.
Note that the SFC animation manager tests periodically the state of all steps, the user not
being allowed to edit the sampling period. Therefore, it may happen that a step remains
active for a slot of time too short to be displayed on the video.
The fact that a step is never highlighted does not imply that its action is not executed, it
may simply mean that the sampling rate is too slow to detect the execution.
As explained in the SFC language reference, a step can be assigned to an action, and a
transition can be associated with a condition code. Actions and conditions can be coded in
any of the IEC 61131-3 languages. General-purpose debugging tools can be used within
each action/condition, as if it was a stand-alone POU.
8.4.2 LD ANIMATION
In live debug mode, Ladder Diagram schemes are animated by highlighting the contacts
and coils whose value is true (in the example, i1 and i2).
Note that the LD animation manager tests periodically the state of all the elements. It
may happen that an element remains true for a slot of time too short to be displayed
on the video. The fact that an element is never highlighted does not imply that its value
never becomes true (the sampling rate may be too slow).
8.5 TRIGGERS
8.5.1 TRIGGER WINDOW
The Trigger window tool allows you to select a set of variables and to have them updated
synchronously in a special pop-up window.
Memory availability
A trigger window takes a segment in the application code sector, having a well-defined
length. Obviously, in order to start up a trigger window, it is necessary that a sufficient
amount of memory is available, otherwise an error message appears.
Trigger window icons are part of the Debug toolbar and are enabled only if Application is
in debug mode.
Each record refers to a trigger window, either graphic or textual. The following table ex-
plains the meaning of each field.
Field Description
T: trigger window.
Type
G: graphic trigger window.
Name of the program, function, or function block where
the trigger is placed. If the module is a function block, this
Module
field contains its name, not the name of its instance where
you actually put the trigger.
For the textual languages (IL, ST) indicates the line in
Line which the trigger is placed. For the other languages the
value is always -1.
Setting a trigger causes a pop-up window to appear, which is called Interface window:
this is the interface to access the debugging functions that the trigger window makes
available. It consists of three elements, as shown below.
Caption bar
The Caption bar of the pop-up window shows information on the location of the trigger
which causes the refresh of the Variables window, when reached by the processor.
The text in the Caption bar has the following format:
Trigger n° X at ModuleName#Location
where
X Trigger identifier.
Name of the program, function, or function block where
ModuleName
the trigger was placed.
Exact location of the trigger, within module ModuleName.
If ModuleName is in IL, Location has the following format:
N1
Otherwise, if ModuleName is in FBD, it becomes:
N2$BT:BID
Location
where:
N1 = instruction line number
N2 = network number
BT = block type (operand, function, function block, etc.)
BID = block identifier
Controls section
This dialog box allows the user to better control the refresh of the trigger window to get
more information on the code under scope. A detailed description of the function of each
control is given in the Trigger window controls section (see 8.5.2.11).
All controls except Ac, the Accumulator display button, are not accessible until at least
one variable is dragged into the debug window.
To watch a variable, you need to copy it to the lower section of the Debug window.
This section is a table consisting of a row for each variable you dragged in. You can drag
into the trigger window only variables local to the module where you placed the relative
trigger, or global variables, or parameters. You cannot drag variables declared in another
program, or function, or function block.
The value of variables is refreshed every time the window manager is triggered, that is
every time the processor executes the instruction marked by the green arrowhead. How-
ever, you can set controls in order to have variables refreshed only when triggers satisfy
the more limiting conditions you define.
Note that the value of the variables in column Symbol is read from memory just before
the marked instruction (in this case: the instruction at line 5) and immediately after the
previous instruction (the one at line 4) has been performed.
Thus, in the above example the second ST statement has not been executed yet when the
new value of a is read from memory and displayed in the trigger window. Thus the result
of the second ST a is 1.
This paragraph deals with the trigger window controls, which allows you to better super-
vise the working of this debugging tool, to get more information on the code under scope.
Trigger window controls act in a well-defined way on the behavior of the window, regard-
less for the type of the module (either IL or FBD) where the related trigger has been
inserted.
All controls except the Accumulator display are not accessible until at least one variable
is dragged into the Variables window.
Window controls are made accessible to users through the grey top half of the debug
window.
In order to remove the accumulator from the table, click its name in Symbol column, and
press the Del key.
This control can be very useful if a trigger was inserted before a ST statement, because
it allows you to know what value is being written in the destination variable, during the
current execution of the task. You can get the same result by moving the trigger to an
instruction following the one marked by the green arrowhead.
Trigger counter
This read-only control counts how many times the debug window manager has been trig-
gered, since the window was installed.
The window manager automatically resets this counter every time a new triggering ses-
sion is started.
Trigger state
This read-only control shows the user the state of the Debug window. It can assume the
following values.
The trigger has not occurred during the current task execution.
User-defined condition
If you define a condition by using this control, the values in the Debug window are re-
freshed every time the window manager is triggered and the user-defined condition is
true.
After you have entered a condition, the control displays its simplified expression.
Counters
These controls allow the user to define conditions on the trigger counter.
The trigger window can be in one of the following three states.
-- None: no counter has been started up, thus no condition has been specified upon the
trigger.
-- For: assuming that you gave the counter limit the value N, the window manager adds
1 to the current value of the counter and refreshes the value of its variables, each time
the debug window is triggered. However, when the counter equals N, the window stops
refreshing the values, and it changes to the Stop state.
-- After: assuming that you gave the counter limit the value N, the window manager re-
sets the counter and adds 1 to its current value each time it is triggered. The window
remains in the Ready state and does not update the value of its variables until the
counter reaches N.
The trigger window tool allows the user to select a set of variables and to have their val-
ues displayed and updated synchronously in a pop-up window. Unlike the Watch window,
trigger windows refresh simultaneously all the variables they contain, every time they are
triggered.
Let us assume that you have an IL module, also containing the following instructions.
Let us also assume that you want to know the value of b, d, and k, just before the ST k
instruction is executed. To do so, move the cursor to line 12.
Then you can click the Set/Remove trigger button in the Debug toolbar
In order to watch the value of a variable, you need to add it to the trigger window. To this
purpose, select a variable by double-clicking it, and then drag it into the Variables win-
dow, that is the lower white box in the pop-up window. The variable’s name now appears
in the Symbol column.
The same procedure applies to all the variables you wish to inspect.
Let us assume that you have an FBD module, also containing the following instructions.
Let us also assume that you want to know the values of C, D, and K, just before the ST
k instruction is executed.
Provided that you can never place a trigger in a block representing a variable such as
you must select the first available block preceding the selected variable. In the example
of the above figure, you must move the cursor to network 3, and click the ADD block.
You can click the Set/Remove trigger button in the Debug bar
When preprocessing FBD source code, the compiler translates it into IL instructions. The
ADD instruction in network 3 is expanded to:
LD k
ADD 1
ST k
When you add a trigger to an FBD block, you actually place the trigger before the first
statement of its IL equivalent code.
In order to watch the value of a variable, you need to add it to the trigger window. Let
us assume that you want to inspect the value of variable k of the FBD code in the figure
below.
To this purpose, press the Watch button in the FBD bar.
Now you can click the block representing the variable you wish to be shown in the trigger
window.
In the example we are considering, click the button block.
A dialog box appears listing all the currently existing instances of debug windows, and
asking you which one is to receive the object you have just clicked.
In order to display the variable k in the trigger window, select its reference in the Debug
windows column, then press OK. The name of the variable is now printed in the Symbol
column.
The same procedure applies to all the variables you wish to inspect.
Once you have added to the Graphic watch window all the variables you want to ob-
serve, you can press the normal cursor button, so as to let the cursor take back its original
shape.
Let us assume that you have an LD module, also containing the following instructions.
In this case, the same rules apply as to insert a trigger in an FBD module on a contact
or a coil
In this case, follow the SE instructions. Let us also assume that you want to know the
value of some variables every time the processor reaches network number 1.
First you must click one of the items making up network number 1. Now you can click the
Set/Remove trigger button in the Debug bar.
Unlike the other languages supported by Application, LD does not allow you to insert a
trigger into a single contact or coil, as it lets you select only an entire network. Thus the
variables in the trigger window will be refreshed every time the processor reaches the
beginning of the selected network.
In order to watch the value of a variable, you need to add it to the trigger window. Let
us assume that you want to inspect the value of variable b in the LD code represented in
the figure below.
To this purpose, press the Watch button in the FBD bar.
Now you can click the item representing the variable you wish to be shown in the trigger
window.
A dialog box appears listing all the currently existing instances of debug windows, and
asking you which one is to receive the object you have just clicked.
In order to display variable B in the trigger window, select its reference in the Debug win-
dow column, then press OK.
The name of the variable is now printed in the Symbol column.
The same procedure applies to all the variables you wish to inspect.
Once you have added to the Graphic watch window all the variables you want to ob-
serve, you can press the Normal cursor button, so as to restore the original shape of
the cursor.
Let us assume that you have an ST module, also containing the following instructions.
Let us also assume that you want to know the value of e, d, and f, just before the in-
struction
f := f+ SHR( d, 16#04 )
Not all the ST instructions support triggers. For example, it is not possible to place a trig-
ger on a line containing a terminator such as END_IF, END_FOR, END_WHILE, etc..
In order to watch the value of a variable, you need to add it to the trigger window. To this
purpose, select a variable, by double clicking it, and then drag it into the Variables win-
dow, that is the lower white box in the pop-up window. The variable name now appears
in the Symbol column.
The same procedure applies to all the variables you wish to inspect.
If you want a variable not to be displayed any more in the trigger window, select it by
clicking its name once, then press the Del key.
This paragraph deals with trigger windows controls, which allow you to better supervise
the working of this debugging tool to get more information on the code under scope. The
main purpose of trigger window controls is to let you define more limiting conditions, so
that variables in Variables window are refreshed when the processor reaches the trig-
ger location and these conditions are satisfied. If you do not use controls, variables are
refreshed every single time the processor reaches the relative trigger.
Enabling controls
When you set a trigger, all the elements in the Control window look disabled.
As a matter of fact, you cannot access any of the controls, except the Accumulator dis-
play, until at least one variable is dragged into the Debug window. When this happens
triggering automatically starts and the Controls window changes as follows.
In some cases, for example when a trigger is placed before a ST statement, it can be use-
ful to know the value of the accumulator. This allows you to forecast the outcome of the
instruction that will be executed after all the variables in the trigger window have been
updated. To add the accumulator to the trigger window, click on the Accumulator dis-
play button.
Defining a condition
This control enables users to set a condition on the occurrences of a trigger. By default,
this condition is set to TRUE, and the values in the debug window are refreshed every time
the window manager is triggered.
If you want to put a restriction on the refreshment mechanism, you can specify a condi-
tion by clicking on the apposite button.
When you do so, a text window pops up, where you can write the IL code that sets the
condition.
Once you have finished writing the condition code, click the OK button to install it, or press
the Esc button to cancel. If you choose to install it, the values in the debug window are
refreshed every time the window manager is triggered and the user-defined condition is
true.
A simplified expression of the condition now appears in the control.
The text window appears, containing the text you originally wrote, which you can now
edit.
To completely remove a user-defined condition, delete the whole IL code in the text win-
dow, then click OK.
After the execution of the condition code, the accumulator must be of type Boolean (TRUE
or FALSE), otherwise a compiler error occurs.
Only global variables and dragged-in variables can be used in the condition code. Namely,
all variables local to the module where the trigger was originally inserted are out of scope,
if they have not been dragged into the debug window. No new variables can be declared
in the condition window.
This web page deals with what you can do when you finish a debug session with a trigger
window. You can choose between the following options.
-- Closing the trigger window.
-- Removing the trigger.
-- Removing all the triggers.
Notice that the actions listed above produce very different results.
As a matter of fact, if later you want to resume debugging with a trigger window that you
previously hid, you just need to open the Trigger list window, to select the record
referred to that trigger window, and to click the Open button.
The interface window appears with value of variables and trigger counter updated, as if it
had not been closed.
Removing a trigger
If you choose this option, you completely remove the code both of the window manager
and of its trigger. To this purpose, just open the Trigger list window, select the record
referred to the trigger window you want to eliminate, and click the Remove button.
Alternatively, you can move the cursor to the line (if the module is in IL or ST), or click
the block (if the module is in FBD or LD) where you placed the trigger. Now press the Set/
Remove trigger button in the Debug toolbar.
Memory availability
A graphic trigger window takes all the free memory space in the application code sector.
Obviously, in order to start up a trigger window, it is necessary that a sufficient amount
of memory is available, otherwise an error message appears.
Setting a graphic trigger causes a pop-up window to appear, which is called Interface
window. This is the main interface for accessing the debugging functions that the graphic
trigger window makes available. It consists of several elements, as shown below.
Caption bar
Controls bar
Chart area
Variables
window
Where
To watch a variable, you need to copy it to the lower section of the Debug window.
Variables
window
This lower section of the Debug window is a table consisting of a row for each variable that
you dragged in. Each row has several fields, as shown in the picture below.
Field Description
Track Name of the variable.
Um Unit of measurement.
Min value Minimum value in the record set.
Max value Maximum value in the record set.
Cur value Current value of the variable.
How many engineering units are represented by a unit
v/div of the y-axis (i.e. the space between two ticks on the
vertical axis).
Value of the variable at the intersection with the line
Blue cursor
identified by the blue cursor.
Value of the variable at the intersection with the line
Red cursor
identified by the red cursor.
Value of the variable at the intersection with the line
Horz cursor
identified by the horizontal cursor.
Note that you can drag into the graphic trigger window only variables local to the module
where you placed the relative trigger, or global variables, or parameters. You cannot drag
variables declared in another program, or function, or function block.
This paragraph deals with controls of the Graphic trigger window. Controls allow you
to specify in detail when Application is supposed to sample the variables added to the
Variables window.
Graphic trigger window controls act in a well-defined way on the behavior of the window,
regardless for the type of the module (IL, ST, FBD or LD) where the related trigger has
been inserted.
Window controls are made accessible to users through the Controls bar of the debug
window.
Trigger counter
This read-only control displays two numbers with the following format: X/Y.
X indicates how many times the debug window manager has been triggered, since the
graphic trigger was installed.
Y represents the number of samples the graphic window has to collect before stopping
data acquisition and drawing the curves.
Trigger state
This read-only control shows you the state of the Debug window. It can assume the fol-
lowing values.
In order to open the options tab, you must click the Properties button in the Controls
bar. When you do this, the following dialog box appears.
General
Control
Control Description
Tick this control to display a grid in the Chart area
Show grid
background.
Show time The scroll bar at the bottom of the Chart area is
bar available as long as this box is checked.
The Variables window is shown as long as this box
Show tracks
is checked, otherwise the Chart area extends to the
list
bottom of the graphic trigger window.
Values
Control Description
Horizontal
Number of samples per unit of the x-axis. By unit of the
scale
x-axis the space is meant between two vertical lines of
the background grid.
Tracks
This tab allows you to define some graphic properties of the plot of each variable. To select
a variable, click its name in the Track list column.
Control Description
Unit of measurement, printed in the table of the
Unit
Variables window.
Δ value per unit of the y-axis. By unit of the y-axis is
Value/div meant the space between two horizontal lines of the
background grid.
Hide Check this flag to hide selected track on the graph.
Push Apply to make your changes effective, or push OK to apply your changes and to
close the options tab.
User-defined condition
If you define a condition by using this control, the sampling process does not start until
that condition is satisfied. Note that, unlike trigger windows, once data acquisition begins,
samples are taken every time the window manager is triggered, regardless of the user
condition being still true or not.
After you enter a condition, the control displays its simplified expression.
Let us assume that you have an IL module, also containing the following instructions.
Let us also assume that you want to know the value of b, d, and k, just before the ST k
instruction is executed. To do so, move the cursor to line 12.
A green arrowhead appears next to the line number, and the graphic trigger window pops
up.
Not all the IL instructions support triggers. For example, it is not possible to place a trig-
ger at the beginning of a line containing a JMP statement.
In order to get the diagram of a variable plotted, you need to add it to the graphic trigger
window. To this purpose, select a variable, by double clicking it, and then drag it into the
Variables window. The variable now appears in the Track column.
The same procedure applies to all the variables you wish to inspect.
Once the first variable is dropped into a graphic trace, the Graphic properties window
is automatically shown and allows the user to setup sampling and visualization properties.
Let us assume that you have an FBD module, also containing the following instructions.
Let us also assume that you want to know the values of c, d, and k, just before the ST
k instruction is executed.
Provided that you can never place a trigger in a block representing a variable such as
you must select the first available block preceding the selected variable. In the example
of the above figure, you must move the cursor to network 3, and click the ADD block.
Now click the Graphic trace button in the Debug toolbar.
This causes the colour of the selected block to turn to green, a white circle with the trig-
ger ID number inside to appear in the middle of the block, and the related trigger window
to pop up.
When preprocessing the FBD source code, compiler translates it into IL instructions. The
ADD instruction in network 3 is expanded to:
LD k
ADD 1
ST k
When you add a trigger to an FBD block, you actually place the trigger before the first
statement of its IL equivalent code.
In order to watch the diagram of a variable, you need to add it to the trigger window. Let
us assume that you want to see the plot of the variable k of the FBD code in the figure
below.
To this purpose, press the Watch button in the FBD bar.
Now you can click the block representing the variable you wish to be shown in the graphic
trigger window.
In the example we are considering, click the button block.
A dialog box appears listing all the currently existing instances of debug windows, and
asking you which one is to receive the object you have just clicked.
In order to plot the curve of variable k, select Graphic Trace in the Debug windows col-
umn, then press OK. The name of the variable is now printed in the Track column.
The same procedure applies to all the variables you wish to inspect.
Once you have added to the Graphic watch window all the variables you want to ob-
serve, you can press the Normal cursor button, in order to restore the original cursor.
Once the first variable is dropped into a graphic trace, the Graphic properties window
is automatically shown and allows the user to setup sampling and visualization properties.
Let us assume that you have an LD module, also containing the following instructions.
In this case, the same rules apply as to insert the graphic trigger in an FBD module on a
contact
or coil
In this case, follow the instructions. Let us also assume that you want to know the value
of some variables every time the processor reaches network number 1.
Click one of the items making up network nr. 1, then press the Graphic trace button in
the Debug toolbar.
This causes the grey raised button containing the network number to turn to green, a
white circle with a number inside to appear in the middle of the button, and the graphic
trigger window to pop up.
Note that unlike the other languages supported by Application, LD does not allow you to
insert a trigger before a single contact or coil, as it lets you select only an entire network.
Thus the variables in the Graphic trigger window will be sampled every time the pro-
cessor reaches the beginning of the selected network.
In order to watch the diagram of a variable, you need to add it to the Graphic trigger
window. Let us assume that you want to see the plot of the variable b in the LD code
represented in the figure below.
To this purpose, press the Watch button in the FBD bar.
Now you can click the item representing the variable you wish to be shown in the Graphic
trigger window.
A dialog box appears listing all the currently existing instances of debug windows, and
asking you which one is to receive the object you have just clicked.
In order to plot the curve of variable b, select Graphic trace in the Debug windows col-
umn, then press OK. The name of the variable is now printed in the Track column.
The same procedure applies to all the variables you wish to inspect.
Once you have added to the Graphic watch window all the variables you want to ob-
serve, you can press again the Normal cursor button, so as to restore the original shape
of the cursor.
Once the first variable is dropped into a graphic trace, the Graphic properties window
is automatically shown and allows the user to setup sampling and visualization properties.
Let us assume that you have an ST module, also containing the following instructions.
Let us also assume that you want to know the value of e, d, and f, just before the in-
struction
f := f+ SHR( d, 16#04 )
A green arrowhead appears next to the line number, and the Graphic trigger window
pops up.
Not all the ST instructions support triggers. For example, it is not possible to place a trig-
ger on a line containing a terminator such as END_IF, END_FOR, END_WHILE, etc.
In order to get the diagram of a variable plotted, you need to add it to the Graphic trig-
ger window. To this purpose, select a variable, by double clicking it, and then drag it into
the Variables window, that is the lower white box in the pop-up window. The variable
now appears in the Track column.
The same procedure applies to all the variables you wish to inspect.
Once the first variable is dropped into a graphic trace, the Graphic properties window
is automatically shown and allows the user to setup sampling and visualization properties.
If you want to remove a variable from the Graphic trigger window, select it by clicking its
name once, then press the Del key.
This paragraph deals with graphic trigger window controls, which allow you to better
supervise the working of this debugging tool, so as to get more information on the code
under scope.
Enabling controls
When you set a trigger, all the elements in the Control bar are enabled. You can start
data acquisition by clicking the Start graphic trace acquisition button.
If you defined a user condition, which is currently false, data acquisition does not start,
even though you press the apposite button.
On the contrary, once the condition becomes true, data acquisition starts and continues
until the Start graphic trace acquisition button is released, regardless for the con-
dition being or not still true.
if you release the Start graphic trace acquisition button before all the required
samples have been acquired, the acquisition process stops and all the collected data get
lost.
Defining a condition
This control enables users to set a condition on when to start acquisition. By default, this
condition is set to true, and acquisition begins as soon as you press the Enable/Disable
acquisition button. From that moment on, the value of the variables in the Debug win-
dow is sampled every time the trigger occurs.
In order to specify a condition, open the Condition tab of the Options dialog box, then
press the relevant button.
A text window pops up, where you can write the IL code that sets the condition.
Once you have finished writing the condition code, click the OK button to install it, or press
the Esc button to cancel. The collection of samples will not start until the Start graphic
trace acquisition button is pressed and the user-defined condition is true. A simplified
expression of the condition now appears in the control.
The text window appears, containing the text you originally wrote, which you can now
edit.
To completely remove a user-defined condition, press again on the above mentioned but-
ton, delete the whole IL code in the text window, then click OK.
After the execution of the condition code, the accumulator must be of type Boolean (TRUE
or FALSE), otherwise a compiler error occurs.
Only global variables and dragged-in variables can be used in the condition code. Namely,
all variables local to the module where the trigger was originally inserted are out of scope,
if they have not been dragged into the Debug window. Also, no new variables can be de-
clared in the condition window.
8.6.2.11 CLOSING THE GRAPHIC TRIGGER WINDOW AND REMOVING THE TRIGGER
At the end of a debug session with the graphic trigger window you can choose between
the following options:
-- Closing the Graphic trigger window.
-- Removing the trigger.
-- Removing all the triggers.
The Interface window appears with the trigger counter properly updated, as if it had
never been closed.
9. APPLICATION REFERENCE
Command Description
New project Lets you create a new Application project.
Import project
Lets you upload the project from the target device.
from target
Open project Lets you open an existing Application project.
View project Opens an existing Application project in read-only mode.
Same as Save all, but it saves also the ppj file. Note that,
since all modifications to a Application project are first applied
Save project
in memory only, you need to release the Save project
command to make them permanent.
Asks you to specify a new project name and a new location,
Save project As
and saves there a copy of all the files of the project.
Asks you whether you want to keep unsaved changes, then
Close project
closes the active project.
New text file Opens a blank new generic text file.
Opens an existing file, whatever its extension. The file is
Open file displayed in the text editor. Anyway, if you open a project file,
you actually open the Application project it refers to.
Save Lets you save the document in the currently active window.
Close Closes the document in the currently active window.
Options Opens the Programming environment options dialog box.
Displays a dialog box, which lets you set printing options and
Print
print the document in the currently active window.
Shows a picture on your video, that reproduces faithfully
Print preview what you get if you print the document in the currently active
window.
Print project Prints all the documents making up the project.
Printer setup Opens the Printer setup dialog box.
Lists a set of ppj file of recently opened Application projects.
..recent..
Click one of them, if you want to open the relevant project.
Exit Closes Application.
Command Description
Undo Cancels last change made in the document.
Redo Restores the last change canceled by Undo.
Removes the selected items from the active document and
Cut
stores them in a system buffer.
Copy Copies the selected items to a system buffer.
Pastes in the active document the contents of the system
Paste
buffer.
Delete Deletes the selected item.
Delete line Deletes the whole source code line.
Find in project Opens the Find in project dialog box.
Bookmarks Lets you set, remove, and move between bookmarks.
Allows you to quickly move to a specific line in the source
Go to line
code editor.
Asks you to type a string and searches for its first instance
Find within the active document from the current location of the
cursor.
Iterates the search previously performed by the Find
Find next
command.
Allows you to automatically replace one or all the instances of
Replace
a string with another string.
Insert/Move mode Editing mode which allows you to insert and move blocks.
Editing mode which allows you to draw logical wires to
Connection mode
connect pins.
Editing mode which allows you to add variables to any
Watch mode
debugging tool.
Command Description
Main Toolbar If checked, displays the Main toolbar, otherwise hides it.
Status bar If checked, displays the Status bar, otherwise hides it.
Debug bar If checked, displays the Debug bar, otherwise hides it.
FBD bar If checked, displays the FBD toolbar, otherwise hides it.
LD bar If checked, displays the LD toolbar, otherwise hides it.
SFC bar If checked, displays the SFC bar, otherwise hides it.
Project bar If checked, displays the Project bar, otherwise hides it.
Network If checked, displays the Network toolbar, otherwise hides it.
Document bar If checked, displays the Document bar, otherwise hides it.
If checked, displays the Workspace (also called Project
Workspace
window), otherwise hides it.
If checked, displays the Libraries window, otherwise hides
Library
it.
Output If checked, displays the Output window, otherwise hides it.
Command Description
Async Graphic If checked, displays the Oscilloscope window, otherwise
window hides it.
Watch window If checked, displays the Watch window, otherwise hides it.
Force I/O bar If checked, displays the Force I/O bar, otherwise hides it.
PLC run-time If checked, displays the PLC run-time window, otherwise hides
status it.
Expands the currently active document window to full screen.
Full screen Press Esc to restore the normal appearance of the Application
interface.
If checked, displays a dotted grid in a graphical source code
Grid
editor background.
Command Description
Opens another menu which lets you create a new POU or
New object
declare a new global variable.
Copy object Copies the object currently selected in the Workspace.
Paste object Pastes the previously copied object.
Duplicates the object currently selected in the Workspace, and
Duplicate object
asks you to type the name of the copy.
Deletes the currently selected object. As explained above, you
Delete object need to release the Save project command to definitively
erase a document from your project.
PLC object Shows properties and description of the object currently
properties selected in the Workspace.
Opens the Oject browser, which lets you navigate between
Object browser
objects.
Asks you whether to save unsaved changes, then launches
Compile
the Application compiler.
Recompile all Recompiles the project.
Generate
redistributable Generates an RSM file.
source module
Import object
Lets you import a Application object from a library.
from library
Export object to
Lets you export a Application object to a library.
library
Command Description
Simulation mode Open/close the integrated simulation environment.
Debug mode Switches the debug mode on.
Live debug mode Switches the live debug mode on.
Add symbol to
Adds a symbol to the Watch window.
watch
Insert new item
Inserts a new item into the Watch window.
into watch
Add symbol to a
Adds a symbol to a debug window.
debug window
Insert new item
into a debug Inserts a new item into a debug window.
window
Run Restarts program after a breakpoint is hit.
Add/Remove
Adds/removes a breakpoint.
breakpoint
Remove all
Removes all the active breakpoints.
breakpoints
Breakpoint list Lists all the active breakpoints.
Add/remove text
Adds/removes a text trigger.
trigger
Add/remove
Adds/removes a graphic trigger.
graphic trigger
Remove all
Removes all the active triggers.
triggers
Trigger list Lists all the active triggers.
Command Description
Set up
Lets you set the properties of the connection to the target.
communication...
Connect Application tries to establish a connection to the target.
Application checks if any changes have been applied since last
Download code compilation, if so compiles the project and then downloads
the source code to the target.
Lets you set the properties of the source code downloaded to
Download options
the target.
Force image
If the target device is connected, lets you upload the img file.
upload
Force debug If the target device is connected, lets you upload the debug
symbols upload symbols file.
Start/Stop watch
Freezes/resumes refreshment of the Watch window.
value
Network
Command Description
type
Network> New> Adds a blank network at the top of the active
LD/FBD
Top document.
Network> New> Adds a blank network at the bottom of the
LD/FBD
Bottom active document.
Network> New> Adds a blank network before the selected
LD/FBD
Before network in the active document.
Network >New > Adds a blank network after the selected network
LD/FBD
After in the active document.
Assigns a label to the selected network, so
Network >Label that it can be indicated as the target of a jump LD/FBD
instruction.
Lets you insert a new object into the selected
Object >New All
network.
Lets you to add/remove/change pins to
Object > Modify SFC
transitions.
Lets you assign a name to an instance of
Object >
a function block, that you have previously LD/FBD
Instance name
selected by clicking it once.
Opens the editor by which the selected object
was created, and displays the relevant source
code:
-- if the object is a program, or a function, or a
function block, this command opens its source
Object > code; LD/FBD
Open source
-- if the object is a variable or a parameter, this
command opens the corresponding variable
editor;
-- if the object is a standard function or an
operator, this command opens nothing.
Code Object > Lets you to add an action in the active
SFC
New Action document.
Code Object >
Lets you to dd a transition in the active
New Transiction SFC
document.
code
If checked, enables autoconnection, that is
Auto connect automatic creation of a logical wire linking the All
pins of two blocks, when they are brought close.
Delete invalid Removes all invalid connections, represented by
All
connection a red line in the active scheme.
Connect Paral Activates the parallel insertion mode. LD
Connect series Activates the series insertion mode. LD
By default some operators like ADD, MUL,
etc. have two input pins, however you may
occasionally need to perform such operations on
Increment pins LD/FBD
more than two operands. This command allows
you to add as many input pins as to reach the
required number of operands.
Network
Command Description
type
Command Description
Adds a new row to the table in the currently active editor (if
Insert PLC editor, to the table of local variables; if parameters editor,
to the table of parameters, etc.).
Deletes the variable in the selected row of the currently active
Delete
table.
Create multiple Lets you to create a set of multiple variables.
Opens a dialog box which lets you create and delete groups of
Group
variables.
Command Description
Displaces all open documents in cascade, so that they
Cascade
completely overlap except for the caption.
The PLC editors area is split into frames having the same
dimensions, depending on the number of currently open
Tile
documents. Each frame is automatically assigned to one of
such documents.
Displaces the icons of the minimized documents in the bottom
Arrange Icons
left-hand corner of the PLC editors area.
Close all Closes all open documents.
Command Description
Index Lists all the Help keywords and opens the related topic.
Context-sensitive help. Opens the topic related to the
Context
currently active window.
About... Information on producers and version.
9.2.3 LD TOOLBAR
Remove all
Removes all breakpoints.
breakpoints
Restarts program execution after a breakpoint is
Run
hit.
Textual documents and textual elements of graphic languages are written by using the
standard ASCII character set.
10.1.1.2 COMMENTS
User comments are delimited at the beginning and end by the special character combina-
tions “(*” and “*)”, respectively. Comments are permitted anywhere in the program,
and they have no syntactic or semantic significance in any of the languages defined in
this standard.
The use of nested comments, e.g., (* (* NESTED *) *), is treated as an error.
NOTE: the actual implementation of the BOOL data type depends on the processor of the target
device, e.g. it is 1 bit long for devices that have a bit-addressable area.
10.1.3.1 TYPEDEFS
An enumerated data type declaration specifies that the value of any data element of that
type can only be one of the values given in the associated list of identifiers. The enumera-
tion list defines an ordered set of enumerated values, starting with the first identifier of
the list, and ending with the last.
Enumerated data types can be declared using the following syntax:
TYPE
<enumerated data type name> : ( <enumeration list> );
END_TYPE
For example, consider the following declaration of two enumerated data types. Note that,
when no explicit value is given to an identifier in the enumeration list, its value equals the
value assigned to the previous identifier augmented by one.
TYPE
enum1: (
val1, (* the value of val1 is 0 *)
val2, (* the value of val2 is 1 *)
val3 (* the value of val3 is 2 *)
);
enum2: (
k := -11,
i := 0,
j, (* the value of j is ( i + 1 ) = 1 *)
l := 5
);
END_TYPE
Different enumerated data types may use the same identifiers for enumerated values. In
order to be uniquely identified when used in a particular context, enumerated literals may
be qualified by a prefix consisting of their associated data type name and the # sign.
10.1.3.3 SUBRANGES
A subrange declaration specifies that the value of any data element of that type is re-
stricted between and including the specified upper and lower limits.
Subranges can be declared using the following syntax:
TYPE
<subrange name> : <parent type name> ( <lower limit>..<upper limit>
);
END_TYPE
For a concrete example consider the following declaration:
TYPE
int_0_to_100 : INT (0..100);
END_TYPE
10.1.3.4 STRUCTURES
A STRUCT declaration specifies that data elements of that type shall contain sub-elements
of specified types which can be accessed by the specified names.
Structures can be declared using the following syntax:
TYPE
<structured type name> : STRUCT
<declaration of stucture elements>
END_STRUCT;
END_TYPE
For example, consider the following declaration:
TYPE
structure1 : STRUCT
elem1 : USINT;
elem2 : USINT;
elem3 : INT;
elem3 : REAL;
END_STRUCT;
END_TYPE
10.1.4 LITERALS
A character string literal is a sequence of zero or more characters prefixed and terminated
by the single quote character (').
The three-character combination of the dollar sign ($) followed by two hexadecimal digits
shall be interpreted as the hexadecimal representation of the eight-bit character code.
Example Explanation
'' Empty string (length zero)
'A' String of length one containing the single character A
' ' String of length one containing the space character
'$'' String of length one containing the single quote character
Example Explanation
'”' String of length one containing the double quote character
'$R$L' String of length two containing CR and LF characters
'$0A' String of length one containing the LF character
Two-character combinations beginning with the dollar sign shall be interpreted as shown
in the following table when they occur in character strings.
10.1.5 VARIABLES
10.1.5.1 FOREWORD
Variables provide a means of identifying data objects whose contents may change, e.g.,
data associated with the inputs, outputs, or memory of the programmable controller. A
variable must be declared to be one of the elementary types. Variables can be represent-
ed symbolically, or alternatively in a manner which directly represents the association of
the data element with physical or logical locations in the programmable controller’s input,
output, or memory structure.
Each program organization unit (POU) (i.e., each program, function, or function block)
contains at its beginning at least one declaration part, consisting of one or more structur-
ing elements, which specify the types (and, if necessary, the physical or logical location)
of the variables used in the organization unit. This declaration part has the textual form of
one of the keywords VAR, VAR_INPUT, or VAR_OUTPUT as defined in the keywords section,
followed in the case of VAR by zero or one occurrence of the qualifiers RETAIN, NON_RE-
TAIN or the qualifier CONSTANT, and in the case of VAR_INPUT or VAR_OUTPUT by zero or
one occurrence of the qualifier RETAIN or NON_RETAIN, followed by one or more decla-
rations separated by semicolons and terminated by the keyword END_VAR. A declaration
may also specify an initialization for the declared variable, when a programmable control-
ler supports the declaration by the user of initial values for variables.
The declaration of a variable must be performed within the following program structuring
element:
KEYWORD [RETAIN] [CONSTANT]
Declaration 1
Declaration 2
...
Declaration N
END_VAR
The scope (range of validity) of the declarations contained in structuring elements is local
to the program organization unit (POU) in which the declaration part is contained. That
is, the declared variables are accessible to other program organization units except by
explicit argument passing via variables which have been declared as inputs or outputs
of those units. The one exception to this rule is the case of variables which have been
declared to be global. Such variables are only accessible to a program organization unit
via a VAR_EXTERNAL declaration. The type of a variable declared in a VAR_EXTERNAL must
agree with the type declared in the VAR_GLOBAL block.
There is an error if:
-- any program organization unit attempts to modify the value of a variable that has been
declared with the CONSTANT qualifier;
-- a variable declared as VAR_GLOBAL CONSTANT in a configuration element or program or-
ganization unit (the “containing element”) is used in a VAR_EXTERNAL declaration (with-
out the CONSTANT qualifier) of any element contained within the containing element.
10.1.5.4 QUALIFIERS
Qualifier Description
The attribute CONST indicates that the variables within
the structuring elements are constants, i.e. they have
CONST
a constant value, which cannot be modified once the
PLC project has been compiled.
The attribute RETAIN indicates that the variables
within the structuring elements are retentive, i.e. they
RETAIN
keep their value even after the target device is reset
or switched off.
A single-element variable represents a single data element of either one of the elemen-
tary types or one of the derived data types.
An array is a collection of data elements of the same data type; in order to access a single
element of the array, a subscript (or index) enclosed in square brackets has to be used.
Subscripts can be either integer literals or single-element variables.
To easily represent data matrices, arrays can be multi-dimensional; in this case, a com-
posite subscript is required, one index per dimension, separated by commas. The maxi-
mum number of dimensions allowed in the definition of an array is three.
Variables must be declared within structuring elements, using the following syntax:
VarName1 : Typename1 [ := InitialVal1 ];
VarName2 AT Location2 : Typename2 [ := InitialVal2 ];
VarName3 : ARRAY [ 0..N ] OF Typename3;
where:
Keyword Description
Variable identifier, consisting of a string of
VarNameX alphanumeric characters, of length 1 or more. It is
used for symbolic representation of variables.
Data type of the variable, selected from elementary
TypenameX
data types.
The value the variable assumes after reset of the
InitialValX
target.
LocationX See the next paragraph.
Index of the last element, the array having length
N
N + 1.
10.1.5.7 LOCATION
Variables can be represented symbolically, i.e. accessed through their identifier, or alter-
natively in a manner which directly represents the association of the data element with
physical or logical locations in the programmable controller’s input, output, or memory
structure.
Direct representation of a single-element variable is provided by a special symbol formed
by the concatenation of the percent sign “%” , a location prefix and a size prefix, and one
or two unsigned integers, separated by periods (.).
%location.size.index.index
1) location
The location prefix may be one of the following:
2) size
The size prefix may be one of the following:
3) index.index
This sequence of unsigned integers, separated by dots, specifies the actual position
of the variable in the area specified by the location prefix.
Example:
Note that the absolute position depends on the size of the datablock elements, not on the
size prefix. As a matter of fact, %MW4.6 and %MD4.6 begin from the same byte in memory,
but the former points to an area which is 16 bits shorter than the latter.
For advanced users only: if the index consists of one integer only (no dots), then it loses
any reference to datablocks, and it points directly to the byte in memory having the index
value as its absolute address.
Example
VAR [RETAIN] [CONSTANT]
XQuote : DINT; Enabling : BOOL := FALSE;
TorqueCurrent AT %MW4.32 : INT;
Counters : ARRAY [ 0 .. 9 ] OF UINT;
Limits: ARRAY [0..3, 0..9]
END_VAR
-- Variable XQuote is 32 bits long, and it is automatically allocated by the Application com-
piler.
-- Variable Enabling is initialized to FALSE after target reset.
-- Variable TorqueCurrent is allocated in the memory area of the target device, and it
takes 16 bits starting from the first byte of the 33rd element of datablock 4.
-- Variable Counters is an array of 10 independent variables of type unsigned integer.
Whatever the PLC language you are using, Application allows you to disregard the syntax
above, as it supplies the Local variables editor, the Global variables editor, and the Param-
eters editor, which provide a friendly interface to declare all kinds of variables.
10.1.6.1 FUNCTIONS
Introduction
For the purposes of programmable controller programming languages, a function is de-
fined as a program organization unit (POU) which, when executed, yields exactly one data
element, which is considered to be the function result.
Functions contain no internal state information, i.e., invocation of a function with the
same arguments (input variables VAR_INPUT and in-out variables VAR_IN_OUT) always
yields the same values (output variables VAR_OUTPUT, in-out variables VAR_IN_OUT and
function result).
Declaration syntax
The declaration of a function must be performed as follows:
FUNCTION FunctionName : RetDataType
VAR_INPUT
declaration of input variables (see the relevant section)
END_VAR
VAR
declaration of local variables (see the relevant section)
END_VAR
Function body
END_FUNCTION
Keyword Description
FunctionName Name of the function being declared.
RetDataType Data type of the value to be returned by the function.
Specifies the operations to be performed upon the
input variables in order to assign values dependent on
the function’s semantics to a variable with the same
Function body
name as the function, which represents the function
result. It can be written in any of the languages
supported by Application.
In order to execute its operations, a function block needs to be invoked by another POU.
Invocation depends on the specific language of the module calling the function block.
The scope of an instance of a function block is local to the program organization unit in
which it is instantiated.
Declaration syntax
The declaration of a function must be performed as follows:
FUNCTION_BLOCK FunctionBlockName
VAR_INPUT
declaration of input variables (see the relevant section)
END_VAR
VAR_OUTPUT
declaration of output variables
END_VAR
VAR_EXTERNAL
declaration of external variables
END_VAR
VAR
declaration of local variables
END_VAR
Function block body
END_FUNCTION_BLOCK
Keyword Description
10.1.6.3 PROGRAMS
Introduction
A program is defined in IEC 61131-1 as a “logical assembly of all the programming lan-
guage elements and constructs necessary for the intended signal processing required for
the control of a machine or process by a programmable controller system.
Declaration syntax
The declaration of a program must be performed as follows:
PROGRAM < program name>
Declaration of variables (see the relevant section)
Program body
END_PROGRAM
Keyword Description
Program Name Name of the program being declared.
Specifies the operations to be performed to get the
Program body intended signal processing. It can be written in any of
the languages supported by Application.
TO_BOOL
Description Conversion to BOOL (boolean)
Number of operands 1
Input data type Any numerical type
Output data type BOOL
out := TO_BOOL( 0 ); (* out = FALSE *)
Examples out := TO_BOOL( 1 ); (* out = TRUE *)
out := TO_BOOL( 1000 ); (* out = TRUE *)
TO_SINT
Description Conversion to SINT (8-bit signed integer)
Number of operands 1
Input data type Any numerical type
Output data type SINT
out := TO_SINT( -1 ); (* out = -1 *)
Examples
out := TO_SINT( 16#100 ); (* out = 0 *)
TO_USINT
Description Conversion to USINT (8-bit unsigned integer)
Number of operands 1
Input data type Any numerical type
Output data type USINT
out := TO_USINT( -1 ); (* out = 255 *)
Examples
out := TO_USINT( 16#100 ); (* out = 0 *)
TO_INT
Description Conversion to INT (16-bit signed integer)
Number of operands 1
Input data type Any numerical type
Output data type INT
out := TO_INT( -1000.0 ); (* out = -1000 *)
Examples
out := TO_INT( 16#8000 ); (* out = -32768 *)
TO_UINT
Description Conversion to UINT (16-bit unsigned integer)
Number of operands 1
Input data type Any numerical type
Output data type UINT
out := TO_UINT( 1000.0 ); (* out = 1000 *)
Examples
out := TO_UINT( 16#8000 ); (* out = 32768 *)
TO_DINT
Description Conversion to DINT (32-bit signed integer)
Number of operands 1
Input data type Any numerical type
Output data type DINT
out := TO_DINT( 10.0 ); (* out = 10 *)
Examples
out := TO_DINT( 16#FFFFFFFF ); (* out = -1 *)
TO_UDINT
Description Conversion to UDINT (32-bit unsigned integer)
Number of operands 1
Input data type Any numerical type
Output data type UDINT
out := TO_UDINT( 10.0 ); (* out = 10 *)
Examples
out := TO_UDINT( 16#FFFFFFFF ); (* out = 4294967295 *)
TO_BYTE
Description Conversion to BYTE (8-bit string)
Number of operands 1
Input data type Any numerical type
Output data type BYTE
out := TO_BYTE( -1 ); (* out = 16#FF *)
Examples
out := TO_BYTE( 16#100 ); (* out = 16#00 *)
TO_WORD
Description Conversion to WORD (16-bit string)
Number of operands 1
Input data type Any numerical type
Output data type WORD
out := TO_WORD( 1000.0 ); (* out = 16#03E8 *)
Examples
out := TO_WORD( -32768 ); (* out = 16#8000 *)
TO_DWORD
Description Conversion to DWORD (32-bit string)
Number of operands 1
Input data type Any numerical type
Output data type DWORD
out := TO_DWORD( 10.0 ); (* out = 16#0000000A *)
Examples
out := TO_DWORD( -1 ); (* out = 16#FFFFFFFF *)
TO_REAL
Description Conversion to REAL (32-bit floating point)
Number of operands 1
Input data type Any numerical type
Output data type REAL
out := TO_REAL( -1000 ); (* out = -1000.0 *)
Examples
out := TO_REAL( 16#8000 ); (* out = -32768.0 *)
TO_LREAL
Description Conversion to LREAL (64-bit floating point)
Number of operands 1
Input data type Any numerical type
Output data type LREAL
out := TO_LREAL( -1000 ); (* out = -1000.0 *)
Examples
out := TO_LREAL( 16#8000 ); (* out = -32768.0 *)
Numerical functions
The availability of the following functions depends on the target device. Please refer to
your hardware supplier for details.
ABS
Description Absolute value. Computes the absolute value of input #0
Number of operands 1
Input data type Any numerical type
Output data type Same as input
OUT := ABS( -5 );(* OUT = 5 *)
Examples OUT := ABS( -1.618 );(* OUT = 1.618 *)
OUT := ABS( 3.141592 );(* OUT = 3.141592 *)
SQRT
Description Square root. Computes the square root of input #0
Number of operands 1
Input data type LREAL where available, REAL otherwise
Output data type LREAL where available, REAL otherwise
Examples OUT := SQRT( 4.0 ); (* OUT = 2.0 *)
LN
Natural logarithm. Computes the logarithm with base e of
Description
input #0
Number of operands 1
Input data type LREAL where available, REAL otherwise
Output data type LREAL where available, REAL otherwise
Examples OUT := LN( 2.718281 ); (* OUT = 1.0 *)
LOG
Common logarithm. Computes the logarithm with base 10 of
Description
input #0
Number of operands 1
Input data type LREAL where available, REAL otherwise
Output data type LREAL where available, REAL otherwise
Examples OUT := LOG( 100.0 );(* OUT = 2.0 *)
EXP
Natural exponential. Computes the exponential function of
Description
input #0
Number of operands 1
Input data type LREAL where available, REAL otherwise
Output data type LREAL where available, REAL otherwise
Examples OUT := EXP( 1.0 ); (* OUT ~ 2.718281 *)
SIN
Sine. Computes the sine function of input #0 expressed in
Description
radians
Number of operands 1
Input data type LREAL where available, REAL otherwise
Output data type LREAL where available, REAL otherwise
OUT := SIN( 0.0 ); (* OUT = 0.0 *)
Examples
OUT := SIN( 2.5 * 3.141592 ); (* OUT ~ 1.0 *)
COS
Cosine. Computes the cosine function of input #0 expressed
Description
in radians
Number of operands 1
Input data type LREAL where available, REAL otherwise
Output data type LREAL where available, REAL otherwise
OUT := COS( 0.0 ); (* OUT = 1.0 *)
Examples
OUT := COS( -3.141592 ); (* OUT ~ -1.0 *)
TAN
Tangent. Computes the tangent function of input #0
Description
expressed in radians
Number of operands 1
Input data type LREAL where available, REAL otherwise
Output data type LREAL where available, REAL otherwise
OUT := TAN( 0.0 ); (* OUT = 0.0 *)
Examples
OUT := TAN( 3.141592 / 4.0 ); (* OUT ~ 1.0 *)
ASIN
Arc sine. Computes the principal arc sine of input #0; result
Description
is expressed in radians
Number of operands 1
Input data type LREAL where available, REAL otherwise
Output data type LREAL where available, REAL otherwise
OUT := ASIN( 0.0 ); (* OUT = 0.0 *)
Examples
OUT := ASIN( 1.0 ); (* OUT = PI / 2 *)
ACOS
Arc cosine. Computes the principal arc cosine of input #0;
Description
result is expressed in radians
Number of operands 1
Input data type LREAL where available, REAL otherwise
Output data type LREAL where available, REAL otherwise
OUT := ACOS( 1.0 ); (* OUT = 0.0 *)
Examples
OUT := ACOS( -1.0 ); (* OUT = PI *)
ATAN
Arc tangent. Computes the principal arc tangent of input
Description
#0; result is expressed in radians
Number of operands 1
Input data type LREAL where available, REAL otherwise
Output data type LREAL where available, REAL otherwise
OUT := ATAN( 0.0 ); (* OUT = 0.0 *)
Examples
OUT := ATAN( 1.0 ); (* OUT = PI / 4 *)
ADD
Description Arithmetic addition. Computes the sum of the two inputs.
Number of operands 2
Input data type Any numerical type, Any numerical type
Output data type Same as Inputs
Examples OUT := ADD( 20, 40 ); (* OUT = 60 *)
MUL
Description Arithmetic multiplication. Multiplies the two inputs.
Number of operands 2
Input data type Any numerical type, Any numerical type
Output data type Same as Inputs
Examples OUT := MUL( 10, 10 ); (* OUT = 100 *)
SUB
Description Arithmetic subtraction. Subtracts input #1 from input #0
Number of operands 2
Input data type Any numerical type, Any numerical type
Output data type Same as Inputs
Examples OUT := SUB( 10, 3 ); (* OUT = 7 *)
DIV
Description Arithmetic division. Divides input #0 by input #1
Number of operands 2
Input data type Any numerical type, Any numerical type
Output data type Same as Inputs
Examples OUT := DIV( 20, 2 ); (* OUT = 10 *)
MOD
Description Module. Computes input #0 module input #1
Number of operands 2
Input data type Any numerical type, Any numerical type
Output data type Same as Inputs
Examples OUT := MOD( 10, 3 ); (* OUT = 1 *)
POW
Description Exponentiation. Raises Base to the power Expo
Number of operands 2
LREAL where available, REAL otherwise;
Input data type
LREAL where available, REAL otherwise
Output data type LREAL where available, REAL otherwise
OUT := POW( 2.0, 3.0 ); (* OUT = 8.0 *)
Examples
OUT := POW( -1.0, 5.0 ); (* OUT = -1.0 *)
ATAN2*
Arc tangent (with 2 parameters). Computes the principal arc
Description
tangent of Y/X; result is expressed in radians
Number of operands 2
LREAL where available, REAL otherwise;
Input data type
LREAL where available, REAL otherwise
Output data type LREAL where available, REAL otherwise
OUT := ATAN2( 0.0, 1.0 ); (* OUT = 0.0 *)
OUT := ATAN2( 1.0, 1.0 ); (* OUT = PI / 4 *)
Examples OUT := ATAN2( -1.0, -1.0 ); (* OUT = ( -3/4 ) * PI
*)
OUT := ATAN2( 1.0, 0.0 ); (* OUT = PI / 2 *)
SINH*
Hyperbolic sine. Computes the hyperbolic sine function of
Description
input #0
Number of operands 1
Input data type LREAL where available, REAL otherwise
Output data type LREAL where available, REAL otherwise
Examples OUT := SINH( 0.0 ); (* OUT = 0.0 *)
COSH*
Hyperbolic cosine. Computes the hyperbolic cosine function
Description
of input #0
Number of operands 1
Input data type LREAL where available, REAL otherwise
Output data type LREAL where available, REAL otherwise
Examples OUT := COSH( 0.0 ); (* OUT = 1.0 *)
TANH*
Hyperbolic tangent. Computes the hyperbolic tangent
Description
function of input #0
Number of operands 1
Input data type LREAL where available, REAL otherwise
Output data type LREAL where available, REAL otherwise
Examples OUT := TANH( 0.0 ); (* OUT = 0.0 *)
CEIL*
Rounding up to integer. Returns the smallest integer that is
Description
greater than or equal to input #0
Number of operands 1
Input data type LREAL where available, REAL otherwise
Output data type LREAL where available, REAL otherwise
OUT := CEIL( 1.95 ); (* OUT = 2.0 *)
Examples
OUT := CEIL( -1.27 ); (* OUT = -1.0 *)
FLOOR*
Rounding down to integer. Returns the largest integer that is
Description
less than or equal to input #0
Number of operands 1
Input data type LREAL where available, REAL otherwise
Output data type LREAL where available, REAL otherwise
OUT := FLOOR( 1.95 ); (* OUT = 1.0 *)
Examples
OUT := FLOOR( -1.27 ); (* OUT = -2.0 *)
SHL
Description Input#0 left-shifted of Input #1 bits, zero filled on the right.
Number of operands 2
Input data type Any numerical type, Any numerical type
Output data type Same as Input #0
OUT := SHL( IN := 16#1000CAFE, 16 );
Examples
(* OUT = 16#CAFE0000 *)
SHR
Input #0 right-shifted of Input #1 bits, zero filled on the
Description
left.
Number of operands 2
Input data type Any numerical type, Any numerical type
Output data type Same as Input #0
OUT := SHR( IN := 16#1000CAFE, 24 );
Examples
(* OUT = 16#00000010 *)
ROL
Description Input #0 left-shifted of Input #1 bits, circular.
Number of operands 2
Input data type Any numerical type, Any numerical type
Output data type Same as Input #0
OUT := ROL( IN := 16#1000CAFE, 4 );
Examples
(* OUT = 16#000CAFE1 *)
ROR
Description Input #0 right-shifted of Input #1 bits, circular.
Number of operands 2
Input data type Any numerical type, Any numerical type
Output data type Same as Input #0
OUT := ROR( IN := 16#1000CAFE, 16 );
Examples
(* OUT = 16#CAFE1000 *)
AND
Logical AND if both Input #0 and Input #1 are BOOL,
Description
otherwise bitwise AND.
Number of operands 2
Input data type Any but STRING, Any but STRING
Output data type Same as Inputs
OUT := TRUE AND FALSE; (* OUT = FALSE *)
Examples
OUT := 16#1234 AND 16#5678; (* OUT = 16#1230 *)
OR
Logical OR if both Input #0 and Input #1 are BOOL,
Description
otherwise bitwise OR.
Number of operands 2
Input data type Any but STRING, Any but STRING
Output data type Same as Inputs
OUT := TRUE OR FALSE; (* OUT = FALSE *)
Examples
OUT := 16#1234 OR 16#5678;(* OUT = 16#567C *)
XOR
Logical XOR if both Input #0 and Input #1 are BOOL,
Description
otherwise bitwise XOR.
Number of operands 2
Input data type Any but STRING, Any but STRING
Output data type Same as Inputs
OUT := TRUE OR FALSE; (* OUT = TRUE *)
Examples
OUT := 16#1234 OR 16#5678; (* OUT = 16#444C *)
NOT
Description Logical NOT if Input is BOOL, otherwise bitwise NOT.
Number of operands 1
Input data type Any but STRING
Output data type Same as Inputs
OUT := NOT FALSE; (* OUT = TRUE *)
Examples
OUT := NOT 16#1234;(* OUT = 16#EDCB *)
Selection functions
SEL
Description Binary selection
Number of operands 3
Input data type BOOL, Any, Any
Output data type Same as selected Input
OUT := SEL( G := FALSE, IN0 := X, IN1 := 5 );
Examples
(* OUT = X *)
MAX
Description Maximum value selection
Number of operands 2, extensible
Any numerical type, Any numerical type, .., Any numerical
Input data type
type
Output data type Same as max Input
Examples OUT := MAX( -8, 120, -1000 ); (* OUT = 120 *)
MIN
Description Minimum value selection
Number of operands 2, extensible
Any numerical type, Any numerical type, .., Any numerical
Input data type
type
Output data type Same as min Input
Examples OUT := MIN( -8, 120, -1000 ); (* OUT = -1000 *)
LIMIT
Limits Input #0 to be equal or more than Input#1, and equal or
Description
less than Input #2.
Number of operands 3
Input data type Any numerical type, Any numerical type, Any numerical type
Output data type Same as Inputs
OUT := LIMIT( IN := 4, MN := 0, MX := 5 ); (* OUT = 4 *)
Examples OUT := LIMIT( IN := 88, MN := 0, MX := 5 );(* OUT = 5 *)
OUT := LIMIT( IN := -1, MN := 0, MX := 5 );(* OUT = 0 *)
MUX
Description Multiplexer. Selects one of N inputs depending on input K
Number of operands 3, extensible
Any numerical type, Any numerical type, ..., Any numerical
Input data type
type
Output data type Same as selected Input
Examples OUT := MUX( 0, A, B, C ); (* OUT = A *)
Comparison functions
Comparison functions can be also used to compare strings if this feature is supported by
target device.
GT
Greater than. Returns TRUE if Input #0 > Input #1,
Description
otherwise FALSE.
Number of operands 2
Input data type Any but BOOL, Any but BOOL
Output data type BOOL
OUT := GT( 0, 20 ); (* OUT = FALSE *)
Examples
OUT := GT( ‘pippo’, ‘pluto’ ); (* OUT = TRUE *)
GE
Greater than or equal to. Returns TRUE if Input #0 >=
Description
Input #1, otherwise FALSE.
Number of operands 2
Input data type Any but BOOL, Any but BOOL
Output data type BOOL
OUT := GE( 20, 20 ); (* OUT = TRUE *)
Examples
OUT := GE( ‘pippo’, ‘pluto’ ); (* OUT = FALSE *)
EQ
Equal to. Returns TRUE if Input #0 = Input #1, otherwise
Description
FALSE.
Number of operands 2
Input data type Any, Any
Output data type BOOL
OUT := EQ( TRUE, FALSE ); (* OUT = FALSE *)
Examples
OUT := EQ( ‘pippo’, ‘pluto’ ); (* OUT = FALSE *)
LT
Less than. Returns TRUE if Input #0 < Input #1, otherwise
Description
FALSE.
Number of operands 2
Input data type Any but BOOL, Any but BOOL
Output data type BOOL
OUT := LT( 0, 20 ); (* OUT = TRUE *)
Examples
OUT := LT( ‘pipp’, ‘pluto’ ); (* OUT = TRUE *)
LE
Less than or equal to. Returns TRUE if Input #0 <= Input
Description
#1, otherwise FALSE.
Number of operands 2
Input data type Any but BOOL, Any but BOOL
Output data type BOOL
OUT := LE( 20, 20 ); (* OUT = TRUE *)
Examples
OUT := LE( ‘pipp’, ‘pluto’ ); (* OUT = TRUE *)
NE
Not equal to. Returns TRUE if Input #0 != Input #1,
Description
otherwise FALSE.
Number of operands 2
Input data type Any, Any
Output data type BOOL
OUT := NE( TRUE, FALSE ); (* OUT = TRUE *)
Examples
OUT := NE( ‘pipp’, ‘pluto’ ); (* OUT = TRUE *)
String functions
The availability of the following functions depends on the target device. Please refer to
your hardware supplier for details.
CONCAT
Description Character string concatenation
Number of operands 2
Input data type STRING, STRING
Output data type STRING
Examples OUT := CONCAT( ‘AB’, ‘CD’ ); (* OUT = ‘ABCD’ *)
DELETE
Delete L characters of IN, beginning at the P-th character
Description
position
Number of operands 3
Input data type STRING, UINT, UINT
Output data type STRING
OUT := DELETE( IN := ‘ABXYC’, L := 2, P := 3 );
Examples
(* OUT = ‘ABC’ *)
FIND
Find the character position of the beginning of the first occurrence
Description
of IN2 in IN1. If no occurrence of IN2 is found, then OUT := 0.
Number of operands 2
Input data type STRING, STRING
Output data type UINT
Examples OUT := FIND( IN1 := ‘ABCBC’, IN2 := ‘BC’ ); (* OUT = 2 *)
INSERT
Description Insert IN2 into IN1 after the P-th character position
Number of operands 3
Input data type STRING, STRING, UINT
Output data type STRING
OUT := INSERT( IN1 := ‘ABC’, IN2 := ‘XY’, P := 2 );
Examples
(* OUT = ‘ABXYC’ *)
LEFT
Description Leftmost L characters of IN
Number of operands 2
Input data type STRING, UINT
Output data type STRING
Examples OUT := LEFT( IN := ‘ASTR’, L := 3 ); (* OUT = ‘AST’ *)
MID
Description L characters of IN, beginning at the P-th
Number of operands 3
Input data type STRING, UINT, UINT
Output data type STRING
OUT := MID( IN := ‘ASTR’, L := 2, P := 2 );
Examples
(* OUT = ‘ST’ *)
REPLACE
Replace L characters of IN1 by IN2, starting at the P-th
Description
character position
Number of operands 4
Input data type STRING, STRING, UINT, UINT
Output data type STRING
OUT := REPLACE( IN1 := ‘ABCDE’, IN2 := ‘X’, L := 2, P
Examples
:= 3 ); (* OUT = ‘ABXE’ *)
RIGHT
Description Rightmost L characters of IN
Number of operands 2
Input data type STRING, UINT
Output data type STRING
Examples OUT := RIGHT( IN := ‘ASTR’, L := 3 ); (* OUT = ‘STR’ *)
Example
Let us parse a small piece of code:
START:
LD %IX1 (* Push button *)
ANDN %MX5.4 (* Not inhibited *)
ST %QX2 (* Fan out *)
The elements making up each instruction are classified as follows:
Operator
Label Operand Comment
[+ modifier]
START: LD %IX1 (* Push button *)
ANDN %MX5.4 (* Not inhibited *)
ST %QX2 (* Fan out *)
Semantics of IL instructions
-- Accumulator
By accumulator a register is meant containing the value of the currently evaluated re-
sult.
-- Operators
Unless otherwise specified, the semantics of the operators is
accumulator := accumulator OP operand
That is, the value of the accumulator is replaced by the result yielded by operation OP
applied to the current value of the accumulator itself, with respect to the operand. For
instance, the instruction “AND %IX1” is interpreted as
accumulator := accumulator AND %IX1
and the instruction “GT %IW10” will have the Boolean result TRUE if the current value
of the accumulator is greater than the value of input word 10, and the Boolean result
FALSE otherwise:
accumulator := accumulator GT %IW10
-- Modifiers
The modifier “N” indicates bitwise negation of the operand.
The left parenthesis modifier “(” indicates that evaluation of the operator must be de-
ferred until a right parenthesis operator “)” is encountered. The form of a parenthesized
sequence of instructions is shown below, referred to the instruction
accumulator := accumulator AND (%MX1.3 OR %MX1.4)
The modifier “C” indicates that the associated instruction can be performed only if the
value of the currently evaluated result is Boolean 1 (or Boolean 0 if the operator is com-
bined with the “N” modifier).
Supported operand
Operator Modifiers types: Acc_type, Semantics
Op_type
Sets the accumulator equal to
LD N Any, Any
operand.
Stores the accumulator into
ST N Any, Any
operand location.
Sets operand to TRUE if
S BOOL, BOOL
accumulator is TRUE.
Sets operand to FALSE if
R BOOL, BOOL
accumulator is TRUE.
Any but REAL, Any but
AND N, ( Logical or bitwise AND
REAL
Any but REAL, Any but
OR N, ( Logical or bitwise OR
REAL
Any but REAL, Any but
XOR N, ( Logical or bitwise XOR
REAL
NOT Any but REAL Logical or bitwise NOT
ADD ( Any but BOOL Addition
SUB ( Any but BOOL Subtraction
MUL ( Any but BOOL Multiplication
DIV ( Any but BOOL Division
MOD ( Any but BOOL Modulo-division
GT ( Any but BOOL Comparison:
GE ( Any but BOOL Comparison: =
EQ ( Any but BOOL Comparison: =
NE ( Any but BOOL Comparison:
LE ( Any but BOOL Comparison:
LT ( Any but BOOL Comparison:
JMP C, N Label Jumps to label
CAL C, N FB instance name Calls function block
Returns from called program,
RET C, N
function, or function block.
) Evaluates deferred operation.
Functions (as defined in the relevant section) are invoked by placing the function name in
the operator field. This invocation takes the following form:
LD 1
MUX 5, var0, -6.5, 3.14
ST vRES
Note that the first argument is not contained in the input list, but the accumulator is used
as the first argument of the function. Additional arguments (starting with the 2nd), if re-
quired, are given in the operand field, separated by commas, in the order of their decla-
ration. For example, operator MUX in the table above takes 5 operands, the first of which
is loaded into the accumulator, whereas the remaining 4 arguments are orderly reported
after the function name.
Keyword Description
FBInstanceName Name of the instance to be invoked.
IO_var Input or output variable to be written / read.
No storage of data or association with data elements can be associated with the use of
connectors; hence, to avoid ambiguity, connectors cannot be given any identifier.
Feature Example
Lines
The order in which networks and their elements are evaluated is not necessarily the same
as the order in which they are labeled or displayed. When the body of a program organiza-
tion unit (POU) consists of one or more networks, the results of network evaluation within
said body are functionally equivalent to the observance of the following rules:
1) No element of a network is evaluated until the states of all of its inputs have been
evaluated.
2) The evaluation of a network element is not complete until the states of all of its out-
puts have been evaluated.
3) As stated when describing the FBD editor, a network number is automatically as-
signed to every network. Within a program organization unit (POU), networks are
evaluated according to the sequence of their number: network N is evaluated before
network N+1, unless otherwise specified by means of the execution control elements.
Feedback
A feedback path is said to exist in a network when the output of a function or function
block is used as the input to a function or function block which precedes it in the network;
the associated variable is called a feedback variable.
Feedback paths can be utilized subject to the following rules:
1) Feedback variables must be initialized, and the initial value is used during the first
evaluation of the network. Look the Global variables editor, the Local variables editor,
or the Parameters editor to know how to initialize the respective item.
2) Once the element with a feedback variable as output has been evaluated, the new
value of the feedback variable is used until the next evaluation of the element.
For instance, the Boolean variable RUN is the feedback variable in the example shown
below.
Explicit loop
Implicit loop
Additional Boolean EN (Enable) input and ENO (Enable Out) characterize Application blocks,
according to the declarations
EN ENO
VAR_INPUT VAR_OUTPUT
EN: BOOL := 1; ENO: BOOL;
END_VAR END_VAR
See the Modifying properties of blocks section to know how to add these pins to a block.
When these variables are used, the execution of the operations defined by the block are
controlled according to the following rules:
1) If the value of EN is FALSE when the block is invoked, the operations defined by the
function body are not executed and the value of ENO is reset to FALSE by the program-
mable controller system.
2) Otherwise, the value of ENO is set to TRUE by the programmable controller system,
and the operations defined by the block body are executed.
10.3.4.2 JUMPS
Jumps are represented by a Boolean signal line terminated in a double arrowhead. The
signal line for a jump condition originates at a Boolean variable, or at a Boolean output of
a function or function block. A transfer of program control to the designated network label
occurs when the Boolean value of the signal line is TRUE; thus, the unconditional jump is
a special case of the conditional jump.
The target of a jump is a network label within the program organization unit within which
the jump occurs.
Unconditional Jump
Conditional Jump
-- Conditional returns from functions and function blocks are implemented using a RETURN
construction as shown in the table below. Program execution is transferred back to the
invoking entity when the Boolean input is TRUE, and continues in the normal fashion
when the Boolean input is FALSE.
-- Unconditional returns are provided by the physical end of the function or function block.
Conditional Return
Description Symbol
Description Symbol
10.4.3 CONTACTS
A contact is an element which imparts a state to the horizontal link on its right side which
is equal to the Boolean AND of the state of the horizontal link at its left side with an ap-
propriate function of an associated Boolean input, output, or memory variable.
A contact does not modify the value of the associated Boolean variable. Standard contact
symbols are given in the following table.
10.4.4 COILS
A coil copies the state of the link on its left side to the link on its right side without modi-
fication, and stores an appropriate function of the state or transition of the left link into
the associated Boolean variable.
Standard coil symbols are shown in the following table.
10.5.1 EXPRESSIONS
An expression is a construct which, when evaluated, yields a value corresponding to one
of the data types listed in the elementary data types table. Application does not set any
constraint on the maximum length of expressions.
Expressions are composed of operators and operands.
10.5.1.1 OPERANDS
10.5.1.2 OPERATORS
Open the table of operators to see the list of all the operators supported by ST. The evalu-
ation of an expression consists of applying the operators to the operands in a sequence
defined by the operator precedence rules.
Operators have different levels of precedence, as specified in the table of operators. The
operator with highest precedence in an expression is applied first, followed by the opera-
tor of next lower precedence, etc., until evaluation is complete. Operators of equal prec-
edence are applied as written in the expression from left to right.
For example if A, B, C, and D are of type INT with values 1, 2, 3, and 4, respectively, then:
A+B-C*ABS(D)
yields -9, and:
(A+B-C)*ABS(D)
yields 0.
When an operator has two operands, the leftmost operand is evaluated first. For example,
in the expression
SIN(A)*COS(B)
the expression SIN(A) is evaluated first, followed by COS(B), followed by evaluation of
the product.
Functions are invoked as elements of expressions consisting of the function name fol-
lowed by a parenthesized list of arguments, as defined in the relevant section.
10.5.2 STATEMENTS IN ST
All statements comply with the following rules:
-- they are terminated by semicolons;
-- unlike IL, a carriage return or new line character is treated the same as a space char-
acter;
-- Application does not set any constraint on the maximum length of statements.
ST statements can be divided into classes, according to their semantics.
10.5.2.1 ASSIGNMENTS
Semantics
The assignment statement replaces the current value of a single or multi-element variable
by the result of evaluating an expression.
The assignment statement is also used to assign the value to be returned by a function,
by placing the function name to the left of an assignment operator in the body of the
function declaration. The value returned by the function is the result of the most recent
evaluation of such an assignment.
Syntax
An assignment statement consists of a variable reference on the left-hand side, followed
by the assignment operator “:=”, followed by the expression to be evaluated. For in-
stance, the statement
A := B ;
would be used to replace the single data value of variable A by the current value of vari-
able B if both were of type INT.
Examples
a := b ;
assignment
pCV := pCV + 1 ;
assignment
c := SIN( x );
assignment with function invocation
FUNCTION SIMPLE_FUN : REAL
variables declaration
...
function body
...
SIMPLE_FUN := a * b - c ;
END_FUNCTION
assigning the output value to a function
Syntax
1) Function:
dst_var := function_name( arg1, arg2 , ... , argN );
Examples
CMD_TMR( IN := %IX5,
PT:= 300 ) ;
FB invocation with formal argument list:
IN := %IX5 ;
PT:= 300 ;
CMD_TMR() ;
FB invocation with assignment of arguments:
a := CMD_TMR.Q;
FB output usage:
RETURN ;
early exit from function or function block.
Syntax
Note that square brackets include optional code, while braces include repeatable portions
of code.
1) IF:
IF expression1 THEN
stat_list
[ { ELSIF expression2 THEN
stat_list } ]
ELSE
stat_list
END_IF ;
2) CASE:
CASE expression1 OF
intv [ {, intv } ] :
stat_list
{ intv [ {, intv } ] :
stat_list }
[ ELSE
stat_list ]
END_CASE ;
intv being either a constant or an interval: a or a..b
Examples
IF statement:
IF d 0.0 THEN
nRoots := 0 ;
ELSIF d = 0.0 THEN
nRoots := 1 ;
x1 := -b / (2.0 * a) ;
ELSE
nRoots := 2 ;
x1 := (-b + SQRT(d)) / (2.0 * a) ;
x2 := (-b - SQRT(d)) / (2.0 * a) ;
END_IF ;
CASE statement:
CASE tw OF
1, 5:
display := oven_temp ;
2:
display := motor_speed ;
3:
display := gross_tare;
4, 6..10:
display := status(tw - 4) ;
ELSE
display := 0;
tw_error := 1;
END_CASE ;
-- FOR: the FOR statement indicates that a statement sequence is repeatedly executed,
up to the END_FOR keyword, while a progression of values is assigned to the FOR loop
control variable. The control variable, initial value, and final value are expressions of
the same integer type (e.g., SINT, INT, or DINT) and cannot be altered by any of the
repeated statements. The FOR statement increments the control variable up or down
from an initial value to a final value in increments determined by the value of an ex-
pression; this value defaults to 1.The test for the termination condition is made at the
beginning of each iteration, so that the statement sequence is not executed if the initial
value exceeds the final value.
-- WHILE: the WHILE statement causes the sequence of statements up to the END_WHILE
keyword to be executed repeatedly until the associated Boolean expression is false. If
the expression is initially false, then the group of statements is not executed at all.
-- REPEAT: the REPEAT statement causes the sequence of statements up to the UNTIL
keyword to be executed repeatedly (and at least once) until the associated Boolean
condition is true.
-- EXIT: the EXIT statement is used to terminate iterations before the termination condi-
tion is satisfied. When the EXIT statement is located within nested iterative constructs,
exit is from the innermost loop in which the EXIT is located, that is, control passes to
the next statement after the first loop terminator (END_FOR, END_WHILE, or END_RE-
PEAT) following the EXIT statement.
NOTE: the WHILE and REPEAT statements cannot be used to achieve interprocess synchronization,
for example as a “wait loop” with an externally determined termination condition. The SFC
elements defined must be used for this purpose.
Syntax
Note that square brackets include optional code, while braces include repeatable portions
of code.
1) FOR:
FOR control_var := init_val TO end_val [ BY increm_val ] DO
stat_list
END_FOR ;
2) WHILE:
WHILE expression DO
stat_list
END_WHILE ;
3) REPEAT:
REPEAT
stat_list
UNTIL expression
END_REPEAT ;
Examples
FOR statement:
j := 101 ;
FOR i := 1 TO 100 BY 2 DO
IF arrvals[i] = 57 THEN
j := i ;
EXIT ;
END_IF ;
END_FOR ;
WHILE statement:
j := 1 ;
WHILE j <=100 AND arrvals[i] <> 57 DO
j := j + 2 ;
END_WHILE ;
REPEAT statement:
j := -1 ;
REPEAT
j := j + 2 ;
UNTIL j = 101 AND arrvals[i] = 57
END_REPEAT ;
SFC elements
The SFC elements provide a means of partitioning a PLC program organization unit into a
set of steps and transitions interconnected by directed links. Associated with each step is
a set of actions, and with each transition is associated a transition condition.
10.6.1 STEPS
10.6.1.1 DEFINITION
A step represents a situation where the behavior of a program organization unit (POU)
with respect to its inputs and outputs follows a set of rules defined by the associated ac-
tions of the step. A step is either active or inactive. At any given moment, the state of
the program organization unit is defined by the set of active steps and the values of its
internal and output variables.
A step is represented graphically by a block containing a step name in the form of an iden-
tifier. The directed link(s) into the step can be represented graphically by a vertical line
attached to the top of the step. The directed link(s) out of the step can be represented by
a vertical line attached to the bottom of the step.
Representation Description
Step
(graphical representation with
direct links)
Application does not set any constraint on the maximum number of steps per SFC.
Step flag
The step flag (active or inactive state of a step) can be represented by the logic value of a
Boolean variable ***_x, where *** is the step name. This Boolean variable has the value
TRUE when the corresponding step is active, and FALSE when it is inactive. The scope of
step names and step flags is local to the program organization unit where the steps ap-
pear.
Representation Description
Step flag
Step Name_x = TRUE when Step Name_x is active
= FALSE otherwise
The initial state of the program organization unit is represented by the initial values of
its internal and output variables, and by its set of initial steps, i.e., the steps which are
initially active. Each SFC network, or its textual equivalent, has exactly one initial step.
An initial step can be drawn graphically with double lines for the borders, as shown below.
For system initialization, the default initial state is FALSE for ordinary steps and TRUE for
initial steps.
Application cannot compile an SFC network not containing exactly one initial step.
Representation Description
Initial step
(graphical representation with
direct links)
10.6.1.3 ACTIONS
Such a structuring element exists in the lsc file for every step having at least one associ-
ate action.
The time when an action associated to a step is executed depends on its action qualifier.
Application implements the following action qualifiers.
If a step has zero associated actions, then it is considered as having a WAIT function, that
is, waiting for a successor transition condition to become true.
10.6.1.5 JUMPS
Direct links flow only downwards. Therefore, if you want to return to a upper step from a
lower one, you cannot draw a logical wire from the latter to the former. A special type of
block exists, called Jump, which lets you implement such a transition.
A Jump block is logically equivalent to a step, as they have to always be separated by a
transition. The only effect of a Jump is to activate the step flag of the preceding step and
to activate the flag of the step it points to.
Representation Description
Jump
(logical link to the destination step)
10.6.2 TRANSITIONS
10.6.2.1 DEFINITION
A transition represents the condition whereby control passes from one or more steps
preceding the transition to one or more successor steps along the corresponding directed
link. The transition is represented by a small grey square across the vertical directed link.
The direction of evolution following the directed links is from the bottom of the predeces-
sor step(s) to the top of the successor step(s).
Each transition has an associated transition condition which is the result of the evaluation
of a single Boolean expression. A transition condition which is always true is represented
by the keyword TRUE, whereas a transition condition always false is symbolized by the
keyword FALSE.
A transition condition can be associated with a transition by one of the following means:
Representation Description
The scope of a transition name is local to the program organization unit (POU) in which
the transition is located.
Example Rule
Normal transition
An evolution from step S3 to step S4
takes place if and only if step S3 is
in the active state and the transition
condition c is TRUE.
Divergent transition
An evolution takes place from S5 to
S6 if and only if S5 is active and the
transition condition e is TRUE, or from
S5 to S8 only if S5 is active and f is
TRUE and e is FALSE.
Convergent transition
An evolution takes place from S7
to S10 only if S7 is active and the
transition condition h is TRUE, or from
S9 to S10 only if S9 is active and j is
TRUE.
Examples
Expected behavior: an
evolution takes place
from S30 to S33 if a is
FALSE and d is TRUE.
The scheme in the
leftmost column
is invalid because
conditions d and TRUE
are directly linked.
Expected behavior: an
evolution takes place
from S32 to S31 if c is
FALSE and d is TRUE.
The scheme in the
leftmost column
is invalid because
direct links flow only
downwards. Upward
transitions can be
performed via jump
blocks.
10.7.1 MACROS
Application implements macros in the same way a C programming language pre-proces-
sor does.
Macros can be defined using the following syntax:
MACRO <macro name>
PAR_MACRO
<parameter list>
END_PAR
<macro body>
END_MACRO
Note that the parameter list may eventually be empty, thus distinguishing between ob-
ject-like macros, which do not take parameters, and function-like macros, which do take
parameters.
A concrete example of macro definition is the following, which takes two bytes and com-
poses a 16-bit word:
MACRO MAKEWORD
PAR_MACRO
lobyte;
hibyte;
END_PAR
{ CODE:ST }
lobyte + SHL( TO_UINT( hibyte ), 8 )
END_MACRO
Whenever the macro name appears in the source code, it is replaced (along with the ac-
tual parameter list, in case of function-like macros) with the macro body. For example,
given the definition of the macro MAKEWORD and the following Structured Text code frag-
ment:
w := MAKEWORD( b1, b2 );
the macro pre-processor expands it to
w := b1 + SHL( TO_UINT( b2 ), 8 );
10.7.2 POINTERS
Pointers are a special kind of variables which act as a reference to another variable (the
1pointed variable). The value of a pointer is, in fact, the address of the pointed variable;
in order to access the data stored at the address pointed to, pointers can be dereferenced.
Pointer declaration requires the same syntax used in variable declaration, where the type
name is the type name of the pointed variable preceded by a @ sign:
VAR
<pointer name> : @<pointed variable type name>;
END_VAR
For example, the declaration of a pointer to a REAL variable shall be as follows:
VAR
px : @REAL;
END_VAR
A pointer can be assigned with another pointer or with an address. A special operator, ADR,
is available to retrieve the address of a variable.
px := py; (* px and py are pointers to REAL (that is, vari-
ables of type @REAL) *)
px := ADR( x ) (* x is a variable of type REAL *)
px := ?x (* ? is an alternative notation for ADR *)
The @ operator is used to dereference a pointer, hence to access the pointed variable.
px := ADR( x );
@px := 3.141592; (* the approximate value of pi is assigned to x *)
pn := ADR( n );
n := @pn + 1; (* n is incremented by 1 *)
Beware that careless use of pointers is potentially hazardous: indeed, pointers can point
to any arbitrary location, which can cause undesirable effects.
WARNING
UNINTENDED EQUIPMENT OPERATION
• Ensure that all variables are initialized to an appropriate value before their first use as point-
ers.
• Write programming instructions to test the validity of operands intended to be used as mem-
ory pointers.
• Do not attempt to access memory element outside the defined bounds of the allocated mem-
ory.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
ERROR
SHORT DESCRIPTION EXPLANATION
CODE
The object indicated (variable or function block) has not
A04097 Object not found
been defined in the application.
The size (in bits) requested by the indicated data type
A04098 Unsupported data type
isn't supported by the target system.
The total allocation space requested by all local variables
A04099 Auto vars space exhausted
exceeds the space available on the target system.
The total allocation space requested by all local retentive
A04100 Retentive vars space exhausted variables exceeds the space available on the target
system.
The total allocation space requested by all local bit
A04101 Bit vars space exhausted (boolean) variables exceeds the space available on the
target system.
The variable indicated is associated with an index that is
A04102 Invalid ++ in data block
not available in the relative data block.
The variable indicated is associated with a data block
A04103 Data block not found
that doesn't exist (isn't defined) in the target system.
The total size of code used for POU (programs, functions
A04104 Code space exhausted and function blocks) exceed the space available on the
target system.
The variable indicated is associated with a bit index that
A04105 Invalid bit offset
is not available in the relative data block.
A04106 Image variable requested Error code superseded.
The function indicated isn't available on the target
A04107 Target function not found
system.
The indicated instance refers to a function block
A04108 Base object not found
definition non defined.
The indicated variable is associated with a data type
A04109 Invalid base object type
(including function block definition) that isn't defined.
The data type used in the variable definition doesn't
A04110 Invalid data type
exist.
A04111 Invalid operand type The operand type is not allowed for the current operator.
The indicated function block is called by more than one
Function block shares global data task but uses global variables with process image. For
A04112
and is used by more tasks this reason the compiler isn't able to refer to the proper
image variable for each instance of the function block.
Temporary variables allocation
A04113 Internal compiler error.
error
Embedded functions do not
A04114
support arrays as input variables
Too many parameters input to
A04115
embedded function
Incremental build failed, perform
A04116
a full build command
A04117 Less then 10% of free data
A04118 Less then 10% of free retain data
ERROR
SHORT DESCRIPTION EXPLANATION
CODE
A04119 Less then 10% of free bit data
A04120 Variable exceeds data block space
A04121 Element not found
A04123 Invalid access to private member
A04129 Not a structured type
A04130 Not a function block instance
A04131 Incompatible external declaration
A04133 Not a variable
A04134 Index exceeds array size
A04135 Invalid index data type
A04136 Missing index(es)
A04137 Function block instance required
A04138 Simple variable required
A04139 Too many indexes
A04140 Not a structure instance
A04141 Not an array
A04143 Not a pointer
Double pointer indirection not
A04144
allowed
A04145 To be implemented
A04146 Bit datatype not allowed
A04147 Unable to calculate variable offset
Complex variables cannot have
A04148
process image
Cannot use directly represented
A04149 variables with process image in
function blocks (not implemented)
Function block instance not
A04150
allowed
A04151 Structure not allowed
16-bit variables must be aligned
A04152
to a 16-bit boundary
32-bit variables must be aligned
A04153
to a 32-bit boundary
Temporary string variable
A04154 allocation error. Instruction shall
be split.
Ext/aux auto vars space
A04155
exhausted
Ambiguous enum value,
A04156
<enum># prefix required
The variable indicated is associated with a data block
B00001 Data block not found
that doesn't exist (isn't defined) in the target system.
The indicated file can't be created due to a file system
B00002 Error on create file
error or to a missing source file.
C00001 Parser not inizialized Internal compiler error.
C00002 Invalid token Invalid word for the current language syntax
ERROR
SHORT DESCRIPTION EXPLANATION
CODE
C00003 Invalid file specification Internal compiler error.
The indicated file can't be opened due to a file system
C00004 Can't open file
error or to a missing source file.
C00005 Parser tabel error Internal compiler error.
C00006 Parser non specified Internal compiler error.
The indicated file is truncated or the syntax is
C00007 Unexpected end of file
incomplete.
The indicated word can't be used for declaration
C00009 Reserved keyword
purposes because is a keyword of the language.
The indicated word isn't a valid one for the language
C00010 Invalid element
syntax.
C00011 Aborted by user
Too many parameters in macro
C00032
call
Invalid number of parameters in
C00033
macro call
C00034 Too many macro calls nested
C04097 Invalid variable type The data type indicated isn't allowed.
The address string of the indicated variable isn't correct,
C04098 Invalid location prefix
'%' missing.
The address string of the indicated variable isn't correct,
C04099 Invalid location specification
the data access type indication isn't 'I', 'Q' or 'M'.
The address string of the indicated variable isn't correct,
C04100 Invalid location type
the data type indication isn't 'X', 'B', 'W', 'D', 'R' or 'L'.
The address string of the indicated variable isn't correct,
C04101 Invalid location index specification
the index isn't correct.
The name of the indicated variable has already been
C04102 Duplicate variable name
used for some other project object.
C04103 Only 0 admitted here The compiler uses only arrays zero-index based
The dimension of the array isn't indicated in the correct
C04104 Invalid array dimension way (e.g.: contains invalid characters, negative numbers
etc.).
C04105 Constant not initialized Every constant need to have an initial value.
C04106 Invalid string size
C04107 Initialization exceeding string size
C04108 Invalid repetition in initialization
C04109 Invalid data type for initialization
The indicated label has already been defined in the
C04353 Duplicate label
current POU (program, function or function block).
The operation indicated doesn't allow to use constants
C04354 Constant not admitted
(typically store or assign operations).
Address of explicit constant not
C04355
defined
Maximum number of subscripts
C04356
exceeded
C04358 Invalid array base
C04359 Invalid operand
A constant value with 2# prefix must contain only binary
C04609 Invalid binary constant
digits (0 or 1).
ERROR
SHORT DESCRIPTION EXPLANATION
CODE
A constant value with 8# prefix must contain only octal
C04610 Invalid octal constant
digits (between 0 and 7).
A constant value with 16# prefix must contain only
C04611 Invalid hexadecimal constant hexadecimal digits (between 0 and 9 and between A and
F).
A decimal constant must contain only digits between 0
C04612 Invalid decimal constant and 9, a leading sign + or -, a decimal separator '.' Or a
exponent indicator 'e' or 'E'.
A constant value with t# prefix must contain a time
C04613 Invalid time constant indication in decimal notation and a time unit between
'ms, 's' or 'm'.
C04614 Invalid constant string
The indicated function name has already been used for
C04864 Duplicate function name
another application object.
The data type returned by the indicated function is not
C04865 Invalid function type
correct.
The indicated program name has already been used for
C05120 Duplicate program name
another application object.
The indicated function block name has already been
C05376 Duplicate function block name
used for another application object.
C05632 Invalid pragma
C05633 Invalid pragma value
C05889 Duplicate macro name
C05890 Duplicate macro parameter name
Invalid resource definition: two or
C06144
more tasks have the same ID
C16385 Invalid init value
C16386 Invalid initialization definition
C16387 Invalid array delimiters (brakets)
C16388 Empty init value
C16389 Empty array init value
C16390 Invalid repeated init value
C16391 Not implemented
C16392 Missing array delimiters (brakets)
C16393 Missing comma
C16394 Not implemented
C16395 Invalid (incomplete) string
The memory space needed for parameter's database
exceeds the space available on the target system. If
D12289 Can't allocate database
possible, remove unused parameter's records, menus
etc.
The memory space needed for parameter's database
exceeds the space available on the target system. If
D12290 Can't allocate database record
possible, remove unused parameter's records, menus
etc.
D12291 Database variable not found Internal compiler error.
Invalid expression or expression The database expression that has the result indicated
D12292
syntax error isn't correct, contains syntax errors or invalid operators.
ERROR
SHORT DESCRIPTION EXPLANATION
CODE
The database expression that has the result indicated
contains a parameter (as operand) that isn't the same to
which the expression refers to. The expression can use
only PLC variables (including the variables associated
with parameters) and the value of the parameter that
Invalid parameter reference in is exchanged at the moment. For example: pDELTA
D12293
expression = DELTA / pRATIO + pOFFSET is correct because
the parameter exchanged is DELTA and it's the only
parameter value used in the expression. The expression:
pDELTA = DELTA / pRATIO + OFFSET isn't correct
because the parameter OFFSET used in the expression
isn't currently exchanged
The database expression that has the result indicated
D12294 Recursive expression calls itself by means of some operand used that contains
the current expression result.
The database expression that has the result indicated
D12295 Unresolved variable in expression uses an operand that isn't defined in the whole PLC
project.
D12296 Unresolved expression result Internal compiler error.
The parameter that is the result of the expression has a
D12297 Invalid result type for expression
data type invalid (such as enumerative) or not defined.
The database expression that has the result indicated
D12298 Invalid operand in expression
uses an invalid operand.
Invalid variable type for The variable that is the result of the expression has a
D12299
expression data type invalid (such as enumerative) or not defined.
D12300 Assembler error Internal compiler error.
The code space needed for the expression is exhausted.
D12301 Can't allocate database code Is necessary to remove some expressions from the
parameter's database.
The database expression that has the result indicated
D12302 Invalid operation in expression
uses an invalid operand.
The indicated FBD or LD network contains a connection
F01025 Invalid network error (the errors are normally indicated by red
connections).
The indicated block (operator, function, contact or coil)
F01026 Unconnected pin
has an unconnected pin.
Invalid connection (incomplete,
F01027 Internal compiler error.
more than a source etc.)
The network indicated contains more networks of blocks
F01028 More than one network per block
and variables not connected between them.
The compiler is not able to find an univocal way to
F01029 Ambiguous network evaluation
establish the order of blocks execution.
Temporary variables allocation
F01030 Internal compiler error.
error
The network indicated doesn't have input or output
F01031 Inconsistent network
variables.
Invalid object connected to power
F01032
rail
Invalid use of pin negation (ADR
F01033 operator does not allow negated
input
Invalid use of pin negation
F01034 (SIZEOF operator does not allow
negated input
ERROR
SHORT DESCRIPTION EXPLANATION
CODE
The number of operands is not correct for the operand or
G00001 Invalid operand number
the function indicated.
The variable has not been defined in the local or global
G00002 Variable not defined
context.
The label indicated for the JMP operand isn't defined in
G00003 Label not defined
the current POU (program, function or function block).
The indicated instance refers to a function block not
G00004 Function block not defined
defined in the whole project.
The indicated instance refers to an object not defined in
G00005 Reference to object not defined
the whole project.
The operation indicated doesn't allow to use constants
G00006 Constant not admitted
(typically store or assign operations).
The total size of code used for POU (programs, functions
G00007 Code buffer overflow and function blocks) exceed the space available on the
target system.
The access made to the indicated variable is not allowed.
G00008 Invalid access to variable An attempt to write a read-only variable or to read a
write-only variable has been made.
The indicated program doesn't exist in the current
G00009 Program not found
project.
Program already assigned to a The indicated program has been assigned to more than
G00010
task one task of the target system.
There isn't enough memory on the PC to create the
G00011 Can't allocate code buffer
image of the code of the target system.
The indicated function doesn't exist in the current
G00012 Function not defined
project.
Cyclic declaration of function The indicated function block call itself directly or by
G00013
blocks means of other functions.
The external variable declaration of the current function
block doesn't match with the global variable definition it
G00014 Incompatible external declaration
refers to (the one with the same name). Typically is the
case of a type mismatch.
The access made to the indicated variable is not allowed.
G00015 Accumulator extension An attempt to write a read-only variable or to read a
write-only variable has been made.
The external variable doesn't refer to any of the global
G00016 External variable not found variables of the project (e.g.: there isn't a global variable
with the same name).
The indicated program hasn't been assigned to a task in
G00017 Program is not assigned to a task
the target system.
G00018 Task not found in resources The indicated task isn't defined in the target system.
There aren't task definitions for the target system. The
G00019 No task defined for the application target definition file (*.TAR) is missing or incomplete.
Contact the target system vendor.
Huge memory access isn't allowed for function blocks,
Far data allowed only for load/
G00020 only for programs (error code valid only for some target
store operations in PROGRAMs
system with NEAR/FAR data access).
The processor indicated into the target definition file
G00021 Invalid processor type
(*.TAR) isn't correct or isn't supported by the compiler.
Function block with process image
G00022 variables can't be used in event
tasks
ERROR
SHORT DESCRIPTION EXPLANATION
CODE
Process image variables can't be
G00023
used in event tasks
G00024 Accumulator undefined
G00025 Invalid index
G00026 Only constant index allowed
Illegal reference to the address of
G00027
a register
G00028 Less then 10% of free code
G00029 Index exceeds array size
Access to array as scalar -
G00030
assuming index 0
Number of indexes not matching
G00031
the var size
Multidimensional variables not
G00032
supported
G00033 Invalid data type
G00034 Invalid operand type
G00035 Assembler error
G00036 Aborted by user
G00037 Element not defined
G00038 Cyclic declaration of structures
G00039 Cyclic declaration of typedefs
G00040 Unresolved definition of typedef
G00041 Exceeding dimensions in typedef
Unable to allocate compiler
G00042
internal data
CODE GENERATOR INTERNAL
G00043
ERROR
G00044 Real data not supported
G00045 Long real data not supported
G00046 Long data not supported
G00047 Operation not implemented
G00048 Invalid operator
G00049 Invalid operator value
G00050 Unbalanced parentheses
G00051 Data conversion
G00052 To be implemented
G00053 Invalid index data type
G00054 Negation without condition
G00055 Operation not allowed on boolean
Negation of a non-boolean
G00056
operand
G00057 Boolean operand required
Floating point parameter not
G00058
allowed
G00059 Operand extension
ERROR
SHORT DESCRIPTION EXPLANATION
CODE
G00060 Division by zero
G00061 Illegal comparison
Function block must be
G00062
instanciated
G00063 String operand not allowed
G00064 Operation not allowed on pointers
Destination may be too small to
G00065
store current result
Cannot use a function block
containing external variables with
G00066
process image in more than one
task
Cannot load the address of an
G00067
explicit constant
Writing a real value into an
G00068
integer variable
Cannot use complex variables in
G00069
functions. Not implemented
G00070 Signed/unsigned mismatch
Conversion data types mismatch,
G00071
possible loss of data
Implicit type conversion of
G00072
boolean to integer
Implicit type conversion of
G00073
boolean to real
Implicit type conversion of integer
G00074
to boolean
Implicit type conversion of integer
G00075
to boolean
Implicit type conversion of real to
G00076
boolean
Implicit type conversion of real to
G00077
integer
Arithmetic operations require
G00078
numerical operands
Bitwise logical operations require
G00079
bitstring/integer operands
Comparison operations require
G00080 elementary (i.e., not user-
defined) operands
Cannot take the address of a bit
G00081
variable
Writing a signed value into an
G00082
unsigned variable
Writing an unsigned value into a
G00083
signed variable
Implicit conversion from single to
G00084
double precision
Implicit conversion from double to
G00085
single precision
G00086 Function parameter extension
ERROR
SHORT DESCRIPTION EXPLANATION
CODE
Casting to the same type has no
G00087
effects
Function parameters wrong
G00088
number
Embedded target function not
G00089
found
G00090 Recursive type declaration
Wrong initial value. Signed/
G00091
unsigned mismatch
Wrong initial value. Conversion
G00092 data types mismatch, possible
loss of data
G00093 String will be truncated
G00094 Init value type mismatch
G00095 Improper init value
G00096 Init value object not found
G00097 Invalid assignment to pointer
The operator indicated is not allowed for the indicated
G00513 Invalid operator
operation.
The operator indicated isn't supported by the current
G00514 Operation not implemented
target system.
The target system in use doesn't support floating point
G00515 Real data not supported
operations.
The variable destination of the store/assignment
operation has a data type smaller than the one of the
accumulator. Data may be lost in the operation. For
example, if the accumulator contains 340 and the
Destination may be too small to
G00516 destination operand is of SINT type, the assignment
store current result
operation will loose data. If the operation is under the
programmer's control an appropriate type conversion
function (TO_SINT, TO_INT, TO_DINT etc.) can be used
to eliminate the warning message.
The target system in use doesn't support long data
G00517 Long data not supported
operations.
The variable destination of the store/assignment
operation has a data type bigger than the one of the
accumulator. An extension operation has been performed
G00518 Accumulator extension
automatically by the compiler. To eliminate this warning
message use the appropriate type conversion function
(TO_SINT, TO_INT, TO_DINT etc.).
G00519 Assembler error Internal compiler error.
The 'N' modifier used for some IL operators (LDN, STN,
G00520 Negation allowed only on boolean ANDN etc.) can't be used with operators having type
other than boolean.
Operation allowed with boolean The IL operator indicated (typically 'S' or 'R') can't be
G00521
types used when the accumulator has a type other than BOOL.
The indicated operation has a result that is constant (ex.
G00522 Instruction has constant result
multiply by 0, AND with FALSE).
The operation indicated has no influence on the value of
G00523 Instruction is a NOP
the accumulator (ex. multiply by 1, AND with TRUE).
ERROR
SHORT DESCRIPTION EXPLANATION
CODE
The number of opened parentheses doesn't match with
G00524 Unbalanced parentheses the number of the closed parentheses in the indicated
code block.
The indicated operation can't be performed on boolean
G00525 Operation not allowed on boolean
operands (ex. the arithmetic operations).
Can't perform modulo with long The current target system doesn't allow the modulo
G00526
values operation with long data types.
The indicated division operation has the constant value 0
G00527 Division by 0
as denominator.
The indicated operation (JMP or RET) has the negation
modifier 'N' without the conditional evaluation modifier
G00528 Negation without condition
'C'. Use JMPCN instead of JMPN or RETCN instead of
RETN.
G00529 Initial value not defined Internal compiler error.
G00530 Invalid initial value The initial value of the variable isn't indicated correctly.
The accumulator has a data type not allowed for the
G00531 Invalid accumulator type indicated operation (ex. MUX operator with REAL
accumulator).
G00532 Code generator internal error Internal compiler error.
The operator has a value not acceptable for the indicated
G00533 Invalid operator value
operation (ex. SHL with constant value bigger than 32).
The operation is performed without a previously loaded
G00534 Accumulator undefined
value into the accumulator.
The constant index value used in the indicated
G00535 Invalid index expression is too big for the array dimension. See the
array declaration string.
The use of variable as index for the indicated array is not
G00536 Only constant index allowed supported by the compiler. This error is typically issued
with boolean (bit) arrays.
The use of variable as index for the indicated array is not
Indexing of boolean constants not
G00537 supported by the compiler. This error is typically issued
allowed
with boolean (bit) arrays.
G00538 Return not allowed from programs The RET operator isn't allowed in PROGRAM blocks.
A function block can't be invoked directly with a CAL
Function block must be instruction. It must be instantiated before its use eg.
G00539
instantiated must be a variable with data type corresponding to the
function block instead.
The indicated operation can't be executed on REAL data
Operation not allowed with real
G00540 types. Instructions of this kind are logical and bitwise
types
operations.
This warning informs that the data type of the
accumulator has been automatically converted by the
G00541 Accumulator conversion compiler. This operation is typically executed when
the accumulator and the operand used in a arithmetic
operation have different data types.
Some target-specific implementations with software
Real accumulator must be floating point emulation require that each store
G00542
reloaded operation shall be preceded by a new load operation or a
arithmetic sequence.
Some target-specific implementations with software
floating point emulation require that when the floating
G00543 Real accumulator not stored
point stack has been loaded, the same shall be unloaded
at the end of arithmetic sequence.
ERROR
SHORT DESCRIPTION EXPLANATION
CODE
The long real data type LREAL isn't supported by the
G00544 Long real data not supported
compiler.
The operator indicated is not allowed for the indicated
G00769 Invalid operator
operation.
The operator indicated isn't supported by the current
G00770 Operation not implemented
target system.
G00771 Assembler error Internal compiler error.
The long real data type LREAL isn't supported by the
G00772 Long real data not supported
compiler.
G00773 Long data not supported The long data type LINT isn't supported by the compiler.
Negation of a non-boolean The negation modifier 'N' can't be used in operations
G00774
parameter with data types different than boolean.
The indicated operation can't be performed on boolean
G00775 Operation not allowed on boolean
operands (ex. the arithmetic operations).
The variable destination of the store/assignment
operation has a data type bigger than the one of the
accumulator. An extension operation has been performed
G00776 Accumulator extension
automatically by the compiler. To eliminate this warning
message use the appropriate type conversion function
(TO_SINT, TO_INT, TO_DINT etc.).
The operation is performed without a previously loaded
G00777 Accumulator undefined
value into the accumulator.
The variable destination of the store/assignment
operation has a data type smaller than the one of the
accumulator. Data may be lost in the operation. For
example, if the accumulator contains 340 and the
Destination may be too small to
G00778 destination operand is of SINT type, the assignment
store current result
operation will loose data. If the operation is under the
programmer's control an appropriate type conversion
function (TO_SINT, TO_INT, TO_DINT etc.) can be used
to eliminate the warning message.
The indicated division operation has the constant value 0
G00779 Division by zero
as denominator.
The indicated operation can't be executed on REAL data
Operation allowed on real
G00780 types. Instructions of this kind are logical and bitwise
parameters only
operations.
The indicated comparison operation is executed between
G00781 Illegal comparison
non homogeneous data types.
The indicated operation (JMP or RET) has the negation
modifier 'N' without the conditional evaluation modifier
G00782 Negation without condition
'C'. Use JMPCN instead of JMPN or RETCN instead of
RETN.
The IL operator indicated (typically 'S' or 'R') can't be
G00783 Boolean parameter required
used when the accumulator has a type other than BOOL.
The data type of the operand has been extended to
the data type of the accumulator. Then the operation is
G00784 Operand extension executed. The operand extension take place whenever
the operand data type is smaller than the accumulator
data type.
Does not support float The accumulator has REAL data type and it's not allowed
G00785
accumulator for the indicated operation (typically MUX operation).
Does not support boolean The accumulator has boolean data type and isn't allowed
G00786
accumulator for the indicated operation (ex. MUX operator).
ERROR
SHORT DESCRIPTION EXPLANATION
CODE
The compare operation indicated is performed using
Comparison of unsigned type and
G00787 operators that have signed and unsigned data type.
signed type
Indeterminate results may be possible.
G00788 Illegal conversion Internal compiler error.
Conversion may result in loss or
G00789 Error code not used.
corruption of data
Illegal negation of a real
G00790 Error code not used.
parameter
The parameter passed to the function is of REAL type
Writing a real value into an
G00791 instead of an integer data type as required by the
integer var / param
function input variables definition.
The parameter passed to the function is of an integer
Writing an integer value into a
G00792 data type instead of the REAL type as required by the
real var / param
function input variables definition.
The assignment operation is performed on an unsigned
Writing a signed value into an
G00793 data type variable but the accumulator data type has a
unsigned var / param
signed data type. Indeterminate results may be possible.
The assignment operation is performed on an unsigned
Writing an unsigned value into a
G00794 data type variable but the accumulator data type has a
signed var / param
signed data type. Indeterminate results may be possible.
The number of opened parentheses doesn't match with
G00795 Unbalanced parentheses the number of the closed parentheses in the indicated
code block.
G00796 Error while extending parameters Internal compiler error.
The constant index value used in the indicated
G00797 Invalid index expression is too big for the array dimension. See the
array declaration string.
Using a boolean index to access The indicated array access is incorrect because the index
G00798
an element of array variable used has a boolean data type.
G00799 Return not allowed from programs The RET operator isn't allowed in PROGRAM blocks.
The indicated SEL operator requires that the accumulator
G00800 Boolean accumulator required
has the boolean data type.
The selection performed by MUX and SEL operators shall
G00801 Operators have mismatching type be done between elements that have homogeneous data
types.
A function block can't be invoked directly with a CAL
Function block must be instruction. It must be instantiated before its use eg.
G00802
instantiated must be a variable with data type corresponding to the
function block instead.
Using a boolean index to access
G01537
an element of array
Does not support boolean
G01538
accumulator
Does not support float
G01539
accumulator
G01540 Error while extending operand(s)
Writing a signed value into an
G01541
unsigned variable
Writing an unsigned value into a
G01542
signed variable
Writing a real value into an
G01543
integer variable
ERROR
SHORT DESCRIPTION EXPLANATION
CODE
Writing an integer value into a
G01544
real variable
G01545 Converting a string into a number
G01546 Converting a number into a string
G01547 FPU stack full
G01548 FPU stack empty
G01549 FPU stack size error
Illegal access to variable through
G01550
function
Illegal reference to address
G01551 of variable accessible through
function
G01552 Invalid access through function
Two variables with the same
G01553
handle
Invalid index for variable
G01554
accessible through function
Invalid instruction with non-empty
G01555
FPU stack
Function result of type string
G01556
requires store to variable
Type definition of unknown data
G08193
type
Type definition has exceedin array
G08194
dimensions
G08195 Cyclic definition of data type
G08196 Double pointers are not supported
G08197 No enumerative elements
Invalid or undefined initialization
G08199
constant
G10241 Too many initializer for variable
G10242 Too less initializer for variable
G10243 Constant without init values
The source file for parameters (with PPC extension) can't
P02048 Can't open parameters file be opened because of is missing or is locked by the PC's
file system.
The symbol allocation file (with SYM extension) can't be
P02049 Symbol table file not created written because of disk write protection or insufficient
disk space.
The parameters file (with PAR extension) can't be
P02050 Can't create parameters file written because of disk write protection or insufficient
disk space.
The directory for the new project can't be created. The
problem arises when there is a disk write protection or
when the new directory indicated for the project is more
P02051 Can't create directory than one level deep form an existing disk directory. The
compiler creates only one new directory level (the one
with the name of the project) starting from an existing
directory.
ERROR
SHORT DESCRIPTION EXPLANATION
CODE
The source project indicated for creating the new project
P02052 Can't open source project doesn't exist, is incomplete or is locked by the file
system.
The new project can't be saved due to disk write
P02053 Save project error protection, non existing destination directory or file
system lock.
P02054 Generic file error A non specific error occurred during file operations.
The indicated file can't be copied because of missing
P02055 Can't copy file source file, disk write protection or destination file
existing and protected.
The indicated file can't be saved because of disk write
P02056 Can't save file
protection or destination file existing and protected.
The indicated object (variable, function, function block or
program) is contained in the last loaded library but there
P02057 Object already exist in project
is already another object with the same name in the
current project.
The indicated library file doesn't exits or can't be opened
P02058 Can't open library file
due to file system locking.
P02059 Listing file not created
Cannot create PLC application
P02060
binary file
P02061 Can't open template project
Support for processor isn't
P02062
available
P02063 Less than 10% of free code
P02064 Less than 10% of free data
P02065 Less than 10% of free retain data
P02066 Less than 10% of free bit data
P02067 Task not found in resources
P02068 No task defined for the application
Project is in the old PPJ format.
P02069 It will be saved in the actual PPJX
format
P02070 Can't open auxiliary source file
P02071 Can't read file
Application name is longer than
10 characters: only the first 10
P02072
characters will be downloaded into
the target
Downloadable source code file is
P02073
not password-protected
Downloadable PLC application
P02074
binary file not created
Less than 10% of free ext/aux
P02075
data
Project private copy of this
library was missing and has been
P02076
replaced with a new copy of the
library (from the original path)
ERROR
SHORT DESCRIPTION EXPLANATION
CODE
Cannot load library! Project
private copy of this library was
P02077 missing and the original path to
the library is invalid: library has
been dropped
PLC variables export file not
P02078
created
Debug symbols package (for
P02079 following download to the target
device) not created
Source code package (for
P02080 following download to the target
device) not created
P02081 Invalid task definition
P02083 Invalid or incoherent task period
P02084 Broken library link
S01281 Generic ST error
S01282 Too many expressions nested
S01283 No iteration to exit from
S01284 Missing END_IF
S01285 Invalid ST statement
S01286 Invalid assignment
S01287 Missing;
S01288 Invalid expression
S01289 Invalid expression or missing DO
S01290 Missing END_WHILE
S01291 Missing END_FOR
S01292 Missing END_REPEAT
Invalid expression or missing
S01293
THEN
S01294 Invalid expression or missing TO
S01295 Invalid expression or missing BY
Invalid statement or missing
S01296
UNTIL
S01297 Invalid assignment, := expected
S01298 Invalid address expression
S01299 Invalid size expression
S01300 Function return value ignored
S01301 Invalid parameter passing
S01302 Function parameter not defined
S01303 Useless expression
S01304 Unbalanced parentheses
S01305 Unknown function
Invalid function parameter(s)
S01306
specification
S01307 Function parameter doesn't exist
ERROR
SHORT DESCRIPTION EXPLANATION
CODE
Multiple assignment not allowed
S01308
(in accordance with IEC 61131-3)
S01309 ST preprocessor buffer overflow
Function block invocation of a
S01310
non-function block instance
S01311 Missing END_WAITING
S01312 Syntax error
S01537 Generic SFC error
S01538 Initial step missing
S01539 Output connection missing
The output pin must be connected
S01540
to a transition
Every output pin of a transition
S01541 must be connected to a step/jump
block
S01542 Transition expected
S01543 Step or jump expected
Could not find the associate
S01544
program code
S01545 Could not find the condition code
S01546 Unknown-type transition
S01547 Invalid destination
Duplicates action. Same SFC
S01548 action cannot be used in more
than one step
The communication with the target system is unsuccesful
because there is no answer from the system itself. More
common causes of this problem are incorrect cable
T08193 Communication timeout
connection, invalid target address in communication
settings, invalid settings of communication parameters
(such as baud rate), target system availability.
T08194 Incompatible target version Error code not used.
The target system image file (with IMG extension)
is invalid or corrupted. Try to upload and create new
T08195 Invalid code file
version of the image file using the “Communication” -
“Upload image file” menu option.
The image file (with IMG extension) contains a data
block that has an index greater than the largest
index supported by the target system. Try to upload
T08196 Invalid data block index
and create new version of the image file using the
“Communication” - “Upload image file” menu option. If
the problem persist, contact the target system vendor.
T08197 Invalid target information address Internal compiler error.
The target system was not able to complete the flash
T08198 Flash erase failure erasure procedure. Contact the target system vendor for
details.
The target system was not able to complete the flash
T08199 Code write failure programming procedure. Contact the target system
vendor for details.
ERROR
SHORT DESCRIPTION EXPLANATION
CODE
The compiler tried to communicate with the target
system but the communication channel is not available.
T08200 Communication device unavailable If the problem persist and there are other applications
that communicate with the target system, deactivate the
communication on the other applications and try again.
T08201 Invalid function index Internal compiler error.
The address of the parameter's database memory area
Invalid database information of the target system isn't correct or valid. Try to upload
T08202
address and create new version of the image file using the
"Communication Upload image file" menu option.
T08203 Invalid target information
T08204 Rebuild required
T08205 Invalid task
Application-level communication
protocol error: PLC run-time
T08206
was not able to understand the
received command
T08207 Not implemented
No room for source file on the
T08209
target
Error while uploading source code
T08210
from target device
No room for debug symbols on
T08211
the target
T08212 Memory read error
T08213 Memory write error
Not enough space available on
T08214 the target device for the PLC
application binary
Contents
1. Overview 309
SAFETY INFORMATION
Important Information
Read these instructions carefully, and look at the equipment to become familiar with the device
before trying to install, operate, or maintain it. The following special messages may appear
throughout this documentation or on the equipment to inform of potential hazards or to call
attention to information that clarifies or simplifies a procedure.
The addition of this symbol to a Danger safety label indicates that an electrical hazard
exists, which will result in personal injury if the instructions are not followed.
This is the safety alert symbol. It is used to alert you to potential personal injury
hazards.
Obey all safety messages that follow this symbol to avoid possible injury or death.
DANGER
DANGER indicates an imminently hazardous situation which, if not avoided, results in death
or serious injury.
WARNING
WARNING indicates a potentially hazardous situation which, if not avoided, can result in
death or serious injury.
CAUTION
CAUTION indicates a potentially hazardous situation which, if not avoided, can result in
minor or moderate injury.
NOTICE
NOTICE is used to address practices not related to physical injury.
PLEASE NOTE
Electrical equipment should be installed, operated, serviced, and maintained only by qualified
personnel.
No responsibility is assumed by Schneider Electric for any consequences arising out of the use of
this material.
You can download these technical publications and other technical information from our website at:
www.schneider-electric.com
WARNING
LOSS OF CONTROL
• The designer of any control scheme must consider the potential failure modes of control
paths and, for certain critical control functions, provide a means to achieve a safe state
during and after a path failure. Examples of critical control functions are emergency stop and
overtravel stop, power outage and restart.
• Separate or redundant control paths must be provided for critical control functions.
• System control paths may include communication links. Consideration must be given to the
implications of unanticipated transmission delays or failures of the link.
• Observe all accident prevention regulations and local safety guidelines.(1)
• Each implementation of this equipment must be individually and thoroughly tested for proper
operation before being placed into service.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
(1) For additional information, refer to NEMA ICS 1.1 (latest edition), “Safety Guidelines for the
Application, Installation, and Maintenance of Solid State Control” and to NEMA ICS 7.1 (latest
edition), “Safety Standards for Construction and Guide for Selection, Installation and Operation
of Adjustable-Speed Drive Systems” or their equivalent governing your particular location.
WARNING
UNINTENDED EQUIPMENT OPERATION
• Only use software approved by Schneider Electric for use with this equipment.
• Update your application program every time you change the physical hardware configuration.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
1. OVERVIEW
UserInterface is a software application that allows the developer to create user interfaces
for embedded systems based on HMI runtime.
UserInterface is an easy to learn and use software, which allows the user to implement
graphical interfaces in a visual way. The realized pages are viewed in UserInterface as
they will appear on the final target.
Thanks to its multi-pages structure, UserInterface can support HMI (Human Machine In-
terface) applications with an arbitrary number of pages.
It is equipped with a considerable number of tools to realize even complex applications
and it interfaces directly to the PLC IEC1131 Application compiler for managing the vari-
ables which are defined in the target PLC application.
The following paragraphs show you the main features of this product.
Each page may contain an arbitrary number of defined graphic controls. There are
two classes of graphic controls:
∙∙ Static controls: drawing tools such as lines, rectangles, and figures.
∙∙ Dynamic controls: multilayered objects, which enable data and images display
and user interaction (strings, editboxes, textboxes, buttons, progress, charts and
trends, custom controls).
Multi-pages structure
Resources management
The controls’ properties in the page are not statically defined in the project code, but
they can be managed separately as resources.
Resources include fonts for characters display, images, string table, enumerated data
types, and elements sets.
Specifically regarding the images, UserInterface allows to import bitmap files directly
from the Windows-formatted file (.bmp, .gif, .emf, .jpg, .ico etc.).
Languages management
Strings and enumerated data types are structured as to ease the multilingual device;
moreover UserInterface provides a function to export/import the above mentioned
elements to/from a text file, in order to simplify the translation from a language to
another.
Multilingual support
UserInterface allows you to change strings, resources, and enumerations language
without recompiling nor reloading the application.
Events management
UserInterface applications are structured in events; the user may seize the available
events and manage them through ST-coded procedures.
You can establish the communication with the target device through the PC communica-
tion drivers, thus using one of the available custom protocols (which can be easily imple-
mented thanks to the modular structure of the communication system).
Type the name you want to assign to the project in the Name field, and in the Directory
field specify the directory where you want to create the project folder.
Select the target which will execute the HMI from the Target selection menu. The
contents of this menu can be customized: if the desired target does not appear in the list,
refer to your hardware provider.
Confirm your choice by pressing OK. UserInterface automatically creates the folder l:\
Demo manuale\Demo HMI as specified in Directory.
Select the Insert page option from the menu which has just shown up. This causes a
dialog box to appear where you have to specify the page name and whether the page is
a pop-up one or not.
If you do not select the Pop-up property when creating it, the page is called Child Page.
Its main feature is that it fits the whole video area. Consequently the user cannot define
position and size of a child page because they are automatically set depending on the
video area and on an eventual frame set (see paraghaph 4.2).
Choose to create a child page and call it Init: type the name Init in the apposite field
and press OK to confirm your choice. A new node appears in the pages folder of the
project tree.
Double-click on the Init item to open the document with this page preview(1), which is
blank at the moment.
Pressing it, the colors palette appears(1). Then you can select the desired color.
Consequently a new item appears in the Pages folder of the project tree.
After editing the colors, too, the new window will look like the picture below(1).
The grey area in the centre is the active area of the Pag2 page, whereas the clearer area
which surrounds it represents the video area of the target system. In this way you obtain
a clear vision of the new page placement.
The text and the background color and the used font are the same for all the pages of the
project, so you will not find them in this specific page properties. In order to customize
these features, double-click on the Properties item of the project tree.
A multi-tabs window opens. In System options assign the font (in this case 8x16), the
text color and the background color (in this case respectively white and blue).
In order to indicate the start page, select the desired one from the list. Then confirm your
choice by clicking OK.
The start page is marked in the project tree by a red triangle.
Move the mouse to the active area of the page. A cross + appears. The object will be in-
serted in the grid near to the mouse cursor.
Confirm the insertion point by left-clicking. A new Line control appears(1). It has a default
size and horizontal alignment.
You can resize it by dragging one of the two ends of the line(1).
You can edit the line thickness through the Thickness points property of the control. For
example, assign a 3 pixel thickness.
In the page preview you can see how the line looks like(1).
Move the mouse to the active area of the page. A cross + appears. The object will be in-
serted in the grid near to the mouse cursor.
Confirm the insertion point by left-clicking. A new Rectangle control appears(1). It has a
default size.
You can edit both the dimensions dragging one of the rectangle vertexes, or one dimen-
sion at a time dragging one of the rectangle’s sides(1).
You can customize the border and the background color and the transparency through the
control properties. For example, make the rectangle white and opaque with white border
and thickness set to 1.
If the target has new feature of trasparency the properties are now like this.
In the page preview you can see how the rectangle looks like(1).
Now superimpose another rectangle to the first one. Let us assume that you want the new
rectangle to be transparent with black borders, and thickness set to 2.
If the target has new feature of trasparency the properties are now like this.
Pressing the Browse button, you can navigate in the computer resources and select the
source file. In this case, the source file is BulbOn.jpg, which represents a lighted bulb(1).
In the Bitmap Name field, you can assign the bitmap name which will appear in the re-
sources tree; the default name is the file name without extension and preceded by the
Bmp prefix.
The Transparency color field lets you specify the transparency color, that is a color
which will not be really drawn but will let the elements appear through the bitmap back-
ground.
You can customize the transparency color by taking the desired one with the mouse from
the Converted bitmap window.
RGB indicate the transparency color components. If the values are n/a it means that no
transparency color has been selected. The Reset Transp. button lets to cancel the last
selected transparency color.
At last you can confirm the operation by clicking the Import button. The imported bitmap
appears as a new item in the resources tree.
Move the mouse to the active area of the page. A cross + appears. The object will be in-
serted in the grid near to the mouse cursor.
Confirm the insertion point by left-clicking. A new blank frame appears(1).
Trough the Bitmap property specify the image which this Image control must display.
Choose the desired bitmap from the list; in this case, you can see and select the only
bitmap which you have imported: BmpBulbOn.
The control changes its size to be compatible with the assigned bitmap measures. The
image in the page preview looks like the following picture(1).
Move the mouse to the active area of the page. A cross + appears. The object will be in-
serted in the grid near to the mouse cursor.
Confirm the insertion point by left clicking. A new Static (that is string) control with the
default text str appears(1).
You can edit the contents of the string through the Text property of the control. For ex-
ample, Text string.
This is the basic use of the string. Alternatively you can assign strings by taking them
from the resources (see paragraph 4.9.3).
A dialog window opens requesting to specify the new variable’s basic features. We can
declare n as a new 16 bit unsigned integer variable.
Confirm the operation by clicking Ok. The new corresponding record is added to the vari-
ables editor.
You can change this new variable’s features editing the fields of the record which you
have just created. For example, you may assign an initial value different from null and a
comment.
or when you close the variables editor, UserInterface adds a new item in the pages tree.
It corresponds to the local variable which you have just declared.
Follow the steps as shown in paragraph 2.8.1, until the new global variable appears as a
new item in the pages tree.
A variable of the Application project can be exported to UserInterface if it has been al-
located on a datablock (it is not an automatic variable). If this pre-condition holds, when
compiling the PLC, the program automatically creates an .exp file, which contains a list
of the exported variables with their location in the datablocks, which the UserInterface
program can work out.
In order to import in UserInterface the variables which have been exported from the PLC
Application project, you have to select the Link PLC variables file… from the Project
menu.
A window opens and lets you select the file which contains the exported variables.
If you confirm to include the .exp file in the UserInterface project, a new table called PLC
vars appears in the libraries window. It contains the list of the exported variables.
When you need to update the list of the exported variables, if the .exp file has not been
moved to another directory, it is not necessary to repeat the above mentioned procedure.
It is enough to launch the Refresh PLC variables command from the Project menu.
Through the Add Device button you can add a new object linked to the target on the
fieldbus.
The selection window appears. Then you have to take from your PC a .parx file (see
chapter 7). After inserting this file, the parameters management window will look like the
image below.
A device called Frigo has been inserted. In order to see the relevant parameters, click
the Close button.
In the Window target vars and parameters you will see the device and its param-
eters.
When you need to update the list of parameters, if the .parx file has not been moved to
another directory, it is not necessary to repeat the above mentioned procedure, but it is
enough to press the button
Move the mouse to the active area of the page. A cross + appears. The object will be in-
serted in the grid near to the mouse cursor.
Confirm the insertion point by left-clicking. A new text frame appears(1). It consists by
default in a certain number of characters and its font is specified in the Font property of
the page.
In the following list you can find all the changes which may be carried out:
-- Appearance: you can make the edit box appearance “sunken” by assigning the Sunken
property.
-- Font: you can customize font by choosing, for example, a 16x32 font instead of the
default 8x16 font.
-- Select background and Select Foreground: respectively text and background colors
when the edit box is selected.
-- Number of Chars: maximum number of characters which can be displayed.
-- Access: in order to set the read-only mode, replace RW (read-write) with RO (read-
only).
-- Refresh: in order to constantly update the contents of the edit box, select the TRUE
option. Otherwise, the contents are refreshed just when drawing the page for the first
time.
-- Label: if the target has a touchscreen display, shows keyboard and has this feature
enabled, it is possible to add this text/’string resource’ as header of keyboard.
-- Format: it represents the display format of the associated variable’s value. The format
value can be inserted only if a variable is just available. It opens a dialog window with
these settings according to the type of variable (integer, real, string).
You can restrict the research just to the local variables of the Init page (consequently
only the n variable) by using the Filter tool.
Select the local variable. The Variable field in the table properties refreshes accordantly.
Then the Edit box control shows the n local variable’s value constantly refreshed.
You can associate the Edit box with the global variable through the dialog window which
was introduced in the preceding paragraph, but in this case it is necessary to use a differ-
ent filter in the Filter field.
You can associate an Edit box with a target variable through the dialog window which
opens from the Variable field, but in this case it is necessary to use a different filter in
the Filter field.
Move the mouse in the active area of the page; a cross + appears. The object will be in-
serted in the grid near to the mouse cursor.
Confirm the insertion point by left-clicking. A new Button control appears. It has a default
size.
You may edit both the dimensions by dragging one of the button’s vertexes or one dimen-
sion at a time by dragging one of the button’s sides.
The Border color and the Background Color properties determine the border and the
background color when the button is inactive, whereas the Selection Border and Se-
lection Background properties define the border and the background color when the
button is selected(1).
The Selection variable property determines the state of the button and, consequently,
the couple of colors related to the control. This property may be associated either with
a constant value (FALSE = the control is always inactive, TRUE = the control is always
selected, on PRESS = the control is automatically selected when the user presses the but-
ton) or with a boolean variable whose value determines dynamically the selection state.
Declare a boolean global variable b and associate it with the control button as selection
variable.
You may customize the button appearance through the Appearance property. For exam-
ple, choose the Sunken option(1).
The Press variable property allows the user to associate a boolean variable with a but-
ton control. The boolean variable’s value corresponds to the pressure state of the button.
For example, associate the button which you have just created with the global variable b
which has been created paragraph 2.10.1.
At runtime, the LED-button (see paragraph 2.10.1) will be red when pressing the Press
button. Otherwise it will be green.
Press successively Ctrl+C and Ctrl+V. A cross + appears. The object will be inserted in
the grid near the mouse pointer.
Confirm the insertion point by clicking under Press. A copy of the control appears(1); it is
the same as the source button except its position and name.
You can access this new control’s properties and customize them according to the relative
purpose(1).
The button control has got a very important attribute, which has not been represented
in the properties grid above: the Action attribute allows the user to associate an action
with the button pressure. Some actions require an additional parameter which you may
specify in the Action par field.
In this case let us assume that you want that the pressure of the Open button opens the
Pag2 page. To obtain this select the OpenPage action in the Action field; then type the
name of the child page Pag2 in the Action par field.
A little dialog window opens. The user is then required to type the new procedure’s name.
In this case, it may be prcIncrem.
Press the OK button. Then UserInterface adds a new item in the page tree: it corresponds
to the local variable which has been just declared.
Double-click on the above mentioned new item: the ST language editor opens and lets
you either implement or edit the selected procedure’s code.
Write a procedure that applies a unit increment to the n variable.
Let us suppose that you want to execute the prcIncrem procedure by clicking the + but-
ton: select the Call action in the Action field and type the procedure’s name in the Ac-
tion par field.
Every time the user will press the + button when executing the HMI, n will increase by one
and the edit box will show the up-to-date value.
Let us assume that you want to assign this control’s visibility to the local variable n, which
is displayed in the edit box created in paragraph 2.9.2 and managed by the prcIncrem
procedure, which was implemented in paragraph 2.10.4 and started up by the + but-
ton. More precisely, let us suppose that you want the text string visible when n is even,
whereas hidden when n is odd.
To this purpose, it is necessary to declare a new boolean local variable which indicates
whether at present n is even.
Then it is necessary to edit the prcIncrem procedure so that, when it refreshes the n
value, it evaluates again whether it is even or odd. In order to access the prcIncrem
source code, select the corresponding item in the project tree by right-clicking. After-
wards, choose Open from the contextual menu which appears.
The ST language editor opens and the procedure’s code may be extended as follows.
In order to associate the string’s visibility state with the even boolean variable, select the
text string and click the Visibility field: a button appears.
After clicking it, a dialog box opens. Select the radio button Variable, which enables
the overhead variables list; change the filter Filter into Page locals and select the only
local boolean variable that is even.
The user is required to select a suitable communication protocol from the left column and
to activate it by pressing the Activate button.
Then the Properties button becomes active: by clicking it the user accesses another
dialog window which is different in accordance with the specific selected control and lets
set the protocol’s parameters. Let us consider the following example.
Compilation is composed of two phases: the first one consists in the PLC code generation
which realizes the pages as they have been planned in UserInterface. The program shows
in the Output window the progress level of the compilation and displays eventual errors.
The second one consists in the compilation of the PLC code which has been generated
during the first phase. It can be started only if the first phase has been accomplished
without any error.
This process is carried out by an external tool: the PLC command-line compiler llc, which
UserInterface automatically invokes with the suitable parameters.
Clicking it, you activate again the PLC command-line compiler llc, which this time just
downloads the compiled code in the target.
The downloading permission management depends on the implementation of the on board
firmware. Consequently it changes according to the destination target of the download.
2.12.4 SIMULATION
Depending on the target device you are interfacing with, you may be able to simulate the
execution of the HMI application with UserInterface’s integrated simulation environment:
Simulation.
In order to start the simulation, just click on the appropriate item on the Project toolbar.
3. USERINTERFACE LAYOUT
The following picture shows you the layout and the essential elements of UserInterface.
3.4 TOOLBARS
The user can give commands to UserInterface through some useful toolbars. A toolbar
can be defined as a collection of buttons which you may enable by left-clicking them and
whose functions are intuitively represented by their icons.
The toolbars support tooltips, too. A tooltip is a small text frame containing a short de-
scription of the object which UserInterface automatically displays when you hover with
the mouse over a button.
UserInterface is endowed with three essential toolbars:
-- Main toolbar: it contains the commands to open and save the project, to cancel/restore
the last changes, to print, to display or close other toolbars.
-- Project toolbar: it allows you to add new elements to the project as variables, pages,
events, actions, as well as to enable or prevent the simulation mode and to compile and
download the whole project.
-- Page toolbar: it allows you to choose a new type of control to be inserted in the active
page, to align or equally space several controls, or to set the vertical order of the ele-
ments on the page.
4.1.1 GENERAL
It allows to select the UserInterface project’s start page among the implemented pages.
The Page Model feature allows to select the type of page model in case of a page calls
another page. If the model is hierarchical then a child page cannot recall a parent page.
Instead if the model is flat all the pages can call the others without limitations.
It allows you to add, remove, export, import, and select the resources languages (see
paragraph 4.9). The label: sysLangID Value indicates the value which the sysLangID
target variables must take to display the pages in the selected language.
In order to add a language, apply the following procedure.
First of all export the language supported by the translator, choose Italian and press the
export...button, which opens a window requiring the destination folder for the selected
language file.
The program suggests a file name: Res + project title+’_’ + first three characters of the
language + extension.txt. At the end of the exportation the file is composed of all the
project’s resources which have to be translated:
-- strings
-- enumeratives
Translate the file and replace the text under the Language tag with the one of the new
language (for example, in this case change it into Chinese). In the Language selection
panel choose the Import... button, then select the suitable file in the PC.
The new language appears in the list.
Global on timer allows you to specify the name of a global procedure to be periodically
and independently executed on the active page. Such a procedure may be effectively used
to constantly test one or more PLC variables and to emit alarm messages, for example
through asynchronous messages (see paragraph 4.3.4).
UserInterface allows to define areas which are called frames and are placed on the sides
of the screen and are always active(1).
The user may set these frames’ dimensions and insert some controls which are active
whatever the currently loaded page. Consequently frames are useful to host the objects
which have to appear in the whole project. In this way the user does not need to duplicate
them in each page.
As regards to the above, there are two exceptions: the pop-up pages (see paragraph
4.3.3) when the Modal property is set to Yes and all the asynchronous messages. When
these pages are active, the controls of the frame set are automatically disabled.
4.3 PAGES
4.3.1 NAVIGATING BETWEEN PAGES
UserInterface manages pages development for a specific application as projects.
UserInterface project is composed of pages where the user can arbitrarily arrange con-
trols.
In each UserInterface project it is necessary to define a start page which will be viewed
at system startup. Other pages must have at least a parent page from which they are
invoked and may have child page to invoke. The invoking-invoked relations of the pages
give the whole project, even though in an implicit way, a multi-node tree structure.
A child page may be invoked in two ways:
-- Through an action associated to a key: associate an OpenPage action with a physical
key (if there is a keyboard) or with a virtual key (whose pressure is an event raised by
software);
-- Through an action associated with a button: insert in the parent page a Button control
(see paragraph 4.4.7) and specify in the Action property that by pressing it the child
page opens.
A child page fits the whole screen or, alternatively if there are defined frames (see para-
graph 4.2), it fits the free remaining area. Consequently, the user cannot define position
and dimensions of a child page as they are automatically set according to the screen and
the frame set.
When creating a new page, if the user selects the aforesaid checkbox with the Pop-up
label, the new page will be a pop-up one(1).
There are no restrictions about position and dimension. In fact the user may superimpose
a pop-up page on the frames: when activating this page, if it is not modal (property:
Modal), the controls superimposed on the open page will be disabled; otherwise, all the
controls will be inactive.
4.4 CONTROLS
A control is a display element which is contained in a page. The following paragraphs
shows you the controls which UserInterface supports.
4.4.1 STATIC
It displays a fixed string, whose contents cannot be edited when executing. In fact, you
should specify the text of the string directly or by the association of the ID of a string de-
fined as resource to support multi language management. For project resources and multi
language support see paragraph 4.9.
In order to insert a Static control, press the corresponding button in the Page tool-
bar.
Then click the point where you want to insert the control.
You can get information on properties and events of the Static control in paragraph
5.4.
Then click the point where you want to insert the control.
In order to insert a Rectangle, press the corresponding button in the Page toolbar.
Then click the point where you want to insert the control.
You can get information on properties and events of the Line and Rectangle controls in
paragraphs 5.5-5.6.
Then either click the point where you want to insert the control or drag a variable from
the project tree or from the library window.
You can get information on properties and events of the Edit box control in paragraph
5.7.
Then either click the point where you want to insert the control or drag a variable from
the project tree or the library window.
You can get information on properties and events of the Text box control in paragraph
5.8.
4.4.5 IMAGE
It displays a bitmap image.
In order to insert an Image press the corresponding button in the Page toolbar
Then click the point where you want to insert the control.
You can get information on properties and events of the Image control in paragraph 5.9.
4.4.6 ANIMATION
It displays a bitmap image which you select from a list of images depending on the value
of an associated selection variable.
In order to insert an Animation press the corresponding button in the Page toolbar.
Then click the point where you want to insert the control.
You can get information on properties and events of the Animation control in paragraph
5.10.
4.4.7 BUTTON
You may use the Button control either to check a boolean variable’s state or (press=
TRUE, release = FALSE) or to send a command to the system.
In order to insert a Button press the corresponding button in the Page toolbar.
Then either click the point where you want to insert the control or drag a boolean variable
from the project tree or the library window.
You can get information on properties and events of the Button control in paragraph
5.11.
4.4.8 CHART
Chart control draws the static diagram of one or more arrays of values associated.
In order to insert a Chart control, click the corresponding button in the Page toolbar.
Then click the point where you want to place the control.
You can get information on properties and events of the Chart control in paragraph
5.14.
4.4.9 TREND
After assigning up to 8 numerical variables, the object will automatically and periodically
(once every a defined time) acquire their values and will draw the corresponding graphic
in a dynamic and automatic way.
In order to insert a Trend control press the corresponding button Page toolbar.
Then click the point where you want to insert the control.
You can get information on properties and events of the Trend control in paragraph
5.15.
Then click the point where you want to place the control.
You can get information on properties and events of the Progress bar control in para-
graph 5.12.
Then either click the point where you want to insert the control or drag a variable from the
project tree or from the library window. You can get information on properties and events
of the Combobox control in paragraph 5.16.
4.4.12 CHECKBOX
Displays a check box that allows the user to select a true or false condition indetified by
a variable.
In order to insert an Checkbox, click the corresponding button in the Page toolbar.
Then either click the point where you want to insert the control or drag a variable from the
project tree or from the library window. You can get information on properties and events
of the Checkbox control in paragraph 5.17.
Then click the point where you want to insert the control.
You can get information on properties and events of the Custom control in paragraph
5.13.
4.5 VARIABLES
In a UserInterface project there are different classes of variables. The following para-
graphs show you their features.
Local variables are variables of the UserInterface project. You can access them only
through the page they were declared from.
They are listed in the project tree, under the Local variables folder. Local variables can
be used to carry out operations on PLC (for example to apply a different scale or to add
an offset) or system variables or to implement local procedures.
Global variables are declared in UserInterface and they are accessible from every page of
the project. Global variables are listed in the Global variables folder in the project tree.
The function of the global variables is similar to the local variable’s one but the different
visibility scope makes them unusable for the implementation of global procedures or for
the parameters passing between distinct pages.
A compiled UserInterface project consists in a PLC that, once downloaded on the target
board, is executed by the actual PLC., which is implemented with Application. Variables
exported from the Application PLC contained in the .exp file enable the interaction be-
tween these two distinct components. PLC variables which are not automatic, thus associ-
ated to a datablock are exported in the .exp file.
In order to include a .exp file in the UserInterface project, press the Link PLC variables
file option from the Project menu, then search for the file in the PC resources. After
linking a .exp file to the UserInterface project, you can get a list update of the exported
variables by selecting the Refresh PLC variables option from the same menu.
The interaction between UserInterface and target is enabled by system variables which
the software publishes outside in a .tgt file.
You may access system variables in read/write or in read-only mode; if you try to access
a read-only variable in write mode, an error will occur when compiling.
We created before a set of five elements named BIOSParameters, now we can associate
#BIOSParemeters(0) to the first edit box and #BIOSParemeters(1) to the second. So
there are three pages: first page with the first two elements of the set, second page with
elements 2 and 3 and third page showing the last element of the set. In the last page the
second edit box is not visible.
These variables can be used in the page to show the numeration of the pages. In fact they
can be used as variables associated to edit box controls in this way(1):
Next, application asks user to insert the name of the file in which the page will be saved.
This file assumes a .pex extension. Export file contains page info and local procedures.
Import operation is quite similar to the export operation. Select Pages node, click with
right button and select Import page from the popup menu. User can then select the file
of the page to import. Imported page takes the same name that it had when it was ex-
ported.
N.B.: this operation changes only the name of the page, project references to the re-
named page are not automatically updated.
To export a page into a library of templates follow the procedure paragraph 4.7.1 initial
steps then select Export page as template from the menu.
A library file with .petx extension (new or already existing) should be indicated. Template
is appended to the existing templates and a name for the library is requested. If the tem-
plate is already available in the library a message asks the user if he desires to rewrite
the existing template or not.
Page is exported as template into the specified library with all its element but without any
referenced variable.
Scripts and local variables are exported without changes. References to variables con-
tained in the scripts are not modified.
Child pages, popup and asynchronous messages can be treated as templates.
Template library has been included to the project. Press Close button, Templates window
is shown: there is a tab for each library imported in current project.
Once a template library has been added it is possible to use its elements simply dragging
the chosen one from the template window and dropping it on the project tree.
Once the item has been dropped application asks the user for the name of the new page
created (based on the template).
It is possible to delete templates from the (local) template library using Edit command in
the Template management window.
4.8 EVENTS
There are different classes of events.
Programmer can raise events by software using the function Video_SendEvent inside the
target software or in the body of the procedure, using following syntax:
Video_SendEvent( event_id, param );
Where event_id is the identifier of the type of the event and param is an integer 16 bit
parameter.
UserInterfacesupports software events defined in this table:
Local procedures
This kind of procedures can be called only within the scope of the page in which are
declared. In particular, they can be associated to the events of the page itself and of
all their controls. The same can be said for software events raised when the page they
refer to is active. Procedure code can contains references to all the types of variables,
with local variables of the page too.
Global procedures
This kind of procedures can be called from every page and can be also used as peri-
odic asynchronous routine of alarm management. They cannot contain variables refer-
ences.
Here follow the description of the syntax to get the properties of a control from a proce-
dure; similarly to C language printf it is:
“fb%s%s.%s”, page_name, ctrl_name, prop_name
Where:
-- page_name is the name of the page that has the control;
-- ctrl_name is the name of the control;
-- prop_name is the name of the property of the control.
So if we want to get the property Foreground color of the Static named String_26 in
Main page, we have to write:
fbMainString_26.foreCol
N.B.: the name of the property to use in the scripts of the procedures is the name of the
functional block exported by the software of the target (see paragraph 8.2), not the name
in the properties window (see paragraph 3.3).
This table permits to associate a code of a key to one of the actions listed in the following
table. In this way the pressure of that key causes the specified action.
4.9 RESOURCES
A resource is an interface element. User can get informations from resources or can use
them to do actions.
UserInterface supports different categories of resources that are managed by Tab Re-
sources project window. (see paragraph 3.1). Categories are explained in details in the
following paragraphs.
4.9.1 FONTS
Fonts are the different kinds of characters supported for the output of text strings on the
screen. Fonts had been managed by PageLab old versions as text files with .plf exten-
sion and structured with the same syntax of the initialization definition of an array vari-
able in IEC. Now, images are saved and loaded in binary format to optimize loading time
on images of big size.
At project opening time, if PageLab finds this declaration, it searches in project folder for
a file named font_name.plk and loads it in memory.
4.9.2 BITMAPS
Bitmaps are pictures to associate to image controls (see paragraph 4.4.5). Bitmaps had
been managed by UserInterface old versions as text files with .plb extension and struc-
tured with the same syntax of the initialization definition of an array variable in IEC. Now,
images are saved and loaded in binary format to optimize loading time on images of big
size.
At project opening time, if UserInterface finds this declaration, it searches in project folder
for a file named bitmap_name.plk and loads it in memory.
UserInterface provides a tool to convert bitmaps from Windows format to UserInterface
format.
To start this tool click on Import resource > Bitmap from Project menu, it is also pos-
sible to click on Import bitmap from context menu that can be shown by right click on
Bitmaps node of resources tree.
This dialogue box will be shown as follows.
Click on Browse button to navigate computer resources to select desired source file.
In Bmp Name field user can personalize bitmap name that will be shown on resource tree;
bitmap name is constituted by file name without extension and with Bmp prefix by de-
fault.
Transparency color field allows the user to specify transparency color, so a color that is
not really drawn on the screen but a transparent color zone that does not cover elements
previously drawn.
Transparency color can be personalized by choosing it by mouse from Converted bitmap
window.
RGB indicates transparency color Red, Green, Blue components. n/a value indicates that
no transparency color has been selected.
Reset Transp. button allows the user to undo last selected transparency color.
Once finished these operations it is possible to confirm bitmap importation by clicking on
Import button.
If we refer to the identifier ID_GDB_RXNAK from a page control or from a page, if current
active language is English Bad RX packets will be shown, if current active language is
Italian Pacchetti RX errati will be shown instead.
4.9.4 ENUMERATIVES
An enumerative is a data type defined by user, it is a set of constants named by user. Each
element of an enumerative is treated as a constant and can be translated in all available
languages of the project.
e.g.: we defined ImpostazTouch enumerative that is shown on resource tree as follows.
Now we introduce an Edit box control (see paragraph 4.4.3) and insert the name of the
enumerative ImpostazTouch in its Format property field. Control will show the string
associated to the value as it is in the table above, not the numeric value of the variable
associated to the control.
If the numeric value of the variable does not match with any record of the enumerative
table, an error string ######## is shown instead.
Even enumerative are supported by multi-language feature. In fact it is possible to per-
sonalize the name of the enumerative.
e.g.: now we have an images list ListBulbs that is shown on the resource tree.
It is possible to see all the records of the list by double-clicking the node.
If we introduce an Animation control (see paragraph 4.4.6) in the page, and we set its
property Image list with the name of the enumerative ListBulbs, the control will show
the image whose specified interval includes the value of a variable associated to the con-
trol.
If the numeric value of the associated variable does not match any record in the list a
default image (with init and end value set to *) will be shown if it is. If no default image
is specified no image will be drawn.
4.9.6 SETS
As it is described above (see paragraph 4.6) sets are ensemble of global variable even of
distinct type.
In particular there are two types of set:
-- Variable/parameter sets even of not equal type (VARIANT);
-- Strings sets (STRINGS).
The sets of the first type are defined indicating VARIANT as type. This kind of set has the
following attributes:
-- Dynamic: indicates that every n execution cycles target automatically reloads the ele-
ments of the set and hides those elements that have no visibility (boolean constant
FALSE or associated visibility variable set to false at that moment).
-- Array: indicates that the unique element of this set is a variable of type array.
N.B.: this kind of set can be assigned only to an edit-box control.
In this example four sets with different characteristics have been defined.
Once defined a set, each element of the set can be added via drag & drop from Target
vars and parameters or can be manually inserted by user.
We have to define only two attributes, the string or the ID of a string resource (see para-
graph 4.9.3) and the variable/constant of visibility. As we said an element not visible will
not be shown on the screen.
N.B.: this kind of set can be used with Static control only.
Comments related to controls and pages should be inserted in the Doc tab of the proper-
ties window.
At the end of the process the following dialogue is shown. By clicking on the Open docu-
mentation link it is possible to view the generated report using the browser.
It is also possible to manually open the .html file generated. This file is created in the
project folder and is named project name.html.
N.B.: documentation generation process requires the file Documentation.xsl to be in the
project folder. This file can be personalized by user to redefine report style.
1) Click Select target in the Project menu of the UserInterface main window. This
causes the following dialog box to appear.
5.2.2 EVENTS
Event Description
OnLoad On loading this page, i.e. when calling from parent page.
On closing this page, when the page returns and the parent
OnUnload
page will be restored.
Event Description
On calling a child page and the current page is no more active.
OnDeactivate
This event does not exist in main page.
When the previous opened child page will be closed. This event
OnActivate does not appear in leaf page, i.e in the pages which do not call
child pages.
When the page starts drawing all the objects. The page has just
OnDraw
drawn border, background, and title.
Asynchronous event. The user can link a procedure and it will be
OnTimer
executed cyclically.
5.3.2 EVENTS
Event Description
OnLoad On loading this page, i.e. when calling from parent page.
On closing this page, when the page returns and the parent
OnUnload
page will be restored.
On calling a child page and the current page is no more active.
OnDeactivate
This event does not exist in main page.
When the previous opened child page will be closed. This event
OnActivate does not appear in leaf page, i.e in the pages which do not call
child pages.
When the page starts drawing all the objects. The page has just
OnDraw
drawn border, background and title.
Asynchronous event. The user can link a procedure and it will be
OnTimer
executed cyclically.
5.4 STATIC
5.4.1 PROPERTIES
5.4.2 EVENTS
Event Description
BeforeUpdate Before the object is redrawn.
AfterUpdate Immediately after the object is redrawn.
5.5 LINE
5.5.1 PROPERTIES
5.6 RECTANGLE
5.6.1 PROPERTIES
The field has one or more characters, that describe the specification. The simplest format
contains only percentage symbol and one char as type (for example: %s).
Next table explains in details functions and values.
5.7.3 EVENTS
Event Description
BeforeUpdate Before the object is redrawn.
AfterUpdate Immediately after the object is redrawn.
OnGotFocus Whenever object is selected.
OnLostFocus Whenever object loses the selection.
Whenever the object is selected and receives the command for
OnEnter
entering in edit-mode.
Whenever HMI receives a pressure on the object, valid only for
OnClick
touchscreen systems.
Whenever the user confirms the modifications and the value is
OnChange
different from start.
5.8.2 EVENTS
Event Description
BeforeUpdate Before the object is redrawn.
AfterUpdate Immediately after the object is redrawn.
Whenever HMI receives a pressure on the object, valid only for
OnClick
touchscreen systems.
Whenever the user confirms the modifications and the value is
OnChange
different from start.
5.9 IMAGE
5.9.1 PROPERTIES
5.10 ANIMATION
5.10.1 PROPERTIES
SINT, USINT,
BYTE, INT, UINT, Type of Animation var. If it is a variable, the
Data type
WORD, DINT, type is automatically defined.
UDINT, DWORD
Visible status of the object. It can be constant
TRUE, FALSE, (TRUE or FALSE) or linked with a boolean
Visible
var_name variable var_name: if var_name is TRUE the
object is visible, otherwise hidden.
5.10.2 EVENTS
Event Description
BeforeUpdate Before the object is redrawn.
AfterUpdate Immediately after the object is redrawn.
5.11 BUTTON
5.11.1 PROPERTIES
Name found in Font used for drawing the text in object. This
Font
Resources field is not sensible if it shows a bitmap.
Call, OpenPage,
Action Close, NextField, Action executed on button pressure.
PrevField, Edit
Right, Center,
Alignment Text alignment in the object.
Left
5.11.2 EVENTS
Event Description
Whenever HMI receives a pressure on the object, valid only for
OnClick
touchscreen systems.
Whenever HMI releases the pressure on the object, valid only
OnRelease
for touchscreen systems.
5.12.2 EVENTS
Event Description
BeforeUpdate Before the object is redrawn.
Immediately after the object is
AfterUpdate
redrawn.
5.13.2 EVENTS
Event Description
BeforeUpdate Before the object is redrawn.
AfterUpdate Immediately after the object is redrawn.
5.14 CHART
5.14.1 PROPERTIES
5.14.2 EVENTS
Event Description
BeforeUpdate Before the object is redrawn.
AfterUpdate Immediately after the object is redrawn.
5.15 TREND
5.15.1 PROPERTIES
5.15.2 EVENTS
Event Description
BeforeUpdate Before the object is redrawn.
AfterUpdate Immediately after the object is redrawn.
The .def files contain some definitions of target environment. UserInterface uses this
information for generating custom code.
The .def file consists of two sections. It is allowed comment, that starts with a semico-
lon.(;).
This file is included in pajx file.
Record Structure
Header Param. 1 Param. 2 Description
Screen dimension of target measured
in pixel:
SCREEN dimX dimY
-- DimX: width;
-- DimY: height.
Target board can save and restore
video memory:
SAVESCREEN 0/1 ---
-- 0: no save;
-- 1: save and restore.
Target board has touchscreen, i.e.
can use the pressure events:
TOUCHSCREEN 0/1 ---
-- 0: no touchscreen;
-- 1: exists touchscreen.
Refresh time of all objects in page,
REFRESH msec ---
measured in milliseconds.
FONT_FORMAT “HH”/“VH” --- Font encoding.
ColorSET “RGB” ---
BMP_FORMAT “SIMULAB” --- Image encoding.
Target board has support for unicode
UNICODE 0/1 ---
fonts.
Target board has a joypad that can
be used for moving among elements
JOYPAD 0/1 ---
of page and can be connected to
actions.
If set to 1 says that HMI run-time
has Video_InitHMI(), invoked on
INIT 0/1 ---
target start-up. Typically it is used for
custom commands on start-up.
If set to 1 generates PLC code
BMPFULL 0/1 --- extended for bitmap instead binary
bitmap.
where:
-- Name: name of graphical object. Ex. Editbox;
-- Version: version of HMI run-time objects.
If this value is set to -1, UserInterface does not make available this object.
where:
-- id: enumerative identifier;
-- en_key: value-key of record, must be a number;
-- en_val: value of value-key, can be a number or string.
6.3.1 DESCRIPTIONS
This paragraph describes the values for system enumeratives.
-- Enumerative 100
With this key you can define new buttons (the names will be shown in the Key field of
actions table (see paragraph 4.8.5).
The number of lines is not limited. But the user must define at least all the elements of
102 enumerative.
∙∙ id: 100;
∙∙ en_key: key encoding, one byte;
∙∙ en_val: string with key name.
-- Enumerative 101
With this key you can define new actions (the names will be shown in Action field of
actions table).
∙∙ id: 101;
∙∙ en_key: action identifier;
∙∙ en_val: string with action name.
This enumerative has a well defined number of lines. The following table shows you the
corresponding actions.
en_key Action
0 Calls local or global procedures.
1 Opens child page.
2 Closes current page.
3 Selects next object Edit Box, Button, etc..
4 Selects previous object Edit Box, Button, etc..
9 Enters editing-mode (Edit Box, Button).
10 Leaving (not implemented).
-- Enumerative 103
Define a color palette, the encoding is RGB:
∙∙ id: 103;
∙∙ en_key: index of the color inside palette;
∙∙ en_val: RGB color encoding.
RGB encoding represents 24 bit of colors: 0x00bbggrr where bb (1 byte) intensity of
blue, gg (1 byte) the green and rr (1 byte) the red. The intensity is at least 0 and at most
0xff.
The number of lines is not limited. The user can define which colors he wants.
-- Enumerative 104
Names of object styles (shown on Appearance property):
∙∙ id: 104;
∙∙ en_key: style;
∙∙ en_val: string with the name of style.
This enumerative contains at most 3 records, supported by UserInterface.
en_key Style
0 Flat, plane.
1 Raised.
2 Sunken.
6.3.2 EXAMPLE
;
; Target properties
;
SCREEN 128 64
SAVESCREEN 1
REFRESH 50
FONT_FORMAT “VH”
JOYPAD 1
INIT 1
BMPFULL 1
UNICODE 1
;
; Versions of controls
;
CTRL “Static” 1
CTRL “EditBox” 1
CTRL “TextBox” -1
CTRL “Button” 2
CTRL “Progress” 0
CTRL “Animation” 0
CTRL “Image” 0
CTRL “CustomCtrl” -1
CTRL “Chart” -1
CTRL “Trend” -1
;
; Enumeratives
;
; ENUM 100: key codes
;
ENUM 100 13 “Enter”
ENUM 100 8 “Left”
ENUM 100 12 “Right”
ENUM 100 11 “Up”
ENUM 100 10 “Down”
ENUM 100 19 “LongEnter”
ENUM 100 15 “LongLeft”
ENUM 100 16 “LongRight”
ENUM 100 17 “LongUp”
ENUM 100 18 “LongDown”
ENUM 100 30 “VK_F1”
ENUM 100 31 “VK_F2”
ENUM 100 32 “VK_F3”
ENUM 100 33 “VK_F4”
ENUM 100 34 “VK_F5”
ENUM 100 35 “VK_F6”
ENUM 100 36 “VK_F7”
ENUM 100 37 “VK_F8”
ENUM 100 38 “VK_F9”
ENUM 100 39 “VK_F10”
;
; ENUM 101: key-related actions
;
ENUM 101 0 “Call”
ENUM 101 1 “OpenPage”
ENUM 101 2 “Close”
ENUM 101 3 “NextField”
ENUM 101 4 “PrevField”
ENUM 101 9 “Edit”
;
; ENUM 102: editing-mode keys
;
ENUM 102 0 “Enter”
ENUM 102 1 “LongLeft”
ENUM 102 3 “Left”
ENUM 102 4 “Right”
ENUM 102 5 “Up”
ENUM 102 6 “Down”
;
; ENUM 103: color codes
; BBGGRR
ENUM 103 0 “0x00000000” ; Bianco
ENUM 103 1 “0x00FFFFFF” ; Nero
;
; ENUM 104: controls appearance
;
ENUM 104 0 “Flat”
ENUM 104 1 “Raised”
ENUM 104 2 “Sunken”
∙∙ digitalInput: BOOL;
∙∙ digitalOutput: BOOL;
∙∙ float: REAL;
∙∙ double: REAL;
∙∙ string: STRING.
-- strsize: number of character if it is a string type.
8.1 FUNCTIONS
This chapter lists all the functions that HMI run-time exports to UserInterface and so the
user can use them into script and procedures.
These functions are divided into several categories which are shown in details in the fol-
lowing paragraphs.
Parameter Description
dmy Reserved. Set 0.
Return Value Description
Video_InitHMI TRUE if successful, FALSE otherwise.
Parameter Description
TRUE: turns on the display.
on
FALSE: turns of the display.
Return Value Description
Video_Switch Not sensible (always TRUE).
Parameter Description
TRUE: increases display contrast.
more
FALSE: decreases display contrast.
Return Value Description
Video_LCDContrast Not sensible (always TRUE).
unsigned char Video_SaveRect( unsigned short x1, unsigned short y1, unsigned
short x2, unsigned short y2 );
Save display area to memory
Parameter Description
x1 Top-left 'x coordinate' edge relative to full page.
y1 Top-left 'y coordinate' edge relative to full page.
x2 Bottom-down 'x coordinate' edge relative to full page.
y2 Bottom-down 'y coordinate' edge relative to full page.
Parameter Description
x1 Not sensible (saved area has the original coordinates).
y1 Not sensible (saved area has the original coordinates).
x2 Not sensible (saved area has the original coordinates).
y2 Not sensible (saved area has the original coordinates).
Return Value Description
Video_WriteFromBuff Not sensible (always TRUE).
Parameter Description
res Reserved. Set 0.
Return Value Description
Video_Lock Not sensible (return input parameter res).
Parameter Description
res Reserved. Set 0.
Return Value Description
Video_Unlock Not sensible (return input parameter res).
Parameter Description
msec Suspends time measured in milliseconds.
Return Value Description
Video_Unlock Not sensible (always TRUE).
Parameter Description
Address of font for printing text in title bar (the font
pFont
must be added with Video_AddFont function ).
colFore Text color of Title Bar.
colBack Background color of Title Bar.
Return Value Description
Video_SetWndSysProps Not sensible (always TRUE).
Parameter Description
Identifier of editing function (see. Enumerative table
id
102, par. 6.3.1).
code Key code associated with editing function.
Return Value Description
Video_SetEditKey Not sensible (always TRUE).
Parameter Description
pFont Address of first byte of font.
charLen Character width of font (#pixel).
charHei Character height of font (#pixel).
Byte offset of a font that starts with ASCII 0x00
offs
(subset of characters).
Return Value Description
Video_AddFont TRUE if successful, FALSE otherwise.
Parameter Description
pFont Address of first byte of font.
charLen Character width of font (#pixel).
charHei Character height of font (#pixel).
Return Value Description
Video_AddFontUnicode TRUE if successful, FALSE otherwise.
Parameter Description
pResStrings Address of first resources string for current language.
pEnums Address of first resources string for current language.
Return Value Description
Video_LoadLanguage TRUE if successful, FALSE otherwise.
Parameter Description
left Width of left frame (#pixel).
top Height of top frame (#pixel).
right Width of right frame (#pixel).
bottom Height of bottom frame (#pixel).
colBack Background color.
-- TRUE: shows title bar;
fBar
-- FALSE: hides title-bar.
Text of title bar:
pTitle
NULL: No string in title.
-- TRUE: pTitle is a resource string;
fResStr
-- FALSE: pTitle is an address of constant string.
-- TRUE: shows system;
fSysBtn
-- FALSE: hides system button.
-- 0: Flat;
style -- 1: Raised;
-- 2: Sunken.
Parameter Description
x1 Top-left ‘x coordinate’ edge relative to full page.
y1 Top-left ‘y coordinate’ edge relative to full page.
x2 Bottom-down ‘x coordinate’ edge relative to full page.
y2 Bottom-down ‘y coordinate’ edge relative to full page.
Address of Text of title bar:
pTitle
-- NULL: no text in title bar.
Feature declaration:
b0..b7:
-- 0: Flat;
-- 1: Raised;
-- 2: Sunken.
b8:
-- 0: no title bar;
-- 1: shows title bar.
b9:
wData
-- 0: pTitle is an address of constant string;
-- 1= pTitle is a resource string.
b10:
-- 0: no system button;
-- 1: shows system button.
b11:
-- 0: window not modal;
-- 1: modal window (sensible only for pop-ups
windows).
Return Value Description
Video_InitPage Not sensible (always TRUE).
Parameter Description
colFore Color of the text of page.
colBack Background color of page.
Return Value Description
Video_SetPageColors Not sensible (always TRUE).
unsigned char Video_ClrRect( unsigned short x1, unsigned short y1, unsigned
short x2, unsigned short y2 );
Delete only a portion of display and fill with background color defined with Video_Set-
PageColors
Parameter Description
x1 Top-left 'x coordinate' edge relative to full page.
y1 Top-left 'y coordinate' edge relative to full page.
x2 Bottom-down 'x coordinate' edge relative to full page.
y2 Bottom-down 'y coordinate' edge relative to full page.
Return Value Description
Video_ClrRect TRUE if successful, FALSE otherwise.
Parameter Description
fontPtr Address of first byte of font.
Return Value Description
Video_SetFont TRUE if successful, FALSE otherwise.
Parameter Description
colForeTxt Text color.
colBackTxt Background color.
colForeSel Text color for selection.
colBackSel Background color for selection.
Return Value Description
Video_SetColors TRUE if successful, FALSE otherwise.
Parameter Description
res Reserved. Set 0.
Return Value Description
Video_ResetMaps Not sensible (return input parameter res).
Parameter Description
Limit for selecting the next edit-box:
-- FALSE: next edit-box must be selectable;
fRWOnly
-- TRUE: the next edit-box must be selectable and
writable.
Return Value Description
Handle of selected objects; if -1 the function has an
Video_NextEdit
error.
Parameter Description
Limit for selecting the next edit-box:
-- FALSE: the next edit-box must be selectable;
fRWOnly
-- TRUE: the next edit-box must be selectable and
writable.
Return Value Description
Handle of selected objects; if -1 the function has an
Video_PrevEdit
error.
Parameter Description
Handle of object that must be edited or execute his
wHnd
action.
Return Value Description
Return pressed key code for exiting edit-mode. If
Video_EnterEdit
return -1 is an error only if the object is an edit-box.
Parameter Description
Handle of object that must be edited or execute his
wHnd
action.
-- FALSE: as VideoEnterEdit();
OnlySelect -- TRUE: enables only the selection without entering
edit-mode.
Return Value Description
Return pressed key code for exiting edit-mode. If
Video_EnterEditSel
return -1 is an error only if the object is an edit-box.
Parameter Description
wHnd Handle of button.
Return Value Description
-- TRUE: last pressure event was in button area;
Video_PushButton -- FALSE: last pressure event was outside button area;
-- -1: error.
Parameter Description
Boolean parameter. It indicates if the function checks
rwReq
for the objects that have read-write access mode.
-- TRUE: last selectable object;
last
-- FALSE: first selectable object.
Return Value Description
Handle of the object; -1 if errors or do not exist
Video_FirstLastEdit
selectable objects
Parameter Description
x1 Top-left 'x coordinate' edge relative to full page.
y1 Top-left 'y coordinate' edge relative to full page.
x2 Bottom-down 'x coordinate' edge relative to full page.
y2 Bottom-down 'y coordinate' edge relative to full page.
pts Thickness.
color Line color.
Return Value Description
Video_Line TRUE if successful, FALSE otherwise.
unsigned char Video_Rectangle( unsigned short x1, unsigned short y1, un-
signed short x2, unsigned short y2, unsigned char pts, unsigned char transp,
unsigned long bordCol, unsigned long fillCol );
Draw a rectangle
Parameter Description
x1 Top-left 'x coordinate' edge relative to full page.
y1 Top-left 'y coordinate' edge relative to full page.
x2 Bottom-down 'x coordinate' edge relative to full page.
y2 Bottom-down 'y coordinate' edge relative to full page.
pts Border thickness.
-- TRUE: transparent square;
transp
-- FALSE: solid square.
bordCol Border color.
fillCol Fill color. The value is not sensible if transp is TRUE.
Return Value Description
Video_Rectangle TRUE if successful, FALSE otherwise.
unsigned char Video_DrawBorder( unsigned char style, unsigned short x1, un-
signed short y1, unsigned short x2, unsigned short y2, unsigned char pts,
unsigned char color );
Draw a border outside the rectangle area
Parameter Description
-- 0: flat;
style -- 1: raised;
-- 2: sunken.
x1 Top-left 'x coordinate' edge relative to full page.
y1 Top-left 'y coordinate' edge relative to full page.
x2 Bottom-down 'x coordinate' edge relative to full page.
unsigned char Video_DelBorder( unsigned char style, unsigned short x1, un-
signed short y1, unsigned short x2, unsigned short y2, unsigned char pts
);
Delete a border outside the rectangle area. The color of fill is the page color assigned with
Video_SetPageColors
Parameter Description
-- 0: flat;
style -- 1: raised;
-- 2: sunken.
x1 Top-left 'x coordinate' edge relative to full page.
y1 Top-left 'y coordinate' edge relative to full page.
x2 Bottom-down 'x coordinate' edge relative to full page.
y2 Bottom-down 'y coordinate' edge relative to full page.
pts Border thickness It's sensible only if style = 0
Return Value Description
Video_DelBorder TRUE if successful, FALSE otherwise.
Parameter Description
ptrBmp Address of first byte of bitmap.
x Top-left 'x coordinate' edge relative to full page.
y Top-left 'y coordinate' edge relative to full page.
Return Value Description
Video_PrintBitmap Not sensible (always TRUE).
Parameter Description
ptrBmp Address of first byte of bitmap.
x Top-left 'x coordinate' edge relative to full page.
y Top-left 'y coordinate' edge relative to full page.
Return Value Description
Video_DelBitmap Not sensible (always TRUE).
Parameter Description
x1 Top-left 'x coordinate' edge relative to full page.
y1 Top-left 'y coordinate' edge relative to full page.
Bottom-down 'x coordinate' edge relative to full
x2
page.
Bottom-down 'y coordinate' edge relative to full
y2
page.
Return Value Description
Video_InitBmpTreeRefresh Address of invisible device context.
Parameter Description
pDC Address of invisible device context.
x1 Top-left 'x coordinate' edge relative to full page.
y1 Top-left 'y coordinate' edge relative to full page.
Bottom-down 'x coordinate' edge relative to full
x2
page.
Bottom-down 'y coordinate' edge relative to full
y2
page.
Return Value Description
Video_EndBmpTreeRefresh Not sensible (always TRUE).
Parameter Description
str Text to print.
x Top-left 'x coordinate' edge relative to full page.
y Top-left 'y coordinate' edge relative to full page.
Return Value Description
Video_PrintStr Number of chars printed.
Parameter Description
idRes Identifiers of resource.
x Top-left 'x coordinate' edge relative to full page.
y Top-left 'y coordinate' edge relative to full page.
Return Value Description
Video_PrintResStr Number of chars printed.
Parameter Description
str Text to print.
-- kACS_PRINT: print with colForeTxt and colBackTxt
colors.
accMode
-- kACS_SELECT: print with colForeSel and
colBackSel colors.
x Top-left 'x coordinate' edge relative to full page.
y Top-left 'y coordinate' edge relative to full page.
nChar Maximum number of chars to print.
Alignment of text. It is sensible only if nChar > length
of str:
format -- 0x08 = right alignment;
-- 0x10 = center alignment;
-- 0x20 = left alignment.
Return Value Description
Video_PrintNChar Number of chars of truncated string.
Parameter Description
idxDevice Index of device connected.
idxParam Index of parameter.
subIdxParam Sub-index of parameter.
Parameter Description
idxDevice Index of device connected.
idxParam Index of parameter.
subIdxParam Sub-index of parameter.
pVal Address of variable that contains the value to write.
Parameter type. Available values:
type tyBool, tySInt, tyUSInt, tyByte, tyInt, tyUInt,
tyWord, tyDInt, tyUDInt, tyDWord, tyReal,
tyString.
Return Value Description
Integer values:
-- 0 = successful;
-- 1 = index of parameter not found;
-- 2,8,9 = system errors;
Video_SetParam -- 3 = type not valid;
-- 4 = read-only parameter;
-- 5 = cannot write now;
-- 6 = the value is less than the min value;
-- 7 = the value is more than the max value.
Parameter Description
Available values:
-- kWM_NULL = no event;
-- kWM_KEY = key pressure;
msgID
-- kWM_MSG = open message;
-- kWM_SELECT = select an edit-box, a button;
-- kWM_PUSH = pressure on button.
Event parameter. It has a different meaning according
to msgID:
-- if kWM_NULL= not sensible;
-- if kWM_KEY= pressed key.
For the key a constant value exists. The syntax is:
wParam
kKEY_<key> Ex. LongLeft -> kKEY_LongLeft
-- if kWM_MSG =ID of message page to open;
-- if kWM_SELECT= handle of selected edit-box, button;
-- if kWM_PUSH= handle of pressed button.
Parameter Description
dmy Reserved. Set 0.
Return Value Description
Double word with inside the encoding.
16 low bit = type of event:
-- kWM_NULL = no event;
-- kWM_KEY = key pressure;
-- kWM_MSG = open message;
-- kWM_SELECT = select an edit-box, a button;
Video_GetEvent -- kWM_PUSH = pressure on button.
16 high bit = event parameter:
-- if kWM_NULL= not sensible;
-- if kWM_KEY= pressed key;
-- if kWM_MSG= ID of message page to open;
-- if kWM_SELECT= handle of selected edit-box, button;
-- if kWM_PUSH= handle of pressed button.
“(1)”
Available figures and colors depend on target’s features.
Contents
1. Overview 449
SAFETY INFORMATION
Important Information
Read these instructions carefully, and look at the equipment to become familiar with the device
before trying to install, operate, or maintain it. The following special messages may appear
throughout this documentation or on the equipment to inform of potential hazards or to call
attention to information that clarifies or simplifies a procedure.
The addition of this symbol to a Danger safety label indicates that an electrical hazard
exists, which will result in personal injury if the instructions are not followed.
This is the safety alert symbol. It is used to alert you to potential personal injury
hazards.
Obey all safety messages that follow this symbol to avoid possible injury or death.
DANGER
DANGER indicates an imminently hazardous situation which, if not avoided, results in death
or serious injury.
WARNING
WARNING indicates a potentially hazardous situation which, if not avoided, can result in
death or serious injury.
CAUTION
CAUTION indicates a potentially hazardous situation which, if not avoided, can result in
minor or moderate injury.
NOTICE
NOTICE is used to address practices not related to physical injury.
PLEASE NOTE
Electrical equipment should be installed, operated, serviced, and maintained only by qualified
personnel.
No responsibility is assumed by Schneider Electric for any consequences arising out of the use of
this material.
You can download these technical publications and other technical information from our website at:
www.schneider-electric.com
WARNING
LOSS OF CONTROL
• The designer of any control scheme must consider the potential failure modes of control
paths and, for certain critical control functions, provide a means to achieve a safe state
during and after a path failure. Examples of critical control functions are emergency stop and
overtravel stop, power outage and restart.
• Separate or redundant control paths must be provided for critical control functions.
• System control paths may include communication links. Consideration must be given to the
implications of unanticipated transmission delays or failures of the link.
• Observe all accident prevention regulations and local safety guidelines.(1)
• Each implementation of this equipment must be individually and thoroughly tested for proper
operation before being placed into service.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
(1) For additional information, refer to NEMA ICS 1.1 (latest edition), “Safety Guidelines for the
Application, Installation, and Maintenance of Solid State Control” and to NEMA ICS 7.1 (latest
edition), “Safety Standards for Construction and Guide for Selection, Installation and Operation
of Adjustable-Speed Drive Systems” or their equivalent governing your particular location.
WARNING
UNINTENDED EQUIPMENT OPERATION
• Only use software approved by Schneider Electric for use with this equipment.
• Update your application program every time you change the physical hardware configuration.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
1. OVERVIEW
The main purpose of Simulation is to execute PLC applications and HMI pages simultane-
ously in a simulated environment.
Simulation can simulate execution of:
-- PLC applications, IEC 61131-3 (made with Application).
-- HMI pages (made with UserInterface).
The execution can thus take place on the same PC used for the development process, with
the advantage of a faster and simpler testing and debugging phase, because the real final
hardware is not necessary.
NOTE: The simulation is not intended as a substitute for real, empirical testing during
commissioning. It is a means for the programmer to submit his application, or
parts of application, to unit testing and verification.
Only empirical testing with live equipment in the complete application can be
considered a valid mechanism for validation.
WARNING
UNINTENDED EQUIPMENT OPERATION
• Always empirically test your application during commissioning before placing your application
and associated equipment into service.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
2. ENVIRONMENT COMPONENTS
The following paragraph shows you the main components of the simulated environment.
3. OPERATING MODES
5) You can choose to open a recently used simulator workspace (WKSX) or create a new
one if it is the first simulation session with this PLC project; the last used workspace
will be then proposed as the default choice. The list of all used workspaces is saved
inside the PLC project itself.
6) Application will choose the right simulation target file (TGSX) from the Catalog, de-
pending on the target of the current PLC project.
7) Application can now activate the simulation status, that will be similar to the normal
connection to a physical target device, with a different connection status indicator.
While in simulation status, the PLC project will be built for the x86 processor and
the connection will take place using the GDB protocol over TCP/IP on the localhost
(127.0.0.1).
8) Then you can compile and download the code inside the simulated target.
9) In Application you can debug the code as if you were connected the real target
(watchwindow, triggers, breakpoints); it is worth to note that you will be able to de-
bug with all Application debugging features, independently of the real target capabili-
ties.
10) In Simulation you can operate in the target panel (if there is one) to simulate the lo-
cal I/O.
11) In Simulation you can operate with the I/O panels to change values of the application
parameters.
12) The simulation session is terminated when the user deactivates the simulation mode
inside Application (and the simulator will be automatically closed) or the user manu-
ally closes Simulation (in this case the communication in Application will go in the
timeout state, as in the real situation when the physical target is powered off or dis-
connected).
13) When Simulation is closed everything will be saved inside the current workspace (I/O
panels, window positions, etc.).
14) Application will save the list of recently used workspaces inside the PLC project for
further use.
5) The user can choose to open a recently used simulator workspace (WKSX) or cre-
ate a new one if it is the first simulation session with this HMI project; the last used
workspace will be then proposed as the default choice. The list of all used workspaces
is saved inside the HMI project itself.
6) UserInterface will choose the right simulation target file (TGSX) from the Catalog,
depending on the target of the current HMI project.
7) UserInterface can now activate the simulation status. While in simulation status, the
HMI project will be built for the x86 processor and the connection will take place using
the GDB protocol over TCP/IP on the localhost (127.0.0.1).
8) You can then compile and download the code inside the simulated target.
9) In Simulation you can operate on the target panel and work on the pages with the
mouse and the keyboard, and operate on the local I/O.
10) In Simulation you can operate with the I/O panels to change values of the application
parameters.
11) The simulation session is terminated when the user deactivates the simulation mode
inside UserInterface (and the simulator will be automatically closed) or the user man-
ually closes Simulation (in this case next downloads will go in the timeout state, as in
the real situation when the physical target is powered off or disconnected).
12) When Simulation is closed everything will be saved inside the current workspace (I/O
panels, window positions, etc.).
13) UserInterface will save the list of recently used workspaces inside the HMI project for
further use.
5. PROGRAM INTERFACE
It is possible to add only PLC variables that reside on a DataBlock, with an explicit address
(for example %MW1.0); you can not add to a panel automatic variables, local or global.