Legal and copyright information ............................................................................................................... 4
Purpose of the document ......................................................................................................................... 4
Symbols and styles used .......................................................................................................................... 5
Overview: User documentation for AS-i Gateway AC14 .......................................................................... 5
Overview: CODESYS documentation of 3S ............................................................................................. 6
Modification history ................................................................................................................................... 6
All product names, pictures, companies or other brands used on our pages are the property of the
respective rights owners:
AS-i is the property of the AS-International Association, (→www.as-interface.net)
CAN is the property of the CiA (CAN in Automation e.V.), Germany (→www.can-cia.org)
CODESYS™ is the property of the 3S – Smart Software Solutions GmbH, Germany
(→www.codesys.com)
DeviceNet™ is the property of the ODVA™ (Open DeviceNet Vendor Association), USA
(→www.odva.org)
EtherNet/IP® is the property of the →ODVA™
EtherCAT® is a registered trade mark and patented technology, licensed by Beckhoff Automation
GmbH, Germany
IO-Link® (→www.io-link.com) is the property of the →PROFIBUS Nutzerorganisation e.V.,
Germany
ISOBUS is the property of the AEF – Agricultural Industry Electronics Foundation e.V.,
Deutschland (→www.aef-online.org)
Microsoft® is the property of the Microsoft Corporation, USA (→www.microsoft.com)
PROFIBUS® is the property of the PROFIBUS Nutzerorganisation e.V., Germany
(→www.profibus.com)
PROFINET® is the property of the →PROFIBUS Nutzerorganisation e.V., Germany
Windows® is the property of the →Microsoft Corporation, USA
>
1.2 Purpose of the document
This document applies to the following devices of the type"AS-i Gateway AC14":
AS-i Gateway AC14 with Profinet device interface (AC1401/AC1402)
AS-i Gateway AC14 with Profibus slave interface (AC1411/AC1412)
SmartSPS AC14 with EtherNet/IP device interface (AC1421/AC1422)
It is part of the device and contains information about the correct handling of the product.
► Read this document before using the device.
► Keep this document during the service life of the device.
Designation of pushbuttons, buttons or indications
Document
Content / Description
Data sheet
Technical data of the device as a table
Operating instructions *
Notes on mounting and electrical installation of the device
Set-up, description of the operating and display elements, maintenance information, scale
drawing
Device manual
Notes on operation of the device via GUI and web interface
Error elimination
Description of the fieldbus data
Supplement device manual
Description of the acyclic data sets and the command interface
Programming manual
Creation of a project with the device using CODESYS
Configuration of the device using CODESYS
Programming of the PLC of the device
Description of the device-specific CODESYS function libraries
The user can download all documents from the ifm website.
>
1.4 Overview: User documentation for AS-i Gateway AC14
ifm electronic provides the following user documentation for the models of the device class "AS-i
Gateway AC14":
13839
6998
*... The operating instructions are supplied with the device.
Warnings used .......................................................................................................................................... 8
>
2.1 General safety instructions
8516
Read this document before setting up the product and keep it during the entire service life.
Only use the product for its intended purpose.
If the operating instructions or the technical data are not adhered to, personal injury and/or damage to
property may occur.
Improper or non-intended use may lead to malfunctions of the device, to unwanted effects in the
application or to a loss of the warranty claims.
The manufacturer assumes no liability for any consequences caused by tampering with the device or
incorrect use by the operator.
► Observe these operating instructions.
► Adhere to the warning notes on the product.
>
2.2 Required background knowledge
13323
This document is intended for people with knowledge of control technology and PLC programming to
IEC 61131-3.
To program the PLC, these people should also be familiar with the CODESYS software.
This document is intended for specialists. Specialists are people who, based on their relevant training
and experience, are capable of identifying risks and avoiding potential hazards that may be caused
during operation or maintenance of the product. The document contains information about the correct
handling of the product.
► Read this document before use to familiarise yourself with operating conditions, installation and
operation. Keep this document during the entire duration of use of the device.
Programming software CODESYS Development System
für PLC programming according to norm IEC 61131-3
3.5 SP9 Patch 7 Hotfix 3
Package "CODESYS for ifm SmartPLC
StandardLine"
Device and interface description of AS-i Gateway
AC14
Function libraries for programming of the PLC
1.6.4.14
The assured characteristics and functions described in this manuals are only accessible with
the indicated releases of the software components!
ifm electronic provides the software components for downloading on its website:
→www.ifm.com > Service > Download > Industrial communication
>
16903
3.1 Hardware
16904
Device of the AS-i Gateway AC14 product family with firmware V4.2.x
PC/laptop for CODESYS development system (→ system requirements CODESYS development
system V3.x)
Ethernet connection between CODESYS-PC/laptop and configuration interface (X3) of the device
>
3.2 Software
16905
To program the device-internal PLC of the AS-i Gateway AC14, the following software components
are required:
Use of the device-internal CODESYS PLC of AS-i Gateway AC14 without valid license
constitutes a violation of applicable law!
3.3 Licensing
All models of the device family AS-i Gateway AC14, to be programmed using the CODESYS
Development System 3.5 SP9 Patch 7 Hotfix 3, must be licensed. A valid license label can be
purchased from ifm electronic.
The CODESYS Development System (short: CODESYS) is a platform for the creation of PLC
applications according to the standard IEC 61131-3.
>
4.1.1 Install CODESYS Development System
To install the software "CODESYS Development System":
► Install the programming system CODESYS 3.5 SP9 Patch 7 Hotfix 3 (→ CODESYS installation and first steps).
> CODESYS 3.5 SP9 Patch 7 Hotfix 3 is installed on the programming PC/laptop.
Uninstall the ifm package .......................................................................................................................14
► Familiarise yourself with the following CODESYS functions!
Package Manager
→ Online help > CODESYS Development System > Manage packages and licences
Component
Description
AC14SL.devdesc.xml
Device description of the basic module
ACnnnn_EthernetAdapterSL.devdesc.xml
Device description of Ethernet interface
ACnnnn_Modbus_Master.devdesc.xml
Device description of the Modbus master (extension of the Ethernet interface)
ACnnnn_Modbus_Slave.devdesc.xml
Device description of the Modbus slave device (extension of the Ethernet
interface)
ACnnnn_Utils.library
Function library with AS-i Gateway AC14 specific CODESYS function blocks and
data structures
ACnnnn_SYS_CMD.library
Function library with function block for access to the command interface of AS-i
Gateway AC14 from a CODESYS application
AC14SL.template
Template for AC14 StandardLine
AC14SL.template.project
Template for AC14 StandardLine project
AC14.ico
Symbol image of the AC14
4.2 ifm AS-i Package
>
4.2.1 Components of the ifm package
To program the AS-i Gateway AC14, ifm provides the CODESYS package "CODESYS for ifm
SmartPLC StandardLine" (short: ifm package). The ifm package (file:
ifm_SmartPLC_StandardLine_V1_6_4_14.package) contains the following components:
► Click on [Install...] to start the installation dialogue.
► Select the downloaded ifm package and carry out a complete installation.
> The [Package Manager] window displays the installed ifm package.
►Press [Exit] to close the package manager.
>
4.2.3 Update ifm package
To update an installed package "CODESYS for ifm SmartPLC StandardLine":
1 Download new version of the ifm package
► Got to the product page of the device on the ifm website.
► Download ifm_SmartPLC_StandardLine_V1_6_4_14.package and save it on the CODESYS PC/laptop.
2 Uninstall the old version of the ifm package
► → Uninstall the ifm package (→ p. 14)
3 Install a new version of the ifm package
► → Install the ifm package (→ p. 13)
4 Update device libraries
► In the device tree: Click on [Device (ifm_SmartPLC_StandardLine)].
► Select [Project] > [Update Device].
> [Update Device] windows appears.
► Click on [Update Device] to start the update process.
> New device libraries are loaded.
> Project tree view is updated.
► Click on [Exit] to close the Package Manager.
► Save the project.
► Select [Tools] > [Package Manager] to access the package manager.
> Window [Package Manager] shows the installed packages.
► Activate [Display version] checkbox.
> The window shows the version numbers of the installed packages.
► Select the package version to be uninstalled
► Click on [Uninstall...] to uninstall the selected package.
To avoid errors during manual system configuration, it is explicitly recommended to use the
project template from ifm electronic when creating the AS-i Gateway AC14 project in
CODESYS.
5.1.1 Create new project with AS-i Gateway AC14
Qualifications
> All required software components are correctly installed (→Installation (→ p. 11)).
> CODESYS successfully started.
1 Create a new project
► Select [File] > [New Project...].
> The window to enter the project properties appears:
3. [Location]: Select the storage location of the project file.
► Click on [OK] to verify the entered values.
> CODESYS creates a new project with AS-i Gateway AC14.
> The window [Devices] shows the device tree of the project (→Overview: Project structure with AS-i Gateway
5.1.2 Overview: Project structure with AS-i Gateway AC14
17132
A CODESYS project contains all components for the programming and administration of PLC
applications. All components of a project are shown in the window [Devices] in a hierarchic tree view.
CODESYS projects with an AS-i Gateway AC14 have the following structure:
► Familiarise yourself with the CODESYS development system! In particular with the
following topics:
Names and functions of the user interface elements
Basic menu functions
Programming techniques and methods for data retention
5.2 Use CODESYS online help
6989
This manual only describes the integration, configuration and the programming of the AS-i Gateway
AC14 using the CODESYS development system.
For the description of user actions and user interface elements the CODESYS terminology will be
used.
Standard functions and methods of CODESYS will not be described. At the beginning of each section
there will be a reference to the corresponding chapters of the CODESYS online help.
To access the online help of the CODESYS development system:
► Start CODESYS.
> The CODESYS user interface appears.
► Press [F1].
> Online help of the CODESYS development system appears.
To download the created projects and applications to the device a valid network path between the
CODESYS programming system and the PLC of the device has to be selected.
>
5.3.1 Set communication path to PLC
To configure the connection between CODESYS programming software and the PLC of the AS-i
Gateway AC14:
1 Preparations
► Connect CODESYS PC/laptop and configuration interface (X3) of the device.
► Optional: Adjust IP settings of the Ethernet interfaces.
2 Select communication settings
► In the device tree: Double click on [Device ifm_SmartPLC_StandardLine]
► In the editor window: Click on [Communiation Settings] tab.
> Editor window shows the communication settings of the device.
3 Select gateway
► Select the required gateway from the [Gateway] list.
► List shows the selected gateway.
4 Select network path
► Press [Scan network...].
> [Select Device] window appears.
► Select gateway and press [Scan network] to start the scanning process.
> CODESYS scans the Ethernet network for accessible devcies.
> Window shows network path and detected devices.
18494
18500
► Select the [AS-i Gateway AC14] node.
> Information field displays detailed information of the selected node.
► Press [OK] to select the network path to the PLC.
> CODESYS is able to download data to the PLC of the AS-i Gateway AC14.
► Familiarise yourself with the following CODESYS functions!
Generic device editor
→ Online help > CODESYS Development System > Reference user interface >
Objects> object 'device' and generic device editor
>
6.1 Configure PLC
The PLC is configured via the "Generic Device Editor" of the CODESYS programming system. The
programmer can access the device editor of the PLC via the following node in the device tree:
To configure the device-internal PLC:
► In the device tree: Double-click on [ifm_SmartPLC_StandardLine]
> The editor window shows device editor of the device-internal PLC.
► Configure PLC.
► Save the project to apply changes.
► Familiarise yourself with the following CODESYS functions!
Menu command "Attach device"
→ Online help > CODESYS Development System > Devices > Attach Device...
Configure EtherCAT (master)
→ Online help > Fieldbus support > EtherCAT Configuration Editor
Configure modbus TCP (master/slave)
→ Online help > Fieldbus support > Modbus Configuration Editor
Designation
Fieldbus
Manufacturer
Modbus TCP Master
Modbus TCP
3S - Smart Software Solutions GmbH
Modbus TCP Slave
Modbus TCP
3S - Smart Software Solutions GmbH
6.2 Configure Ethernet interface
>
6.2.1 Available fieldbus stacks
The Ethernet internet (X3) of the device can be declared and operated as an additional fieldbus
interface. For this, a fieldbus stack must be assigned to the interface in CODESYS. Presently, the
device supports the following fieldbus stacks:
► Familiarise yourself with the following CODESYS functions!
Modbus configurator
→ Online help > Fieldbus support > Modbus configurator
6.2.2 Add fieldbus stack
To declare the Ethernet interface as a fieldbus interface:
1 Create/load CODESYS project
► Create or load CODESYS project with the AS-i Gateway AC14.
2 Add fieldbus stack
► In the device tree: Right-click on [X3 (Ethernet)].
► In the context menu: Select [Add Device...].
> Window [Add device] appears.
► Set the following values:
1. [Vendor]: Select [<All vendors>].
2. In table: Select the requested fieldbus stack in the [Name] column.
3. [Name]: Enter name of the fieldbus stack.
► Click on [Add Device]to add the requested fieldbus stack to the project.
> In the device tree: CODESYS adds the selected fieldbus stack as sub-element of the Ethernet interface.
3 Configure the fieldbus stack
► Configure added fieldbus device.
► Save the project to apply changes.
Access input and output data .................................................................................................................27
Use functions of the ifm package ...........................................................................................................33
Use visualisations ...................................................................................................................................40
Testing the PLC application....................................................................................................................46
► Familiarise yourself with the programming according to the standard IEC 61131-3!
1
[Application] is the container of the PLC application
2
[Library manager] provides access to the standard and device-specific function libraries.
3
[PLC_PRG (PRG)] provides access to the program editor of the application
→ Create PLC application (→ p. 25)
4
[Task configuration] provides access to the settings of the task processing
→ Configure main task (→ p. 45)
This chapter provides information about the programming of the PLC of the device.
>
7.1 Objects of a PLC application
All objects of a PLC application are listed as subelements of the node [Application] in the device tree.
In the basic configuration a PLC application contains the following objects:
7074
7143
If needed, the programmer can add additional objects to the PLC application (→Add visualisation to a
► Familiarise yourself with the following CODESYS functions!
Program application
→ Online help > CODESYS Development System > Program application
Programming reference
→ Online help > CODESYS Development System > reference programming
The memory area for RETAIN variables comprises 4072 bytes.
► Pay attention to the maximum size of the RETAIN memory area when declaring RETAIN
variables!
7.2 Create PLC application
To create a PLC application:
► In device tree: Double-click on [PLC_PRG (PRG)]
> The editor window shows the programming surface:
17691
►Program the application in the editor.
>
7.2.1 Use remanent variables
The PLC of the device supports the use of remanent variables. Variables declared as VAR RETAIN
are stored in a memory area that is also maintained when the device is switched off.
The declaration of a variable as RETAIN also influences its behaviour when the PLC application is
reset (→Supported reset variants (→ p. 54)).
Risk of undesired system behaviour!
The use of the CODESYS function SysTimeRtcSet for setting the time may lead to malfunction.
► To set the system time (date, time) of the device only use the following device-specific commands:
Function block Set_DateTime (→Set_TimeDate (→ p. 111))
System command 0x1109 with function block ACnnnn_SysCmd (→ACnnnn_SysCmd
(→ p. 121))
7.2.2 Supported programming languages
The following table shows which programming languages according to IEC 61131 are supported by
the ifm function libraries:
Options to access input and output data ................................................................................................27
Validity of the interface data ...................................................................................................................28
Process data of the AS-i slaves .............................................................................................................29
Fieldbus data ..........................................................................................................................................31
► Familiarise yourself with the following CODESYS functions!
Addresses according to IEC standard 61131-3:
→ Online help > CODESYS Development System > Programming Reference >
Operanden > Addresses
Access to IEC address via AT declaration:
→ Online help > CODESYS Development System > Programming Reference >
Declaration > AT Declaration
Definition of an ALIAS for an IEC address:
→ Online help > CODESYS Development System > Programming Reference > Data
Types > References
Coupling of a program variable to an address (mapping):
→ Online help > CODESYS Development System > Configuring I/O Links
7.3 Access input and output data
>
17447
7.3.1 Options to access input and output data
In a CODESYS project, each input and output has a physical address according to the IEC standard
(e.g. %IW5). CODESYS offers the following options to access this address from a PLC application and
thereby to access the input and outputs data of the device:
Direct access to IEC address
Access to IEC address via AT declaration
Definition of an ALIAS for an IEC address
Link a program variable to an IEC address (mapping)
* ... only available for devices with 2 AS-i masters
► When linking variables with inputs and outputs, only use interfaces in the project tree, that
are updated by the CODESYS data mapper!
7.3.2 Validity of the interface data
18413
In order to facilitate the access to inputs and outputs of AS-i slaves, AS-i Gateway AC14 projects offer
clearly defined interfaces in the device tree (→Overview: Project structure with AS-i Gateway AC14
(→ p. 18)).
Depending on the active instance for accessing the outputs of the AS-i slaves (Manual, Gateway,
PLC), the CODESYS data mapper only updates certain address areas of the interfaces. The following
table shows which address areas of the i/o interfaces provide valid data values while in a certain
operating mode:
Digital input and output data of the slave at AS-i master 1: →Digital input and output data (→ p. 30)
2
Analogue input and output data of the slaves at AS-i master 1: →Analogue input and output data (→ p. 30)
3
Digital input and output data of the slave at AS-i master 2: →Digital input and output data (→ p. 30)
4
Analogue input and output data of the slaves at AS-i master 2: →Analogue input and output data (→ p. 30)
Consider validity of the interface data (→Validity of the interface data (→ p. 28))!
The function library ACnnnn_Utils.library contains the complex variable ASi_NET. The
variable represents all inputs and outputs of a completely developed AS-i network. The
programmer can use this data structure to store the process images of the inputs and outputs
of an AS-i network. (→ASI_NET (STRUCT) (→ p. 117))
7.3.3 Process data of the AS-i slaves
17584
The project tree offers direct access to the cyclically updated process images of the inputs and outputs
of the AS-i slaves.
To access the digital process data of the slaves at AS-i master 2 in a system with 2 AS-i masters:
► Double click on [ASi_2_binaryIO]
To access the analogue process data of the slaves atAS-i Master2 in a system with 2 AS-i masters:
► Double-click on [ASi_2_analogIO]
Digital input and output data
To access the digital process data of the slaves at AS-i master 1:
► In the device tree: Double click on [ASi_1_binaryIO]
> The editor window shows a structured list of the digital inputs and outputs of the AS-i slaves.
►In column [Variable]: Mouse click on to make individual variables visible.
>
Analogue input and output data
To access the analogue process data of the slaves at AS-i master 1:
► In the device tree: Double-click on [ASi_1_analogIO]
> Editor window shows a structured list of the analogue inputs and outputs of the AS-i slaves.
17625
17626
►In column [Variable]: Mouse click on to make individual variables visible.
Data that the fieldbus transmits/receives via the fieldbus.
→ Input and output data of the fieldbus interface (→ p. 31)
2
Output data of the AS-i slaves at AS-i master 1 and AS-i master 2 that is transmitted by the higher-level fieldbus
PLC.
→ Outputs data of the AS-i slaves (→ p. 32)
Consider validity of the interface data (→Validity of the interface data (→ p. 28))!
7.3.4 Fieldbus data
The device tree offers direct access to the data that is transmitted between fieldbus and device.
>
17585
Input and output data of the fieldbus interface
The input and output data of the fieldbus interface os transmitted in cycles of 120 words each. The
programmer can access this data via IEC addresses.
To access the input and output data of the fieldbus interface:
► Device window: In the project tree, double-click on [FieldBusData_]
> Editor window shows a structured list of the inputs and outputs:
►In column [Variable]: Mouse click on to make individual variables visible.
If the output access of the device is set to "PLC", the programmer can use the data bundled in
this area to process the target values sent by the higher-level fieldbus controller to the
CODESYS PLC.
To access the digital output data of the slaves at AS-i master 2 in a system with 2 AS-i masters:
► Double-click on [ASi_2_binaryIO]
To access the analogue output data of the slaves at AS-i master 2 in a system with 2 AS-i masters:
► Double-click on [ASi_2_analogOut]
Output data of the AS-i slaves
17620
The area contains all data, the higher-level Fieldbus controller cyclically sends to the outputs of the
AS-i slaves via the fieldbus network. The data is structure like an AS-i network. The programmer can
access this data via IEC addresses.
>
Digital output data
17630
To access the digital output data of the slaves at AS-i master 1:
► Device window: In the project tree, double-click on [ASi_1_binaryIO]
> Editor window shows a structured list of the digital output data:
►In column [Variable]: Mouse click on to make individual variables visible.
>
Analogue output data
To access the analogue output data of the slaves at AS-i master 1:
► Device window: In the project tree, double-click on [ASi_1_analogOut]
> Editor window shows the structured list of the analogue output data:
►In column [Variable]: Mouse click on to make individual variables visible.
Indication of whether execution of
the FB has been completed
FALSE
FB execution not yet completed
TRUE
FB execution completed
xBusy
Output
BOOL
Indication of whether FB is active
FALSE
Function block is inactive
TRUE
FB is active
xError
Output
BOOL
Indication of whether faults have
occurred during execution of the
FB
FALSE
FB executed correctly
TRUE
Error occurred during execution of
the FB
wDiagnostic
Output
WORD
Error code
FB specific
7.4 Use functions of the ifm package
18489
The CODESYS package "CODESYS for ifm SmartPLC StandardLine" offers different functions for the
programming of the device-internal CODESYS controller. In the following sections, these functions will
be briefly described. To make orientation easier, the functions are grouped according to corresponding
subjects and provided with a cross-reference to a detailed explanation in the document's appendix.
>
7.4.1 Control interface of the ifm function blocks
17660
All function blocks (FB) of the libraries ACnnnn_Utils.library and ACnnnn_SYS_CMD.library have
inputs and outputs for control signals. The inputs activate the execution of the function block. The
outputs provide information about the internal condition of the function block. Thanks to the signals,
the programmer can create a control structure for a targeted processing of the FB and react to
possible errors.
Number and designation of the FB control signals provide information about the type of FB execution:
>
FB with one-time execution
17140
These function blocks perform their function exactly once after activation. To execute the function
once again, the FB needs to be reactivated. FBs of this kind feature a control interface with the
following inputs and outputs:
The following figure shows the relation between the connections of the control signals:
The complex variable contains the complete process image
(inputs and outputs) of an AS-i network.
→ ASI_NET (STRUCT) (→ p. 117)
ASI_DATA
The complex variable contains the following components:
Slave lists (LPS, LDS, LAS, LPF, LCE, LCEMS, LCEAS,
LDAE)
Parameter images (PI, PP)
Configuration data of the AS-i slaves (CDI, PCD)
→ ASI_DATA (STRUCT) (→ p. 115)
→ Get_ASi_Data (→ p. 104)
Name
Description
Reference
Set_ProjectAll
Execute projection adaptation on one AS-i master
→ Set_ProjectAll (→ p. 97)
Set_LPS
Change list of the projected slaves (LDS)
→ Set_LPS (→ p. 91)
Set_PCD
Change permanent projecting data (IO, ID, ID1, ID2) of
all slaves on the AS-i master
→ Set_PCD (→ p. 95)
7.4.5 Manage AS-i network
17126
To manage the AS-i networks controlled by AS-i Gateway AC14, use the following function blocks:
>
Use complex variables
18528
There are different complex variables (STRUCT) at the programmer's disposal. They bundle logically
associated data sets. Thereby, they facilitate the organisation of the data storage in the application
and at the same time reduce the error rate when variables are declared.
Read the following datasets for network management in
batches and cycles:
List of activated slaves (LAS)
List of detected slaves (LDS)
List of projected slaves (LPS)
List of peripheral faults (LPF)
List of configuration errors (LCE)
List of configuration errors, missing slaves (LCEMS)
List of configuration errors - additional slaves
(LCEAS)
List of double address errors (LDAE)
Configuration data image (CDI)
Permanent configuration data (PCD)
Input parameters (PI)
Output parameters (PP)
→ Get_ASi_Data (→ p. 104)
Name
Description
Reference
Get_InputParameter
Read parameters of the inputs of the slaves at the AS-i
master (PI)
→ Get_InputParameter (→ p. 83)
Get_OutputParameter
Read parameters of the outputs of the slaves on the
AS-i master (PP)
→ Get_OutputParameter (→ p. 85)
Name
Description
Reference
Get_LPS
Read list of projected slaves (LPS)
→ Get_LPS (→ p. 67)
Get_LDS
Read list of detected slaves (LDS)
→ Get_LDS (→ p. 65)
Get_LAS
Read list of activated slaves (LAS)
→ Get_LAS (→ p. 63)
Get_LPF
Read list of peripheral faults (LPF)
→ Get_LPF (→ p. 77)
Get_LCE
Read list of configuration errors (LCE)
→ Get_LCE (→ p. 69)
Get_LCEMS
List of configuration errors - read missing slaves
(LCEMS)
→ Get_LCEMS (→ p. 73)
Get_LCEAS
Read of the configuration errors - read additional slave
(LCEAS)
→ Get_LCEAS (→ p. 71)
Get_LDAE
Read list of double address errors (LDAE)
→ Get_LDAE (→ p. 75)
Read network settings
To read the network settings cyclically and offer them in the application:
Alternatively, this data can be read separately with the following FB:
By default, the FB ACnnnn_SysCmd is hidden. To add the FB to a program module:
► Highlight the required network and add an empty function block with [FBD/LD/IL] > [Insert Empty Block].
> Network shows empty FB.
► Double-click on the name field of the FB
► Enter designation ACnnnn_SysCmd and
confirm with [ENTER].
> FB has inputs and outputs of the
ACnnnn_SysCmd.
► Adjust inputs and outputs of the FB in
accordance with the required command.
7.4.6 Send commands to the system and the AS-i master
Similar to the acyclic transmission command channels and data sets of the device, the programmer
can send commands to the system or an AS-i master with the FB ACnnnn_SysCmd
(→ACnnnn_SysCmd (→ p. 121)).
System command overview: →Table: System commands (→ p. 122)
Overview AS-i master commands: →Table: AS-i master commands (→ p. 123)
► Familiarise yourself with the following CODESYS functions!
Visualisations in CODESYS
→ Online help > CODESYS visualisation
7.5 Use visualisations
>
7.5.1 Supported visualisation types
The AS-i Gateway AC14 supports the following CODESYS visualisation types:
Web visualisation (WebVisu)
A WebVisu allows graphic representation of selected process and control data of the device in a
web browser by means of a user-specific visualisation.
Target visualisation (TargetVisu)
A TargetVisu allows graphic representation of selected process and control data of the device on
the display of the device by means of a user-specific visualisation.
[VISU_TASK] provides access to the visualisation task properties (→Set parameters for visualisation task
(→ p. 45))
2
[Visualization Manager] provides access to the visualisation properties (→Configure visualisation (→ p. 43))
3
[MyVisu] contains the area for the creation of the visualisation objects (→Create a visualisation (→ p. 42))
7.5.2 Add visualisation to a project
To add a visualisation to a CODESYS project:
► Open CODESYS project.
OR:
Create new CODESYS project. (→Create new project with AS-i Gateway AC14 (→ p. 17))
► In the device tree: Click on [Application].
► Select [Project] > [Add Object] > [Visualization...]
> [Add Visualization] window appears.
► Enter a designation for the visualization in the [Name] field and click on [Add] to apply.
> CODESYS adds the following elements to the device tree:
In the field [Name of .htm file] enter the name by which the web visualisation is to be accessible in the web
browser (→Display web visualisation (→ p. 56)).
► Use only lower case when entering the name!
7.5.4 Configure visualisation
In order to change the properties of the created visualisations, choose one of the following options:
Change properties of the web visualisation (→ p. 43)
Change the properties of the target visualisation (→ p. 44)
>
Change properties of the web visualisation
To change the attributes of the web visualisation:
► In device tree: Double click on [Web-Visualisierung]
> The editor window shows attributes of the web visualisation:
6953
17065
► Set the following values:
1. Field [Start Visualization]: Select the created web visualisation.
2. Field [Name of .htm file]: Enter name for HTML file (→ Note).
3. Area [Scaling Options]: Enter fixed width and height as shown.
► Familiarise yourself with the following CODESYS functions!
Task configuration
→ Online help > CODESYS Development System > application programmable > task
configuration
Name
Description
Note
[MainTask]
Configuration of the main task (e.g. for main program
[PLC_PRG (PRG)])
→ Configure main task (→ p. 45)
[VISU_TASK]
Configuration of the task for processing visualisation
→Set parameters for visualisation task
(→ p. 45)
► Execute the visualisation task (VISU_TASK) with a priority that is as low as possible to
avoid interruption of other tasks that are important for the core functions of the application.
► Execute the VISU_TASK in appropriate cyclic intervals to save the resources of the
device-internal CODESYS PLC of the fieldbus network.
7.6 Configure task processing
The processing of the tasks is controlled by parameters. The user can set the parameters for each
task separately
CODESYS automatically creates the following tasks and visualisations during project creation:
>
4109
7.6.1 Configure main task
18412
The basic settings of the task characteristics cover the requirements of many applications. In the event
of non-optimum device performance the user must determine and set the optimum task characteristics
himself.
To change parameters of a task:
► In device tree: Double click on [Taskkonfiguration] > [MainTask]
> The editor window shows the configuration of the main task.
► Set the parameters as requested.
> Selected value is applied.
>
7.6.2 Set parameters for visualisation task
17066
Each visualisation is executed separately from the program code in a separate task. To set the
properties of the visualisation task:
► In the device tree: Double-click on [Task configuration] > [VISU_TASK]
> Editor window shows parameters of the visualisation task.
► Set the parameters as required.
► Save the project to apply changes.
► Familiarise yourself with the following CODESYS functions!
Test and fault elimination
→ Online help > CODESYS Development System > Testing and Debugging
7.7 Testing the PLC application
18594
To ensure permanent operation without errors in industrial environments, the created PLC application
must be tested in detail and possible faults must be remedied.
To enable the processing of the created PLC application, the device-internal CODESYS PLC must be
activated in the setup menu of AS-i Gateway AC14.
If the PLC application is to have a write access to the outputs of the AS-i slaves, the CODESYS PLC
must be activated additionally as controller instance of the AS-i slave outputs.
The following table shows the possible combinations of the parameters [Output access] and [Use PLC]
as well as the rights of the CODESYS PLC resulting thereof.
To set the operating mode of the device:
1 Select menu page
► >
► Select [System settings] tab.
2 Set the controller instance of the outputs
► Select the requested controller instance of the AS-i outputs in the [Output access] list.
► Press [Accept selection] to activate the selection.
3 Activate CODESYS PLC
► Activate [Use PLC] checkbox.
> CODESYS PLC is active.
4 Optional: Adjust device cycle
► Select the requested device cycle time in the [Device cycle] list.
► Press [Accept selection] to activate the selected value.
To transfer the created application as boot project to the device:
Requirements:
> Network path is set (→Set communication path to PLC (→ p. 20)).
> Project tested.
> All ifm system solutions stored on the devie are deleted (→ device manual: Uninstall ifm apps)
1 Build application
► In the device tree: Highlightt application as active application.
► Use [Build] > [Rebuild] to compile the active application.
> CODESYS generates program code.
2 Load application on the device
► Use [Online] > [Login] to connect with the device.
> Active application is transfered to the device (download).
> application on the device is in STOP state.
3 Create boot application
► Use [Online] > [Create boot application] to make the application bootable.
> application storage is non-volatile.
4 Start boot application
► Use [Debug] > [Start] to start the application.
> application goes to the RUN state.
>
18593
8.1.3 Delete application from AS-i Gateway AC14
To delete an application stored on the device:
1 Connect with the device
► In the device tree: highlight application as active application.
► Use [Online] > [Login] to establish connection to the device.
> CODESYS is in the online mode.
2 Delete application
► In the editor window: Select [Device] > [Applications] tab.
► Press [Refresh List] to refresh the view.
> List shows the applications that are stored on the device.
► Delete all applications in the device with [Remove All].
OR:
Highlight requested application and press [Remove] to delete it from the device.
With this method the following data on the device-internal PLC is removed:
all files of the boot application
all CRC files
directory with web and/or target visualisations
data in the memory area F-RAM
8.1.4 Delete boot application via SD card
15970
If after the start of a complex boot application the device is overloaded and does not respond any
more to user inputs or login attempts, the boot application on the device needs to be forcibly deleted.
To delete the boot application on the device:
► Disable the write protection of the SD card.
► Create a file named KillBootApp.txt in the root directory of the SD card.
► Insert the SD card into the SD card slot of the device.
► Restart the device.
> Boot application on the device-internal PLC is deleted.
> The file KillBootApp.txt on the SD card is renamed in KillBootApp.rdy.
This section provides information about the operating states of the device and the states of the PLC of
the device as well as information about the states of the applications.
>
8.2.1 Operating mode of the PLC
13769
The PLC of the device can be operated in the following modes:
Offline mode
In the offline mode the user is logged out of the PLC or there is no connection between CODESYS
and the PLC (e.g. connection loss).
Online mode
In the online mode the user is logged in to the PLC.
>
8.2.2 States of the PLC application
4136
The applications saved on the device are executed independently in separate tasks. A application can
have the following states:
Unload
No application is saved on the PLC.
RUN
The application is executed (cyclically processed).
STOP
The application is not executed.
>
Display operating state of the application
To display the current operating state of the PLC choose one of the following options:
CODESYS:
> In the device tree: Node of the application indicates the current state.
OR:
> In online mode the CODESYS status bar shows the current state of the application.
GUI / web interface of the device:
► > >
► Select the [Applications] tab.
>The page displays the operating states of the PLC applications saved on the device.
To switch between the operating states of the application choose one of the following options:
>
Start PLC application
To start a PLC application stored on the device:
CODESYS:
► In the device tree: highlight application as active application.
► Use [Online] > [Login] to establish the connection with the CODESYS PLC.
► Use [Debug] > [Start] to start the processing of the active application.
> Application goes to RUN state.
► Optional: repeat process for additional applications.
GUI / web interface:
► > >
► Select the [Applications] tab.
► Use [] / [] to select the required application.
> Page shows the operating status of the selected application.
► Press [Start] function key to start the processing of the selected application.
> Application goes to RUN state.
►Optional: repeat process for additional applications.
>
10264
18027
Stop PLC application
To stop a PLC application stored on the device:
CODESYS:
► In the device tree: highlight application as active application.
► Use [Online] > [Login] to establish the connection with the CODESYS PLC.
► Use [Debug] > [Stop] to stop the processing of the active application.
> Application goes to STOP state.
► Optional: repeat process for additional applications.
GUI / web interface:
► > >
► Select [Applications] tab.
► Use [] / [] to select the required application.
> Page shows the operating status of the selected application.
► Press [Stop] function key to stop the processing of the selected application.
> Application goes to STOP state.
►Optional: repeat process for additional applications.
To reset the application on the PLC, choose one of the following options:
CODESYS: command [Reset (warm)]
► In the device tree:
Highlight the required application as active application.
► Select [Online] > [Login] to establish a connection to the CODESYS PLC.
> CODESYS switches to online mode.
► Select [Online] > [Reset warm] to reset the application.
GUI: command [Reset]
► >
► Select [All Applications] tab.
► Use [Reset] to reset all applications.
GUI: command [Restart]
► >
► Select [System-reset] tab.
► Use [Restart] to reboot the device.
>
13131
9069
8.3.3 Reset the application (cold)
To reset the application on the PLC, choose one of the following options:
Download the application to the device
► → Download the application to the device (→ p. 50)
CODESYS: command "Reset (cold)"
► In the device tree:
Highlight the required application as active application.
► Select [Online] > [Login] to establish a connection to the CODESYS PLC.
> CODESYS switches to online mode.
►Select [Online] > [Reset cold] to reset the application.
>
8.3.4 Reset the application (origin)
To reset the application on the PLC:
CODESYS: command "Reset (origin)"
► In the device tree:
Highlight the required application as active application.
► Select [Online] > [Login] to establish a connection to the CODESYS-PLC.
> CODESYS switches to online mode.
►Select [Online] > [Reset origin] to reset the application.
If the device does not react to the pressing of [] + [], the key combination is deactivated.
► Activate the key combination with the system command [Display target visualisation].
After a restart of the device the menu view of the GUI appears by default.
► With the FB ACnnnn_SysCmd (→ p. 121)execute the system command [Display target
visualisation] at the start of the PLC application.
The FB reads the list of existing but not projected slaves (List of Configuration Error – Additional Slave
= LCEAS) of the selected AS-i master and provides the values.
The FB reads the list of projected but missing slaves (List of Configuration Error – Missing Slave =
LCEMS) at the selected AS-i master and provides the values.
The FB reads the configuration data (Configuration Data Image = CDI) of the slaves at the selected
AS-i master and provides the values in an array. The configuration data of a slave consists of the
registers IO, ID, ID1 and ID2.
The FB reads the projected configuration data (Projected Configuration Data Image = PCD) of the
slaves on the selected AS-i master and provides the values in an array.
List of output parameters of S/A
slaves in the selected AS-i master.
Each byte contains the output
parameters of an AS-i slave.
– byte 0 (LSB) = res.
– byte 1 = slave with address 1(A) ...
– byte 31 = slave with address 31(A)
Per byte:
Bits 0...3:
P0-P3
abList_B_Slave
ARRAY[0..31]
OF BYTE
List of output parameters of B slaves
in the selected AS-i master. Each byte
contains the output parameters of an
AS-i slave.
– byte 0 (LSB) = res.
– byte 1 = slave with address 1B
...
– byte 31 = slave with address 31B
Per byte:
Bits 0...3:
P0-P3
xReady
BOOL
Signal indicates if the execution of the
FB is terminated.
FALSE
FB is inactive or being
executed.
TRUE
FB execution is terminated.
xBusy
BOOL
Signal indicates if the FB is executed.
FALSE
FB is deactivated or FB
execution is terminated.
TRUE
FB execution is started but not
yet terminated.
xError
BOOL
Signal indicates if errors occurred
while the FB was executed.
FALSE
FB is disabled or presently
executed or FB was executed
without error.
List of output parameters of S/A
slaves in the selected AS-i master.
Each byte contains the output
parameters of an AS-i slave.
– byte 0 (LSB) = res.
– byte 1 = slave with address 1(A) ...
– byte 31 = slave with address 31(A)
Per byte:
Bits 0...3:
P0-P3
abList_B_Slave
ARRAY[0..31]
OF BYTE
List of output parameters of B slaves
in the selected AS-i master. Each byte
contains the output parameters of an
AS-i slave.
– byte 0 (LSB) = res.
– byte 1 = slave with address 1B
...
– byte 31 = slave with address 31B
Per byte:
Bits 0...3:
P0-P3
xReady
BOOL
Signal indicates if the execution of the
FB is terminated.
FALSE
FB is inactive or being
executed.
TRUE
FB execution is terminated.
xBusy
BOOL
Signal indicates if the FB is executed.
FALSE
FB is deactivated or FB
execution is terminated.
TRUE
FB execution is started but not
yet terminated.
xError
BOOL
Signal indicates if errors occurred
while the FB was executed.
FALSE
FB is disabled or presently
executed or FB was executed
without error.