0% found this document useful (0 votes)
238 views135 pages

Programming Manual Smartplc Dataline Ac14 With Fieldbus Interfaces

Uploaded by

Jorge Meza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
238 views135 pages

Programming Manual Smartplc Dataline Ac14 With Fieldbus Interfaces

Uploaded by

Jorge Meza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 135

Programming Manual

SmartPLC DataLine AC14


with fieldbus interfaces

AC1403/04
AC1423/24
AC1433/34

Firmware release: 4.2.x


CODESYS release: 3.5.9.73 or higher

English
12/2017
7391118/00
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Content

Contents

1 Preliminary note 4
1.1 Legal and copyright information ...........................................................................................4
1.2 Purpose of the document .....................................................................................................4
1.3 Symbols and styles used .....................................................................................................5
1.4 Overview: User documentation for SmartPLC DataLine AC14 ...........................................5
1.5 Overview: CODESYS documentation of 3S ........................................................................6
1.6 Modification history ..............................................................................................................6

2 Safety instructions 7
2.1 General safety instructions ..................................................................................................7
2.2 Required background knowledge ........................................................................................7
2.3 Warnings used .....................................................................................................................8

3 System requirements 9
3.1 Hardware ..............................................................................................................................9
3.2 Software ...............................................................................................................................9
3.3 Licensing ..............................................................................................................................9

4 Installation 10
4.1 CODESYS programming software .....................................................................................10
4.1.1 Install CODESYS Development System..................................................................................... 10
4.2 ifm AS-i Package................................................................................................................11
4.2.1 Components of the ifm package ................................................................................................. 11
4.2.2 Install the ifm package ................................................................................................................ 12
4.2.3 Update ifm package ................................................................................................................... 12
4.2.4 Uninstall the ifm package ........................................................................................................... 13

5 Getting started 14
5.1 Create CODESYS project ..................................................................................................15
5.1.1 Create new project with SmartPLC DataLine AC14 ................................................................... 16
5.1.2 Overview: Project structure with SmartPLC DataLine AC14 ...................................................... 17
5.2 Use CODESYS online help ................................................................................................18
5.3 Set the programming interface...........................................................................................19
5.3.1 Set network path of SPS ............................................................................................................ 19

6 System configuration 21
6.1 Configure SPS ...................................................................................................................21
6.2 Change IP settings .............................................................................................................21
6.3 Extend fieldbus functionality ..............................................................................................22
6.3.1 Available fieldbus stacks ............................................................................................................ 22
6.3.2 Use EtherCAT master ................................................................................................................ 23
6.3.3 Add fieldbus stack ...................................................................................................................... 26

7 Programming 27
7.1 Objects of a PLC application ..............................................................................................27
7.2 Create SPS application ......................................................................................................28
7.2.1 Use remanent variables.............................................................................................................. 28

2
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Content

7.2.2 Supported programming languages ........................................................................................... 29


7.2.3 Change system time of the device ............................................................................................. 29
7.3 Access input and output data .............................................................................................30
7.3.1 Options to access input and output data .................................................................................... 30
7.3.2 Validity of the interface data ....................................................................................................... 31
7.3.3 Process data of the AS-i slaves.................................................................................................. 32
7.3.4 Fieldbus data .............................................................................................................................. 34
7.4 Use functions of the ifm package .......................................................................................36
7.4.1 Control interface of the ifm function blocks ................................................................................. 36
7.4.2 Configure system ....................................................................................................................... 37
7.4.3 Configure AS-i master ................................................................................................................ 38
7.4.4 Configure AS-i slaves ................................................................................................................. 38
7.4.5 Manage AS-i network ................................................................................................................. 39
7.4.6 Send commands to the system and the AS-i master .................................................................. 42
7.5 Use visualisations ..............................................................................................................43
7.5.1 Supported visualisation types ..................................................................................................... 43
7.5.2 Add visualisation to a project ...................................................................................................... 44
7.5.3 Create a visualisation ................................................................................................................. 45
7.5.4 Configure visualisation ............................................................................................................... 46
7.6 Configure task processing .................................................................................................48
7.6.1 Configure main task ................................................................................................................... 48
7.6.2 Set parameters for visualisation task .......................................................................................... 48
7.7 Testing the SPS application ...............................................................................................49

8 Operation 50
8.1 Transfer CODESYS project to device ................................................................................51
8.1.1 Activate CODESYS SPS ............................................................................................................ 52
8.1.2 Download the application to the device ...................................................................................... 53
8.1.3 Delete application from SmartPLC DataLine AC14 .................................................................... 53
8.1.4 Delete boot application via SD card ........................................................................................... 54
8.2 Operating states of the SPS ..............................................................................................55
8.2.1 Operating mode of the SPS........................................................................................................ 55
8.2.2 States of the SPS application ..................................................................................................... 55
8.2.3 Switch operating states .............................................................................................................. 56
8.3 Reset ..................................................................................................................................57
8.3.1 Supported reset variants ............................................................................................................ 57
8.3.2 Reset the application (warm) ...................................................................................................... 58
8.3.3 Reset the application (cold) ........................................................................................................ 58
8.3.4 Reset the application (origin) ...................................................................................................... 58
8.4 Display web visualisation ...................................................................................................59
8.5 Display target visualisation ................................................................................................59

9 Appendix 60
9.1 Library ACnnnn_Utils.library ..............................................................................................61
9.1.1 Overview: AS-i functions (FB_ASi) ............................................................................................. 62
9.1.2 Overview: System functions (FB_System) ............................................................................... 108
9.1.3 Enumeration types and complex variables ............................................................................... 115
9.2 Library ACnnnn_SYS_CMD.library ..................................................................................124
9.2.1 ACnnnn_SysCmd ..................................................................................................................... 125

10 Index 133

11 ifm weltweit • ifm worldwide • ifm à l’échelle internationale 135

3
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Preliminary note Legal and copyright information

1 Preliminary note
Legal and copyright information ...............................................................................................................4
Purpose of the document .........................................................................................................................4
Symbols and styles used ..........................................................................................................................5
Overview: User documentation for SmartPLC DataLine AC14 ................................................................5
Overview: CODESYS documentation of 3S .............................................................................................6
Modification history ...................................................................................................................................6
14801
>

1.1 Legal and copyright information


1631

© All rights reserved by ifm electronic gmbh. No part of this manual may be reproduced and used
without the consent of ifm electronic gmbh.
 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


1618

This document applies to the following device of the type "SmartSPS DataLine AC14":
 SmartPLC DataLine with Profinet-DP interface (AC1403/AC1404)
 SmartPLC DataLine with EtherNet/IP device interface (AC1423/AC1424)
 SmartPLC DataLine with EtherCAT slave interface (AC1433/AC1434)

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.
>

4
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Preliminary note Symbols and styles used

1.3 Symbols and styles used


13839

► ... Instructions
> ... Reaction, result
→ ... Cross-reference or internet link
123 Decimal number
0x123 Hexadecimal number
0b010 Binary number
[...] Designation of pushbuttons, buttons or indications

>

1.4 Overview: User documentation for SmartPLC DataLine AC14


6998

ifm electronic provides the following user documentation for the models of the device class "SmartSPS
DataLine AC14":

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 SPS of the device
 Description of the device-specific CODESYS function libraries
*... The operating instructions are supplied with the device.

The user can download all documents from the ifm website.

5
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Preliminary note Overview: CODESYS documentation of 3S

>

1.5 Overview: CODESYS documentation of 3S


18296

3S GmbH provides the following user documentation for programming SPS of AC4S:

Document Content / Description

Online help  Context-sensitive help


 Description of the CODESYS programming system
 Description of components and function libraries

CODESYS installation and  Remarks about the installing of the CODESYS programming system
first steps  First steps for handling the CODESYS programming system

After the installation of the CODESYS 3.5 programming system all documents are stored on the hard
disk of the PC/laptop and can be accessed:
 Online help:
...\Program Files\3S CoDeSys\CoDeSys\Online-Help
 CODESYS installation and first steps:
...\Program Files\3S CoDeSys\CoDeSys\Documentation
>

1.6 Modification history


21676

Version Topic Date

00 New creation of document 12/2017

6
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Safety instructions General safety instructions

2 Safety instructions
General safety instructions .......................................................................................................................7
Required background knowledge .............................................................................................................7
Warnings used ..........................................................................................................................................8
213
>

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.
► Follow the safety instructions.

7
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Safety instructions Warnings used

>

2.3 Warnings used


13685

WARNING
Death or serious irreversible injuries may result.

CAUTION
Slight reversible injuries may result.

NOTICE
Property damage is to be expected or may result.

Important note
Non-compliance may result in malfunction or interference.
Information
Supplementary note.

8
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
System requirements Hardware

3 System requirements
Hardware ..................................................................................................................................................9
Software....................................................................................................................................................9
Licensing...................................................................................................................................................9
16903
>

3.1 Hardware
8469

 Device of the SmartSPS DataLine AC14 product family with V4.2.x firmware
 PC/laptop for the programming system CODESYS (→ system requirements CODESYS
Development System V3.5)
 Ethernet connection between CODESYS-PC/laptop and configuration interface 1 (X3) or 2 (X8) of
the device
>

3.2 Software
16905

To program the device-internal PLC of the SmartSPS DataLine AC14, the following software
components are required:

Component Description Release

CODESYS Development System Programming software CODESYS Development System 3.5 SP9 Patch 7 Hotfix 3
für PLC programming according to norm IEC 61131-3
Package "CODESYS for ifm SmartPLC  Device and interface description of SmartPLC 1.6.4.14
DataLine" DataLine AC14
 Function libraries for programming of the SPS

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

>

3.3 Licensing
20254

By buying a device of the SmartSPS DataLine AC14 the buyer has also purchased a licence valid for
using the CODESYS 3.5 programming software.

9
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Installation CODESYS programming software

4 Installation
CODESYS programming software .........................................................................................................10
ifm AS-i Package ....................................................................................................................................11
17146

>

4.1 CODESYS programming software


7282

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


18596

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.

10
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Installation ifm AS-i Package

>

4.2 ifm AS-i Package

Components of the ifm package .............................................................................................................11


Install the ifm package ............................................................................................................................12
Update ifm package................................................................................................................................12
Uninstall the ifm package .......................................................................................................................13
17679

► Familiarise yourself with the following CODESYS functions!


 Package Manager
→ Online help > CODESYS Development System > Manage packages and licences

>

4.2.1 Components of the ifm package


17550

To program the SmartPLC DataLine AC14, ifm provides the CODESYS package "CODESYS for ifm
SmartPLC DataLine" (short: ifm package). The ifm package (file:
ifm_SmartPLC_DataLine_V1_6_4_14.package) contains the following components:

Component Description
AC14DL.devdesc.xml Device description of the basic module
ACnnnn_EthernetAdapterDL.devdesc.xml Device description of Ethernet interface 1
ACnnnn_EthernetAdapterDL_1.devdesc.xml Device description of Ethernet interface 2
ACnnnn_EtherCAT_Master.devdesc.xml Device description of the EtherCAT master (extension of the 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 SmartPLC DataLine AC14 specific CODESYS function
blocks and data structures
ACnnnn_SYS_CMD.library Function library with function block for access to the command interface of
SmartPLC DataLine AC14 from a CODESYS application
AC14DL.template Template for AC14 DataLine
AC14DL.template.project Template for AC14 DataLine project
AC14.ico Symbol image of the AC14

11
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Installation ifm AS-i Package

>

4.2.2 Install the ifm package


7283

To install the package "CODESYS for ifm SmartPLC DataLine":


Requirements:
> CODESYS 3.5 SP9 Patch 7 Hotfix 3 is installed on the programming PC/notebook.
1 Start CODESYS
► Start CODESYS with administrator rights.
> CODESYS programming interface appears.
2 Install the ifm package in CODESYS
► Select [Tools] > [Package Manager].
> Window [Package Manager] is displayed.
► 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


12267

To update an installed package "CODESYS for ifm SmartPLC DataLine":


1 Download new version of the ifm package
► Got to the product page of the device on the ifm website.
► Download ifm_SmartPLC_DataLine_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. 13)
3 Install a new version of the ifm package
► → Install the ifm package (→ p. 12)
4 Update device libraries
► In the device tree: Click on [Device (ifm_SmartPLC_DataLine)].
► 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.

12
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Installation ifm AS-i Package

>

4.2.4 Uninstall the ifm package


12270

To uninstall the package "CODESYS for ifm SmartPLC DataLine":


1 Start CODESYS
► Start CODESYS with administrator rights.
> CODESYS programming interface appears.
2 Uninstall the ifm package
► 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.
> The selected package version is uninstalled.
► Click on [Exit] to close the Package Manager.

13
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Getting started ifm AS-i Package

5 Getting started
Create CODESYS project ......................................................................................................................15
Use CODESYS online help ....................................................................................................................18
Set the programming interface ...............................................................................................................19
15858

14
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Getting started Create CODESYS project

>

5.1 Create CODESYS project

Create new project with SmartPLC DataLine AC14 ...............................................................................16


Overview: Project structure with SmartPLC DataLine AC14 ..................................................................17
17129

► Familiarise yourself with the following CODESYS functions!


 Create CODESYS project
→ Online help > CODESYS Development System > Create and configure project
 Objects of the user interface
→ Online help > CODESYS Development System > Reference user interface

15
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Getting started Create CODESYS project

>

5.1.1 Create new project with SmartPLC DataLine AC14


17682

To avoid errors during manual system configuration, it is explicitly recommended to use the
project template from ifm electronic when creating the SmartSPS DataLine AC14 project in
CODESYS.

Qualifications
> All required software components are correctly installed (→ Installation (→ p. 10)).
> CODESYS successfully started.
1 Create a new project
► Select [File] > [New Project...].
> The window to enter the project properties appears:

► Set the following values:


1. [Templates]: Select [ifm_SmartPLC_DataLine Projekt].
2. [Name]: Enter project name
3. [Location]: Select the storage location of the project file.
► Click on [OK] to verify the entered values.
> CODESYS creates a new project with SmartPLC DataLine AC14.
> The window [Devices] shows the device tree of the project (→ Overview: Project structure with SmartPLC
DataLine AC14 (→ p. 17)).

16
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Getting started Create CODESYS project

2 Save the project


► Select [File] > [Save Project].
> CODESYS saves the project.
>

5.1.2 Overview: Project structure with SmartPLC DataLine AC14


8394

A CODESYS project contains all components for the programming and administration of PLC
applications. All components of a project are shown in the [Device] window in a hierarchic tree view.
CODESYS projects with a SmartPLC DataLine AC14 have the following structure:

1 [ifm_SmartPLC_DataLine] provides access to the settings of the SPS of the SmartPLC DataLine AC14.
→ Configure SPS (→ p. 21)
2 [PLC Logic] contains the SPS applications of SmartPLC DataLine AC14
→ Objects of a PLC application (→ p. 27)
3 [ASi_Master_1] contains the process data images of the AS-i slaves at the AS-i master 1
→ Access input and output data (→ p. 30)

4 [ASi_Master_2] contains the process data images of the standard AS-i slaves at the AS-i master 2
→ Access input and output data (→ p. 30)
5 [Fieldbus_Interface] provides access to the input and output data of the fieldbus interface.
→ Access input and output data (→ p. 30)
6 [X3] offers access to the configuration options of the configuration interface 2 (X3)
→ Extend fieldbus functionality (→ p. 22) and → Change IP settings (→ p. 21)
7 [X8] provides access to the configuration options of the configuration interface 2 (X8)
→ Extend fieldbus functionality (→ p. 22) and → Change IP settings (→ p. 21)

17
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Getting started Use CODESYS online help

>

5.2 Use CODESYS online help


6989

This manual only describes the integration, configuration and the programming of the SmartPLC
DataLine 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.

► 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

18
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Getting started Set the programming interface

>

5.3 Set the programming interface


18494

To download the created projects and applications to the device a valid network path between the
CODESYS programming system and the SPS of the device has to be selected.
>

5.3.1 Set network path of SPS


3846

The following interfaces can be configured as program interface:


 Ethernet configuration interface 1 (X3)
 Ethernet configuration interface 2 (X8)

In order to be able to set the communication path of the SPS, the device-internal SPS must be
active.
To activate the SPS:

► GUI / web interface: Select >


► In the area [Activate CODESYS-PLC]: activate [Use PLC].
> SPS is active.
To access the device-internal SPS via the Ethernet configuration interface 2 (X8), the IP
address of the interface X8 must be configured as a virtual gateway in the communication
settings.

To configure the connection between the CODESYS programming system and the SPS of the
SmartPLC DataLine AC14:
1 Preparations
► Connect CODESYS-PC/laptop with the required configuration interface (X3 or X8) of the device.
► Optional: Adjust IP settings of the Ethernet interfaces.
2 Select communication settings
► In the device tree: double-click on the symbol [ifm_SmartPLC_DataLine]
► In the editor window: Click on [Communication settings].
> The editor window shows the communication settings of the PLC.
3 Select gateway
► Select the required gateway from the list [Gateway].
> List shows selected gateway.
4 Set communication path
► Click on [Scan network...]
> The window [Select device] appears.
► Select the gateway node and click on [Scan network] to start the scanning process.
> CODESYS scans the network for devices.
> Window shows the network path and detected devices.
► Select the node of [SmartPLC DataLine AC14].

> Information field shows detailed information about the selected node.
► Click on [OK] to set the communication path to the SPS.

19
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Getting started Set the programming interface

> CODESYS can transfer data to the SPS of the SmartPLC DataLine AC14.

20
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
System configuration Configure SPS

6 System configuration
Configure SPS ........................................................................................................................................21
Change IP settings .................................................................................................................................21
Extend fieldbus functionality ...................................................................................................................22
18498
>

6.1 Configure SPS


18961

► 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

The SPS is configured via the "Generic Device Editor" of the CODESYS programming system. The
programmer can access the device editor of the SPS via the following node in the device tree:

To configure the device-internal SPS:


► In the device tree: Double-click on [ifm_SmartPLC_DataLine]
> The editor window shows device editor of the device-internal SPS.
► Configure SPS.
► Save the project to apply changes.
>

6.2 Change IP settings


14524

► Familiarise yourself with the following CODESYS functions!


 Ethernet adapter configurator
→ Online help > Fieldbus support > Ethernet adapter configurator
The Ethernet configuration interfaces 1 (X3) and 2 (X8) must not be participants of the same
EtherNet subnet. Non-compliance may result in connection problems between the CODESYS
programming system and the device.
► Configure IP settings so that interfaces X3 and X8 are part of different Ethernet subnets.

To change the IP settings of the Ethernet configuration interfaces 1 (X3) and 2 (X8):
1 Select Ethernet interface
► In the device tree: Double click on the requested Ethernet interface (X3 or X8)
> The editor window shows the Ethernet device editor.
2 Change IP settings
► Change IP settings of the Ethernet interface.
> Save the project to apply changes.

21
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
System configuration Extend fieldbus functionality

>

6.3 Extend fieldbus functionality

Available fieldbus stacks ........................................................................................................................22


Use EtherCAT master ............................................................................................................................23
Add fieldbus stack ..................................................................................................................................26
15782
>

6.3.1 Available fieldbus stacks


13978

Besides the fieldbus functionality defined in the hardware the device can be operated as fieldbus
device by a software extension. In this respect the user has to assign a fieldbus stack to the Ethernet
configuration interfaces 1 (X3) or 2 (X8) in CODESYS and configure it. The device supports the
following fieldbus stacks:

Description Fieldbus Further information

EtherCAT master EtherCAT → Use EtherCAT master (→ p. 23)


Ethernet/IP scanner EtherNet/IP
Modbus TCP master Modbus TCP → Add fieldbus stack (→ p. 26)
Modbus TCP slave device Modbus TCP

22
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
System configuration Extend fieldbus functionality

>

6.3.2 Use EtherCAT master

Add EtherCAT master ............................................................................................................................23


Configure EtherCAT master ...................................................................................................................24
Add and configure EtherCAT slave ........................................................................................................25
7474

The device can also be operated as EtherCAT master. In this respect ifm electronic provides an
EtherCAT master stack for the CODESYS programming system 3.5. The user has to assign one of the
two Ethernet configuration interfaces (X3 or X8) to the EtherCAT master.
>

Add EtherCAT master


7475

Only one EtherCAT master can be used per device.

To add the EtherCAT master stack to the project:


Requirements:
► Open or create project with SmartPLC DataLine AC14.
1 Add EtherCAT master stack
► In the device tree: Right-click on [<CODESYS _Root>]
► In the context menu: select [Add device...]
> Window [Add Device] appears.
► Set the following values:
1. [Vendor]: Select [ifm electronic].
2. In table: Select [EtherCAT Master].
► Click on [Add Device] to add the selected device to the project.
► Click on [Close] to close the window.
> CODESYS adds EtherCAT master to the device tree.

CODESYS automatically adds an EtherCAT master call to the task with the shortest cycle
time.
For notes on the configuration of task processing: → Configure task processing (→ p. 48)

23
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
System configuration Extend fieldbus functionality

>

Configure EtherCAT master


7477

► Familiarise yourself with the following CODESYS functions!


 EtherCAT master
→ Online help > Fieldbus support > EtherCAT configurator > EtherCAT master

The user has to assign the Ethernet configuration interface 1 (X3) or 2 (X8) to the added EtherCAT
master.
1 Requirements
> CODESYS laptop/PC is correctly connected to the device.
> Network path of SPS is set (→ Set the programming interface (→ p. 19)).
2 Assign Ethernet interface
► In the device tree: Double-click on [EtherCAT_Master (EtherCAT Master)]
► Click on the [General] tab.
> The editor window shows the configuration options of the EtherCAT master.
► Click on [Browse...]
> Window [Select Network Adapter] appears.
► Select requested Ethernet interface (eth0 = X3 or eth1 = X8).
► Click on [OK] to apply the selected Ethernet interface.
> Field [Source Address (MAC)] shows the MAC address of the selected Ethernet interface.
> Field [Network Name] shows the name of the Ethernet interface.
> EtherCAT master is coupled with selected Ethernet interface.
3 Configure EtherCAT master
► Set the parameters of the EtherCAT master as requested.
> EtherCAT master is configured.

Continue with: → Add and configure EtherCAT slave (→ p. 25)

24
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
System configuration Extend fieldbus functionality

>

Add and configure EtherCAT slave


7479

► Familiarise yourself with the following CODESYS functions!


 EtherCAT slave
→ Online help > Fieldbus support > EtherCAT configurator > EtherCAT slave

To configure EtherCAT slaves for the operation with the EtherCAT master of the SmartPLC DataLine
AC14:
Requirements:
> EtherCAT master is added to the project and configured (→ Add EtherCAT master (→ p. 23)).
> Device description file of the EtherCAT slave has been downloaded (→ manufacturer's website).
1 Optional: Add EtherCAT slave to the device repository
► Select [Tools] > [Device Repository...]
> Window [Device Repository] appears.
► Click on [Install...].
> Window [Install Device Description] appears.
► Select the device description of the EtherCAT slaves and click on [Open].
> CODESYS installs the device in the device repository.
2 Add EtherCAT slave
► In device tree: Right-click on [EtherCAT_Master (EtherCAT Master)]
► In the context menu: Select [Add device...]
> Window [Add Device] appears.
► Select the requested EtherCAT slave in the [Device] area.
► Click on [Add Device] to add the selected device to the project.
► Click on [Close] to close the window.
> CODESYS adds the EtherCAT slave to the project.
3 Configure EtherCAT slave
► In device tree: Double click on the added EtherCAT slave.
> The editor window shows the configuration options of the device.
► Configure EtherCAT slave as requested.

25
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
System configuration Extend fieldbus functionality

>

6.3.3 Add fieldbus stack


17702

► Familiarise yourself with the following CODESYS functions!


 Modbus configurator
→ Online help > Fieldbus support > Modbus configurator

To declare the Ethernet interface as a fieldbus interface:


1 Create/load CODESYS project
► Create or load CODESYS project with the SmartPLC DataLine AC14.
2 Add fieldbus stack
► In the device tree: Right-click on [X3 (Ethernet)] or [X8 (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.

26
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Programming Objects of a PLC application

7 Programming
Objects of a PLC application ..................................................................................................................27
Create SPS application ..........................................................................................................................28
Access input and output data .................................................................................................................30
Use functions of the ifm package ...........................................................................................................36
Use visualisations ...................................................................................................................................43
Configure task processing ......................................................................................................................48
Testing the SPS application ...................................................................................................................49
7074

This chapter provides information about the programming of the SPS of the device.

► Familiarise yourself with the programming according to the standard IEC 61131-3!

>

7.1 Objects of a PLC application


7143

All objects of a SPS application are listed as subelements of the node [Application] in the device tree.
In the basic configuration a SPS application contains the following objects:

1 [Application] is the container of the SPS 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 SPS application (→ p. 28)
4 [Task configuration] provides access to the settings of the task processing
→ Configure main task (→ p. 48)

If needed, the programmer can add additional objects to the PLC application (→ Add visualisation to a
project (→ p. 44)).

27
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Programming Create SPS application

>

7.2 Create SPS application


17691

► 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

To create a SPS application:


► In device tree: Double-click on [PLC_PRG (PRG)]
> The editor window shows the programming surface:

► Program the application in the editor.


>

7.2.1 Use remanent variables


18522

The SPS 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 SPS application is
reset (→ Supported reset variants (→ p. 57)).

The memory area for RETAIN variables comprises 4072 bytes.


► Pay attention to the maximum size of the RETAIN memory area when declaring RETAIN
variables!

28
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Programming Create SPS application

>

7.2.2 Supported programming languages


18034

The following table shows which programming languages according to IEC 61131 are supported by
the ifm function libraries:

Continuous Function Chart (CFC)


Sequential Function Chart (SFC)
Function Block Diagram (FBD)

Ladder Diagram (LD)

Structured Text (ST)


Instruction List (IL)
Library

ACnnnn_Utils.library X X X X X X

ACnnnn_SYS_CMD.library X X X X X X
Legend:
X ... is supported

>

7.2.3 Change system time of the device


18271

WARNING
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. 113))
 System command 0x1109 with function block ACnnnn_SysCmd (→ ACnnnn_SysCmd
(→ p. 125))

29
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Programming Access input and output data

>

7.3 Access input and output data

Options to access input and output data ................................................................................................30


Validity of the interface data ...................................................................................................................31
Process data of the AS-i slaves .............................................................................................................32
Fieldbus data ..........................................................................................................................................34
17447

► 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.1 Options to access input and output data


17621

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 SPS 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)

30
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Programming Access input and output data

>

7.3.2 Validity of the interface data


18413

In order to facilitate the access to inputs and outputs of AS-i slaves, SmartPLC DataLine AC14
projects offer clearly defined interfaces in the device tree (→ Overview: Project structure with SmartPLC
DataLine AC14 (→ p. 17)).
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:

Output control I/O interfaces Updated address areas / channels


Manual [ASi_Master_1] AS-i 1 Input (%IB, %IW)
[ASi_Master_2]* AS-i 2 Input (%IB, %IW)
[Fieldbus_Interface]  AS-i 1 Output (%IB, %IW)
 AS-i 2 Output (%IB, %IW)
Gateway [ASi_Master_1] ASi 1 Input (%IB, %IW)
[ASi_Master_2]* AS-i 2 Input (%IB, %IW)
[Fieldbus_Interface]  AS-i 1 Output (%IB, %IW)
 AS-i 2 Output (%IB, %IW)
PLC [ASi_Master_1]  AS-i 1 Input (%IB, %IW)
 AS-i 1 Output (%QB, %QW)
[ASi_Master_2]*  AS-i 2 Input (%IB, %IW)
 AS-i 2 Output (%QB, %QW)
[Fieldbus_Interface]  AS-i 1 Output (%IB, %IW)
 AS-i 2 Output (%IB, %IW)
* ... 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!

31
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Programming Access input and output data

>

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.

1 Digital input and output data of the slave at AS-i master 1: → Digital input and output data (→ p. 33)

2 Analogue input and output data of the slaves at AS-i master 1: → Analogue input and output data (→ p. 33)

3 Digital input and output data of the slave at AS-i master 2: → Digital input and output data (→ p. 33)

4 Analogue input and output data of the slaves at AS-i master 2: → Analogue input and output data (→ p. 33)

Consider validity of the interface data (→ Validity of the interface data (→ p. 31))!

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. 120))

32
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Programming Access input and output data

>

Digital input and output data


17625

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.

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]

>

Analogue input and output data


17626

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.

► In column [Variable]: Mouse click on to make individual variables visible.

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]

33
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Programming Access input and output data

>

7.3.4 Fieldbus data


17585

The device tree offers direct access to the data that is transmitted between fieldbus and device.

1 Data that the fieldbus transmits/receives via the fieldbus.


→ Input and output data of the fieldbus interface (→ p. 34)
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. 35)

Consider validity of the interface data (→ Validity of the interface data (→ p. 31))!

>

Input and output data of the fieldbus interface


17619

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.

34
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Programming Access input and output data

>

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.

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 SPS.

>

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.

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]

>

Analogue output data


17631

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.

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]

35
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Programming Use functions of the ifm package

>

7.4 Use functions of the ifm package


18489

The CODESYS package "CODESYS for ifm SmartPLC DataLine" 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:

Designation Type Data type Description Possible values

xExecute Input BOOL Control FB execution FALSE Stop FB execution


TRUE Start FB execution
xReady Output BOOL Indication of whether execution of FALSE FB execution not yet completed
the FB has been 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 FALSE FB executed correctly
occurred during execution of the
FB TRUE Error occurred during execution of
the FB
wDiagnostic Output WORD Error code FB specific

The following figure shows the relation between the connections of the control signals:

36
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Programming Use functions of the ifm package

1 xExecute = TRUE: Rising edge (FALSE  TRUE) starts execution of the FB.
xBusy = TRUE: FB execution has been started, but has not yet been completed.
2 xReady = TRUE: FB execution completed; there are valid values on the data outputs.
xBusy = FALSE: FB is no longer active.
xError = FALSE: FB execution without faults.
3 xExecute = FALSE: All signal outputs are set to FALSE and all internal states are reset.

4 → 1
5 xReady = TRUE: FB execution is terminated.
xBusy = FALSE: FB is no longer active.
xError = TRUE: Errors occurred during FB execution; wDiagnostic provides error code.
6 → 3
7 → 1
8 xExecute = FALSE: FB execution interrupted prior to completion; All signal outputs are set to FALSE and all
internal states are reset.

>

FB with cyclic execution


17141

Function blocks which, when activated, cyclically perform their function until they are deactivated have
the following control inputs and outputs:

Designation Type Data type Description Possible values

xEnable Input BOOL Control FB execution FALSE Stop FB execution


TRUE Start FB execution
xActive Output BOOL Indication of whether execution of FALSE FB execution not yet completed
the FB has been completed
TRUE FB execution completed
xError Output BOOL Indication of whether faults have FALSE FB executed correctly
occurred during execution of the
FB TRUE Error occurred during execution of
the FB
wCycleCount Output WORD Counters for the FB cycles Integer value (hexadecimal representation)
wDiagnostic Output WORD Error code FB specific

>

7.4.2 Configure system


17450

To configure the system of the device, use the following function blocks:

Name Description Reference

QuickSetupASi_Master Execute quick setup routine on an AS-i master → QuickSetupASi_Master (→ p. 111)


Set_TimeDate Set system time (date, time) of the system → Set_TimeDate (→ p. 113)
Get_FieldbusInfo Read fieldbus type, the status of the field bus connection → Get_FieldbusInfo (→ p. 109)
and the parameters of the fieldbus interface

>

37
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Programming Use functions of the ifm package

7.4.3 Configure AS-i master


17448

To configure the AS-i masters of the device, use the following function blocks:

Name Description Reference


Set_Mode Set operating mode of the AS-i master (projecting mode → Set_Mode (→ p. 95)
or protected operation)
Set_ASi_Config Set diagnostic functions of the AS-i master (double → Set_ASi_Config (→ p. 91)
address recognition, earth fault detection)
Set_AdressMode Set automatic addressing of the AS-i master → Set_AddressMode (→ p. 89)

>

7.4.4 Configure AS-i slaves


17449

To configure the AS-i slaves, that are connected to the device, use the following function blocks:

Name Description Reference

Set_SlaveAddress Change address of an AS-i slave → Set_SlaveAddress (→ p. 100)


Set_SlaveParameter Change I/O configuration and ID codes (IO, ID, ID1, ID2) → Set_SlaveParameter (→ p. 104)
of an AS-i slave
Set_SlaveExtendedID1 Extended ID1 of an AS-i slave → Set_SlaveExtendedID1 (→ p. 102)

38
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Programming Use functions of the ifm package

>

7.4.5 Manage AS-i network


17126

To manage the AS-i networks controlled by SmartPLC DataLine 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.
The following complex variables are available:
Name Description Reference

ASI_NET The complex variable contains the complete process image → ASI_NET (STRUCT) (→ p. 120)
(inputs and outputs) of an AS-i network.
ASI_DATA The complex variable contains the following components: → ASI_DATA (STRUCT) (→ p. 117)
 Slave lists (LPS, LDS, LAS, LPF, LCE, LCEMS, LCEAS, → Get_ASi_Data (→ p. 106)
LDAE)
 Parameter images (PI, PP)
 Configuration data of the AS-i slaves (CDI, PCD)

>

Change network settings


17568

Name Description Reference


Set_ProjectAll Execute projection adaptation on one AS-i master → Set_ProjectAll (→ p. 99)
Set_LPS Change list of the projected slaves (LDS) → Set_LPS (→ p. 93)
Set_PCD Change permanent projecting data (IO, ID, ID1, ID2) of → Set_PCD (→ p. 97)
all slaves on the AS-i master

39
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Programming Use functions of the ifm package

>

Read network settings


18532

To read the network settings cyclically and offer them in the application:

Name Description Reference

Get_ASi_Data Read the following datasets for network management in → Get_ASi_Data (→ p. 106)
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)

Alternatively, this data can be read separately with the following FB:
>

Read parameter images


17569

Name Description Reference


Get_InputParameter Read parameters of the inputs of the slaves at the AS-i → Get_InputParameter (→ p. 85)
master (PI)
Get_OutputParameter Read parameters of the outputs of the slaves on the → Get_OutputParameter (→ p. 87)
AS-i master (PP)

>

read slave lists


18530

Name Description Reference

Get_LPS Read list of projected slaves (LPS) → Get_LPS (→ p. 69)


Get_LDS Read list of detected slaves (LDS) → Get_LDS (→ p. 67)
Get_LAS Read list of activated slaves (LAS) → Get_LAS (→ p. 65)
Get_LPF Read list of peripheral faults (LPF) → Get_LPF (→ p. 79)
Get_LCE Read list of configuration errors (LCE) → Get_LCE (→ p. 71)
Get_LCEMS List of configuration errors - read missing slaves → Get_LCEMS (→ p. 75)
(LCEMS)
Get_LCEAS Read of the configuration errors - read additional slave → Get_LCEAS (→ p. 73)
(LCEAS)
Get_LDAE Read list of double address errors (LDAE) → Get_LDAE (→ p. 77)

40
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Programming Use functions of the ifm package

>

Read configuration data of the slaves


18533

Name Description Reference


Get_CDI Read configuration data image (IO, ID, ID1, ID2) of all → Get_CDI (→ p. 81)
slaves on the AS-i master
Get_PCD Read permanent configuration data of all slaves (IO, ID, → Get_PCD (→ p. 83)
ID1, ID2) on the AS-i master

>

Read status of the voltage supply


18529

Name Description Reference

Get_ASi_PHY_Dat Determine voltage supply status of the AS-i network → Get_ASi_PHY_Dat (→ p. 63)

41
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Programming Use functions of the ifm package

>

7.4.6 Send commands to the system and the AS-i master


17659

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. 125)).
 System command overview: → Table: System commands (→ p. 126)
 Overview AS-i master commands: → Table: AS-i master commands (→ p. 127)

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.

42
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Programming Use visualisations

>

7.5 Use visualisations

Supported visualisation types .................................................................................................................43


Add visualisation to a project ..................................................................................................................44
Create a visualisation .............................................................................................................................45
Configure visualisation ...........................................................................................................................46
17059

► Familiarise yourself with the following CODESYS functions!


 Visualisations in CODESYS
→ Online help > CODESYS visualisation

>

7.5.1 Supported visualisation types


17661

The SmartPLC DataLine 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.

43
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Programming Use visualisations

>

7.5.2 Add visualisation to a project


17060

To add a visualisation to a CODESYS project:


► Open CODESYS project.
OR:
Create new CODESYS project. (→ Create new project with SmartPLC DataLine AC14 (→ p. 16))
► 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:

1 [VISU_TASK] provides access to the visualisation task properties (→ Set parameters for visualisation task
(→ p. 48))
2 [Visualization Manager] provides access to the visualisation properties (→ Configure visualisation (→ p. 46))

3 [MyVisu] contains the area for the creation of the visualisation objects (→ Create a visualisation (→ p. 45))

44
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Programming Use visualisations

>

7.5.3 Create a visualisation


17061

Create a seperate visualisation object for each target and web visualisation.

To create a visualisation for a SPS application:


► In the device tree: double-click on [Visualization]
> The visualisation editor with a tool box appears:

► Create the visualisation using the tools.


► Save the project to apply changes.

45
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Programming Use visualisations

>

7.5.4 Configure visualisation


6953

In order to change the properties of the created visualisations, choose one of the following options:
 Change properties of the web visualisation (→ p. 46)
 Change the properties of the target visualisation (→ p. 47)
>

Change properties of the web visualisation


17065

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:

► 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.

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. 59)).
► Use only lower case when entering the name!

► Save the project to apply changes.

46
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Programming Use visualisations

>

Change the properties of the target visualisation


17064

To change the properties of the target visualisation:


► In device tree: Double-click on [TargetVisu]
> Editor window shows properties of the target visualisation.

► Set the following values:


1. [Start Visualization] field: Select the created target visualisation.
2. [Scaling options] area: Enter fixed width and height as illustrated.
► Save the project to apply changes.

47
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Programming Configure task processing

>

7.6 Configure task processing


4109

► Familiarise yourself with the following CODESYS functions!


 Task configuration
→ Online help > CODESYS Development System > application programmable > task
configuration

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:

Name Description Note

[MainTask] Configuration of the main task (e.g. for main program → Configure main task (→ p. 48)
[PLC_PRG (PRG)])
[VISU_TASK] Configuration of the task for processing visualisation → Set parameters for visualisation task (→ p. 48)

>

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

► 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 SPS of the fieldbus network.

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.

48
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Programming Testing the SPS application

>

7.7 Testing the SPS application


18594

► Familiarise yourself with the following CODESYS functions!


 Test and fault elimination
→ Online help > CODESYS Development System > Testing and Debugging

To ensure permanent operation without errors in industrial environments, the created SPS application
must be tested in detail and possible faults must be remedied.

49
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Operation Testing the SPS application

8 Operation
Transfer CODESYS project to device ....................................................................................................51
Operating states of the SPS ...................................................................................................................55
Reset ......................................................................................................................................................57
Display web visualisation........................................................................................................................59
Display target visualisation .....................................................................................................................59
18492

50
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Operation Transfer CODESYS project to device

>

8.1 Transfer CODESYS project to device

Activate CODESYS SPS ........................................................................................................................52


Download the application to the device ..................................................................................................53
Delete application from SmartPLC DataLine AC14 ...............................................................................53
Delete boot application via SD card .......................................................................................................54
18490

► Familiarise yourself with the following CODESYS functions!


 Compile project/application and transfer it to device
→ Online help > CODESYS Development System > Transferring Applications to the
PLC

To save the CODESYS project on the device the following component must be transferred to the
device:
 application "Application" (→ Download the application to the device (→ p. 53))

► Observe notes on the operating modes of the SPS of the device!


→ Operating states of the SPS (→ p. 55)
ifm system solutions and CODESYS applications created by the user must not be saved and
executed on the device at the same time!
► Before loading an application to the device delete all ifm system solutions saved on the
device (→ Device manual, Uninstall ifm apps)!
To be able to use an ifm system solution in a user project the functions must be integrated into
the project via libraries to be ordered separately.
► Contact the AS-i specialist of ifm electronic!

51
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Operation Transfer CODESYS project to device

>

8.1.1 Activate CODESYS SPS


17692

To enable the processing of the created SPS application, the device-internal CODESYS SPS must be
activated in the setup menu of SmartPLC DataLine AC14.
If the SPS application is to have a write access to the outputs of the AS-i slaves, the CODESYS SPS
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 SPS resulting thereof.

List Checkbox CODESYS SPS


[Output access] [Use PLC]
Programmable Access to Access to
AS-i inputs AS-i outputs

Gateway no yes no

yes yes no

Manual no yes no

yes yes no

PLC * yes yes yes

Legend:
* ... Value fixed (greyed out)

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 SPS
► Activate [Use PLC] checkbox.
> CODESYS SPS 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.

52
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Operation Transfer CODESYS project to device

>

8.1.2 Download the application to the device


18593

To transfer the created application as boot project to the device:


Requirements:
> Network path is set (→ Set network path of SPS (→ p. 19)).
> 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.
>

8.1.3 Delete application from SmartPLC DataLine AC14


18030

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.
> Selected application will be deleted.

53
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Operation Transfer CODESYS project to device

>

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 SPS is deleted.
> The file KillBootApp.txt on the SD card is renamed in KillBootApp.rdy.

With this method the following data on the device-internal SPS 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

54
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Operation Operating states of the SPS

>

8.2 Operating states of the SPS


17544

This section provides information about the operating states of the device and the states of the SPS of
the device as well as information about the states of the applications.
>

8.2.1 Operating mode of the SPS


13769

The SPS of the device can be operated in the following modes:


 Offline mode
In the offline mode the user is logged out of the SPS or there is no connection between
CODESYS and the SPS (e.g. connection loss).
 Online mode
In the online mode the user is logged in to the SPS.
>

8.2.2 States of the SPS 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 SPS.
 RUN
The application is executed (cyclically processed).
 STOP
The application is not executed.
>

Display operating state of the application


10272

To display the current operating state of the SPS 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 SPS applications saved on the device.

55
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Operation Operating states of the SPS

>

8.2.3 Switch operating states


10264

To switch between the operating states of the application choose one of the following options:
>

Start SPS application


18027

To start a SPS 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 SPS.
► 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.
>

Stop SPS application


18029

To stop a SPS 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 SPS.
► 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.

56
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Operation Reset

>

8.3 Reset

Supported reset variants ........................................................................................................................57


Reset the application (warm) ..................................................................................................................58
Reset the application (cold) ....................................................................................................................58
Reset the application (origin) ..................................................................................................................58
18025
>

8.3.1 Supported reset variants


18613

The following table shows the reset variants supported by the device-internal CODESYS SPS and the
resulting system behaviour:

Type of reset System behaviour Triggering actions


Reset (warm)  application goes to STOP state. → Reset the application (warm) (→ p. 58)
 Standard variables (VAR) of the application are
initialised.
 Remanent variables (VAR RETAIN) of the
application keep their current values.
Reset (cold)  application changes to the STOP state. → Reset the application (cold) (→ p. 58)
 All variables (VAR, VAR RETAIN) of the
application are initialised.
Reset (default)  application goes to STOP state. → Reset the application (origin) (→ p. 58)
 The application on the SPS is deleted.
 All variables (VAR, VAR RETAIN) of the
application are initialised.
 SPS is reset to the default state.

A variable that has been declared without an initialisation value is initialised with the
variable-specific standard value (e.g. INT = 0).

57
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Operation Reset

>

8.3.2 Reset the application (warm)


13131
9069

To reset the application on the SPS, 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 SPS.
> 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.
>

8.3.3 Reset the application (cold)


15687

To reset the application on the SPS, choose one of the following options:
 Download the application to the device
► → Download the application to the device (→ p. 53)
 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 SPS.
> CODESYS switches to online mode.
► Select [Online] > [Reset cold] to reset the application.
>

8.3.4 Reset the application (origin)


18962

To reset the application on the SPS:


 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-SPS.
> CODESYS switches to online mode.
► Select [Online] > [Reset origin] to reset the application.

58
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Operation Display web visualisation

>

8.4 Display web visualisation


17063

To display the created web visualisation:


Requirements:
> PC/laptop is connected to the configuration interface (X3) of the device (→ device manual: Configuration
interface: connection concepts)

CODESYS SPS appliation


► Download SPS application with web visualisation to the device and start it (→ Download the application to the
device (→ p. 53)).
► On PC/laptop: Start web browser.
► Enter the following in the address line and press [ENTER] to confirm:
<IP address-of-the-device>:<8080>/myvisu.htm

myvisu is the user-defined name of the visualisation (→ Change properties of the web visualisation
(→ p. 46)).

> Web browser shows the web visualisation of the device.

ifm system solution


► Install the ifm system solution on the device and start it (→ device manual, Install single/basic app or Install
multi app).
► Display informationen about the installed ifm app (→ device manual, Show information about installed ifm
apps).
► Call hyperlink of the ifm app.
> Web browser shows the web visualisation of the ifm system solution.
>

8.5 Display target visualisation


20256

After compilation of the project and download to the device the user has to start the target
visualisation:
 CODESYS / higher-level Fieldbus controller:
► Execute system command [Display target visualisation] (→ Device manual, Command 0x0110 – Display target
visualisation)
 GUI / web interface:
► Activate target visualisation via the menu (→ Device manual: Show target visualisation)
OR:
Switch between target visualisation and menu with the key combination [] + [].

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. 125)execute the system command [Display target
visualisation] at the start of the SPS application.
Further information: → Device manual: Command 0x0110 – Display target visualisation"

59
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Display target visualisation

9 Appendix
Library ACnnnn_Utils.library ...................................................................................................................61
Library ACnnnn_SYS_CMD.library ......................................................................................................124
7156

60
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

9.1 Library ACnnnn_Utils.library

Overview: AS-i functions (FB_ASi) .........................................................................................................62


Overview: System functions (FB_System) ...........................................................................................108
Enumeration types and complex variables ...........................................................................................115
17722

61
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

9.1.1 Overview: AS-i functions (FB_ASi)

Get_ASi_PHY_Dat .................................................................................................................................63
Get_LAS .................................................................................................................................................65
Get_LDS .................................................................................................................................................67
Get_LPS .................................................................................................................................................69
Get_LCE .................................................................................................................................................71
Get_LCEAS ............................................................................................................................................73
Get_LCEMS ...........................................................................................................................................75
Get_LDAE...............................................................................................................................................77
Get_LPF .................................................................................................................................................79
Get_CDI ..................................................................................................................................................81
Get_PCD ................................................................................................................................................83
Get_InputParameter ...............................................................................................................................85
Get_OutputParameter ............................................................................................................................87
Set_AddressMode ..................................................................................................................................89
Set_ASi_Config ......................................................................................................................................91
Set_LPS..................................................................................................................................................93
Set_Mode ...............................................................................................................................................95
Set_PCD .................................................................................................................................................97
Set_ProjectAll .........................................................................................................................................99
Set_SlaveAddress ................................................................................................................................100
Set_SlaveExtendedID1 ........................................................................................................................102
Set_SlaveParameter ............................................................................................................................104
Get_ASi_Data .......................................................................................................................................106
17459

62
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Get_ASi_PHY_Dat
16005

Function block type: Function block (FB)


Library: ACnnnn_Utils.library
Symbol in CODESYS:

>

Description
16040

The FB reads the physical data of the selected AS-i master and provides the values.
>

Input parameters
16041

Parameter Data type Description Possible values

xExecute BOOL Control execution of the FB FALSE Stop FB execution


TRUE Start one-time FB execution
enASi_Master ASI_MASTER Select AS-i master Master_1 AS-i master 1
Master_2 AS-i master 2

63
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Output parameters
16042

Parameter Data type Description Possible values


xPS BOOL Voltage source (Power Source) FALSE Unit is supplied via Aux.
TRUE Unit is supplied via AS-i.
xPM BOOL Power24-Modul (PM) FALSE Power24 module missing.
TRUE Power24 module is inserted.
xEF BOOL Earth fault FALSE No earth fault
TRUE Supply voltage is asymmetric,
earth fault suspected.
xSE BOOL Status of the earth fault detection FALSE Earth fault detection does not
provide valid data (e.g. when
AS-i voltage is lacking).
TRUE Earth fault detection provides
valid data.
xPF1 BOOL Voltage <22.5 V (power fail 22.5 V) FALSE No AS-i power fault (Classic
APF)
TRUE AS-i power fail (Classic APF),
i.e. AS-i voltage is below
22.5 V
xPF2 BOOL Voltage <19.0V (power fail 19V) FALSE No AS-i power fail (24V-APF)
TRUE AS-i power fail (24V-APF), i.e.
AS-i voltage is below 19.0 V
wVoltage1 WORD Voltage AS-i+ to AS-i- in mV
wVoltage2 WORD Voltage FE to AS-i in mV
iSymmetry INT Symmetry in % (-100% ... +100%) 0xFF9C -100%
... ...
0x0000 0%
... ...
0x0064 +100%
xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. 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 FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set

64
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

Get_LAS
16008

Function block type: Function block (FB)


Library: ACnnnn_Utils.library
Symbol in CODESYS:

>

Description
16068

The FB reads the list of activated slaves (LAS) of the selected AS-i master and provides the values.
>

Input parameters
16069

Parameter Data type Description Possible values


xExecute BOOL Control execution of the FB FALSE Stop FB execution
TRUE Start one-time FB execution
enASi_Master ASI_MASTER Select AS-i master Master_1 AS-i master 1
Master_2 AS-i master 2

65
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Output parameters
16070

Parameter Data type Description Possible values


dwLAS_SA_Slaves DWORD List of the active S/A slaves. Each bit Per bit:
represents an AS-i address:
 Bit 0 (LSB) = address 0 0 No single/A slave available
...
1 Single/A slave available
Bit 31 (MSB) = address 31/31A
dwLAS_B_Slaves DWORD List of the active B slaves. Each bit Per bit:
represents an AS-i address:
0 No B slave available
 Bit 0 (LSB) = not used
 Bit 1 = address 1B 1 B slave available
...
Bit 31 (MSB) = address 31B
xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. 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 FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set
 0x0F01 Unknown error
 0x0F02 Unknown/invalid target
 0x0F03 Unknown command ID
 0x0F04 Invalid parameters
 0x0F05 Timeout during processing
>

66
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Get_LDS
16013

Function block type: Function block (FB)


Library: ACnnnn_Utils.library
Symbol in CODESYS:

>

Description
16118

The FB reads the list of detected slaves (LDS) of the selected AS-i master and provides the values.
>

Input parameters
16119

Parameter Data type Description Possible values

xExecute BOOL Control execution of the FB FALSE Stop FB execution


TRUE Start one-time FB execution
enASi_Master ASI_MASTER Select AS-i master Master_1 AS-i master 1
Master_2 AS-i master 2

67
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Output parameters
16120

Parameter Data type Description Possible values


dwLDS_SA_Slaves DWORD List of detected S/A slaves. Each bit Per bit:
represents an AS-i address:
 Bit 0 (LSB) = address 0 0 no slave detected
...
1 slave detected
 Bit 31 (MSB) = address 31/31A
dwLDS_B_Slaves DWORD List of detected B slaves. Each bit Per bit:
represents an AS-i address:
0 No slave detected
 Bit 0 (LSB) = not used
 Bit 1 = address 1B 1 Slave detected
...
 Bit 31 (MSB) = address 31B
xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. 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 FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set
 0x0F01 Unknown error
 0x0F02 Unknown/invalid target
 0x0F03 Unknown command ID
 0x0F04 Invalid parameters
 0x0F05 Timeout during processing
>

68
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Get_LPS
16015

Function block type: Function block (FB)


Library: ACnnnn_Utils.library
Symbol in CODESYS:

>

Description
16130

The FB reads the list of projected slaves (LPS) at the selected AS-i master and provides the values.
>

Input parameters
16131

Parameter Data type Description Possible values


xExecute BOOL Control execution of the FB FALSE Stop FB execution
TRUE Start one-time FB execution
enASi_Master ASI_MASTER Select AS-i master Master_1 AS-i master 1
Master_2 AS-i master 2

69
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Output parameters
16132

Parameter Data type Description Possible values


dwLPS_SA_Slaves DWORD List of the projected S/A slaves. Each Per bit:
bit represents an AS-i address:
 Bit 0 (LSB) = address 0 0 Slave not projected
...
1 Slave projected
 Bit 31 (MSB) = address 31/31A
dwLPS_B_Slaves DWORD List of the projected B slaves. Each bit Per bit:
represents an AS-i address:
0 slave not projected
 Bit 0 (LSB) = not used
 Bit 1 = address 1B 1 slave projected
...
 Bit 31 (MSB) = address 31B
xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. 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 FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set
 0x0F01 Unknown error
 0x0F02 Unknown/invalid target
 0x0F03 Unknown command ID
 0x0F04 Invalid parameters
 0x0F05 Timeout during processing

70
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Get_LCE
16009

Function block type: Function block (FB)


Library: ACnnnn_Utils.library
Symbol in CODESYS:

>

Description
16075

The FB reads the list of configuration errors (LCE) of the selected AS-i master and provides the
values.
>

Input parameters
16076

Parameter Data type Description Possible values

xExecute BOOL Control execution of the FB FALSE Stop FB execution


TRUE Start one-time FB execution
enASi_Master ASI_MASTER Select AS-i master Master_1 AS-i master 1
Master_2 AS-i master 2

71
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Output parameters
16077

Parameter Data type Description Possible values


dwLCE_SA_Slaves DWORD List of configuration errors of the S/A Per bit:
slaves. Each bit represents an AS-i
address:
0 No configuration error
 Bit 0 (LSB) = address 0
1 Configuration error
...
Bit 31 (MSB) = address 31/31A
dwLCE_B_Slaves DWORD List of configuration errors of the B Per bit:
slaves. Each bit represents an AS-i
address: 0 No configuration error
 Bit 0 (LSB) = not used 1 Configuration error
 Bit 1 = address 1B
...
Bit 31 (MSB) = address 31B
xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. 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 FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set
 0x0F01 Unknown error
 0x0F02 Unknown/invalid target
 0x0F03 Unknown command ID
 0x0F04 Invalid parameters
 0x0F05 Timeout during processing

72
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Get_LCEAS
16010

Function block type: Function block (FB)


Library: ACnnnn_Utils.library
Symbol in CODESYS:

>

Description
16098

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.
>

Input parameters
16099

Parameter Data type Description Possible values

xExecute BOOL Control execution of the FB FALSE Stop FB execution


TRUE Start one-time FB execution
enASi_Master ASI_MASTER Select AS-i master Master_1 AS-i master 1
Master_2 AS-i master 2

73
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Output parameters
16100

Parameter Data type Description Possible values


dwLCEAS_SA_Slaves DWORD List of configuration errors of the S/A Per bit:
slaves. Each bit represents an AS-i
address: 0 No configuration error -
 Bit 0 (LSB) = address 0 additional slave
... 1 Slave exists, but not projected
Bit 31 (MSB) = address 31/31A
dwLCEAS_B_Slaves DWORD List of configuration errors of the B Per bit:
slaves. Each bit represents an AS-i
address: 0 No configuration error -
additional slave
 Bit 0 (LSB) = not used
 Bit 1 = address 1B 1 Slave exists, but not projected
...
Bit 31 (MSB) = address 31B
xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. 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 FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set
 0x0F01 Unknown error
 0x0F02 Unknown/invalid target
 0x0F03 Unknown command ID
 0x0F04 Invalid parameters
 0x0F05 Timeout during processing

74
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Get_LCEMS
16011

Function block type: Function block (FB)


Library: ACnnnn_Utils.library
Symbol in CODESYS:

>

Description
16106

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.
>

Input parameters
16107

Parameter Data type Description Possible values

xExecute BOOL Control execution of the FB FALSE Stop FB execution


TRUE Start one-time FB execution
enASi_Master ASI_MASTER Select AS-i master Master_1 AS-i master 1
Master_2 AS-i master 2

75
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Output parameters
16108

Parameter Data type Description Possible values


dwLCEMS_SA_Slaves DWORD List of configured but missing S/A Per bit:
slaves. Each bit represents an AS-i
address:
0 No configuration error -
 Bit 0 (LSB) = address 0 missing slave
...
1 Slave is projected but not
Bit 31 (MSB) = address 31/31A available
sdwLCEMS_B_Slaves DWORD List of the configured but non-existing Per bit:
B slaves. Each bit represents an AS-i
address: 0 No configuration error -
missing slave
 Bit 0 (LSB) = not used
 Bit 1 = address 1B 1 Slave is projected but not
available
...
Bit 31 (MSB) = address 31B
xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. 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 FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set
 0x0F01 Unknown error
 0x0F02 Unknown/invalid target
 0x0F03 Unknown command ID
 0x0F04 Invalid parameters
 0x0F05 Timeout during processing

76
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Get_LDAE
16012

Function block type: Function block (FB)


Library: ACnnnn_Utils.library
Symbol in CODESYS:

>

Description
16112

The FB reads the double address errors (LDAE) of the selected AS-i master and provides the values
in a list.
>

Input parameters
16113

Parameter Data type Description Possible values

xExecute BOOL Control execution of the FB FALSE Stop FB execution


TRUE Start one-time FB execution
enASi_Master ASI_MASTER Select AS-i master Master_1 AS-i master 1
Master_2 AS-i master 2

77
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Output parameters
16114

Parameter Data type Description Possible values


dwLDAE_SA_Slaves DWORD List of the double address errors. Per bit:
Each bit represents an AS-i address:
 Bit 0 (LSB) = address 0 0 No double address error
...
1 Double address error
Bit 31 (MSB) = address 31/31A
dwLDAE_B_Slaves DWORD List of double address errors. Each bit Per bit:
represents an AS-i address:
0 No double address error
 Bit 0 (LSB) = not used
 Bit 1 = address 1B 1 Double address error
...
Bit 31 (MSB) = address 31B
xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. 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 FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set
 0x0F01 Unknown error
 0x0F02 Unknown/invalid target
 0x0F03 Unknown command ID
 0x0F04 Invalid parameters
 0x0F05 Timeout during processing

78
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Get_LPF
16014

Function block type: Function block (FB)


Library: ACnnnn_Utils.library
Symbol in CODESYS:

>

Description
16124

The FB reads the list of peripheral faults (LPF) of the selected AS-i master and provides the values.
>

Input parameters
16125

Parameter Data type Description Possible values


xExecute BOOL Control execution of the FB FALSE Stop FB execution
TRUE Start one-time FB execution
enASi_Master ASI_MASTER Select AS-i master Master_1 AS-i master 1
Master_2 AS-i master 2

79
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Output parameters
16126

Parameter Data type Description Possible values


dwLPF_SA_Slaves DWORD List of peripheral faults on S/A slaves. Per bit:
Each bit represents an AS-i address:
 Bit 0 (LSB) = address 0 0 No peripheral fault
...
1 Peripheral fault detected
Bit 31 (MSB) = address 31/31A
dwLPF_B_Slaves DWORD List of peripheral faults on B slaves. Per bit:
Each bit represents an AS-i address:
0 No peripheral fault
 Bit 0 (LSB) = not used
 Bit 1 = address 1B 1 Peripheral fault detected
...
Bit 31 (MSB) = address 31B
xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. 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 FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set
 0x0F01 Unknown error
 0x0F02 Unknown/invalid target
 0x0F03 Unknown command ID
 0x0F04 Invalid parameters
 0x0F05 Timeout during processing

80
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Get_CDI
16006

Function block type: Function block (FB)


Library: ACnnnn_Utils.library
Symbol in CODESYS:

>

Description
16045

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.
>

Input parameters
16046

Parameter Data type Description Possible values


xExecute BOOL Control execution of the FB FALSE Stop FB execution
TRUE Start one-time FB execution
enASi_Master ASI_MASTER Select AS-i master Master_1 AS-i master 1
Master_2 AS-i master 2

81
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Output parameters
16047

Parameter Data type Description Possible values


awCDI ARRAY [0...63] Configuration data of the slaves at the Per Word:
OF WORD selected AS-i master Bits 0...3: I/O-Code
Bits 4...7: ID-Code
Bits 8...11: ID1-Code
Bits 12...15: ID2-Code
xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. 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 FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set
 0x0F01 Unknown error
 0x0F02 Unknown/invalid target
 0x0F03 Unknown command ID
 0x0F04 Invalid parameters
 0x0F05 Timeout during processing

82
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Get_PCD
16017

Function block type: Function block (FB)


Library: ACnnnn_Utils.library
Symbol in CODESYS:

>

Description
16141

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.
>

Input parameters
16142

Parameter Data type Description Possible values


xExecute BOOL Control execution of the FB FALSE Stop FB execution
TRUE Start one-time FB execution
enASi_Master ASI_MASTER Select AS-i master Master_1 AS-i master 1
Master_2 AS-i master 2

83
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Output parameters
16143

Parameter Data type Description Possible values


awPCD ARRAY [0...63] Permanent configuration files of the per word:
OF WORD slaves on the selected AS-i master Bits 0...3: I/O-Code
Bits 4...7: ID-Code
Bits 8-11: ID1-Code
Bits 12-15: ID2-Code
Data in Word 0 is invalid!
xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. 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 FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set
 0x0F01 Unknown error
 0x0F02 Unknown/invalid target
 0x0F03 Unknown command ID
 0x0F04 Invalid parameters
 0x0F05 Timeout during processing

84
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Get_InputParameter
16007

Function block type: Function block (FB)


Library: ACnnnn_Utils.library
Symbol in CODESYS:

>

Description
16056

The FB reads the input parameters of the slaves on the selected AS-i master and provides the values
in 2 arrays for single A slaves and B slaves.
>

Input parameters
16057

Parameter Data type Description Possible values

xExecute BOOL Control execution of the FB FALSE Stop FB execution


TRUE Start one-time FB execution
enASi_Master ASI_MASTER Select AS-i master Master_1 AS-i master 1
Master_2 AS-i master 2

85
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Output parameters
16058

Parameter Data type Description Possible values


abList_SA_Slave ARRAY[0..31] List of output parameters of S/A Per byte:
OF BYTE slaves in the selected AS-i master.
Each byte contains the output Bits 0...3: P0-P3
parameters of an AS-i slave.
– byte 0 (LSB) = res.
– byte 1 = slave with address 1(A) ...
– byte 31 = slave with address 31(A)
abList_B_Slave ARRAY[0..31] List of output parameters of B slaves Per byte:
OF BYTE in the selected AS-i master. Each byte
contains the output parameters of an Bits 0...3: P0-P3
AS-i slave.
– byte 0 (LSB) = res.
– byte 1 = slave with address 1B
...
– byte 31 = slave with address 31B
xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. 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 FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set
 0x0F01 Unknown error
 0x0F02 Unknown/invalid target
 0x0F03 Unknown command ID
 0x0F04 Invalid parameters
 0x0F05 Timeout during processing

86
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Get_OutputParameter
16016

Function block type: Function block (FB)


Library: ACnnnn_Utils.library
Symbol in CODESYS:

>

Description
16136

The FB reads the output parameters of the slaves on the selected AS-i master and provides the
values for S/A slaves and B slaves in 2 separate arrays.
>

Input parameters
16137

Parameter Data type Description Possible values

xExecute BOOL Control execution of the FB FALSE Stop FB execution


TRUE Start one-time FB execution
enASi_Master ASI_MASTER Select AS-i master Master_1 AS-i master 1
Master_2 AS-i master 2

87
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Output parameters
16138

Parameter Data type Description Possible values


abList_SA_Slave ARRAY[0..31] List of output parameters of S/A Per byte:
OF BYTE slaves in the selected AS-i master.
Each byte contains the output Bits 0...3: P0-P3
parameters of an AS-i slave.
– byte 0 (LSB) = res.
– byte 1 = slave with address 1(A) ...
– byte 31 = slave with address 31(A)
abList_B_Slave ARRAY[0..31] List of output parameters of B slaves Per byte:
OF BYTE in the selected AS-i master. Each byte
contains the output parameters of an Bits 0...3: P0-P3
AS-i slave.
– byte 0 (LSB) = res.
– byte 1 = slave with address 1B
...
– byte 31 = slave with address 31B
xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. 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 FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set
 0x0F01 Unknown error
 0x0F02 Unknown/invalid target
 0x0F03 Unknown command ID
 0x0F04 Invalid parameters
 0x0F05 Timeout during processing

88
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Set_AddressMode
16018

Function block type: Function block (FB)


Library: ACnnnn_Utils.library
Symbol in CODESYS:

>

Description
16146

The FB activates/deactivates the parameter "Automatic addressing" for the selected AS-i master.
>

Input parameters
16147

Parameter Data type Description Possible values


xExecute BOOL Control execution of the FB FALSE Stop FB execution
TRUE Start one-time FB
execution
enASi_Master ASI_MASTER Select AS-i master Master_1 AS-i master 1
Master_2 AS-i master 2
enAuto_Address_Mode ASI_ADDRESS_MODE Parameter Auto_address_disable Automatic
activates/deactivates the addressing inactive
automatic addressing mode.
Auto_address_enable Automatic
addressing active

89
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Output parameters
17017

Parameter Data type Description Possible values


xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. 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 FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set

90
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Set_ASi_Config
16019

Function block type: Function block (FB)


Library: ACnnnn_Utils.library
Symbol in CODESYS:

>

Description
16149

The FB activates/deactivates the parameters "double address recognition" and "earth fault detection"
for the selected AS-i master.
>

Input parameters
16150

Parameter Data type Description Possible values

xExecute BOOL Control execution of the FB FALSE Stop FB execution


TRUE Start one-time FB execution
enASi_Master ASI_MASTER Select AS-i master Master_1 AS-i master 1
Master_2 AS-i master 2
xDoubleAdrDetection BOOL Activate/deactivate "Double address FALSE Double address recognition
recognition" inactive
TRUE Double address recognition
active
xEarthFaultDetection BOOL Activate/deactivate "Earth-fault FALSE Earth-fault detection inactive
detection"
TRUE Earth-fault detection active

91
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Output parameters
17015

Parameter Data type Description Possible values


xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. 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 FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set
 0x0001 Wrong parameter transferred, setting was not adopted.

92
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Set_LPS
16020

Function block type: Function block (FB)


Library: ACnnnn_Utils.library
Symbol in CODESYS:

>

Description
16153

The FB changes the list of projected slaves (LPS) in the selected AS-i master.
>

Input parameters
16154

Parameter Data type Description Possible values


xExecute BOOL Control execution of the FB FALSE Stop FB execution
TRUE Start one-time FB execution
enASi_Master ASI_MASTER Select AS-i master Master_1 AS-i master 1
Master_2 AS-i master 2
dwLPS_SA_Slaves DWORD List of the projected S/A slaves. Each Per bit:
bit represents an AS-i address:
 Bit 0 (LSB) = address 0 0 Slave not projected
...
1 Slave projected
 Bit 31 (MSB) = address 31/31A
dwLPS_B_Slaves DWORD List of the projected B slaves. Each bit Per bit:
represents an AS-i address:
0 slave not projected
 Bit 0 (LSB) = not used
 Bit 1 = address 1B 1 slave projected
...
 Bit 31 (MSB) = address 31B

93
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Output parameters
17016

Parameter Data type Description Possible values


xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. 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 FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set
 0x0019 Master not in the projecting mode

94
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Set_Mode
16021

Function block type: Function block (FB)


Library: ACnnnn_Utils.library
Symbol in CODESYS:

>

Description
16155

The FB changes the operating mode (protected operation, projection mode) of the selected AS-i
master.
>

Input parameters
16156

Parameter Data type Description Possible values

xExecute BOOL Control execution of the FB FALSE Stop FB execution


TRUE Start one-time FB execution
enASi_Master ASI_MASTER Select AS-i master Master_1 AS-i master 1
Master_2 AS-i master 2
enMode_ASi_Master ASI_MASTER_ Operating mode of the AS-i master Closed_ protected mode active
MODE mode
Project_ projection mode active
mode

95
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Output parameters
17018

Parameter Data type Description Possible values

xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. 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 FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set
 0x0003 Slave with address 0 found (slave not detected)

96
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Set_PCD
16022

Function block type: Function block (FB)


Library: ACnnnn_Utils.library
Symbol in CODESYS:

>

Description
16151

The FB changes the configuration file (Permanent Configuration Data = PCD) of the slaves at the
selected AS-i master.
>

Input parameters
16160

Parameter Data type Description Possible values

xExecute BOOL Control execution of the FB FALSE Stop FB execution


TRUE Start one-time FB execution
enASi_Master ASI_MASTER Select AS-i master Master_1 AS-i master 1
Master_2 AS-i master 2
awPCD ARRAY [0...63] Permanent configuration files of the per word:
OF WORD slaves on the selected AS-i master Bits 0...3: I/O-Code
Bits 4...7: ID-Code
Bits 8-11: ID1-Code
Bits 12-15: ID2-Code
Data in Word 0 is invalid!

97
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Output parameters
15574

Parameter Data type Description Possible values


xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. 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 FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set
 0x0019 Master not in the projecting mode

98
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Set_ProjectAll
16023

Function block type: Function block (FB)


Library: ACnnnn_Utils.library
Symbol in CODESYS:

>

Description
16161

The FB starts the projection adaptation on the selected AS-i master.


>

Input parameters
16125

Parameter Data type Description Possible values


xExecute BOOL Control execution of the FB FALSE Stop FB execution
TRUE Start one-time FB execution
enASi_Master ASI_MASTER Select AS-i master Master_1 AS-i master 1
Master_2 AS-i master 2

>

Output parameters
17020

Parameter Data type Description Possible values


xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. 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 FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set
 0x0003 Slave with address 0 found (slave not detected)
 0x0019 Master not in the projecting mode

99
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Set_SlaveAddress
16024

Function block type: Function block (FB)


Library: ACnnnn_Utils.library
Symbol in CODESYS:

>

Description
16162

The FB changes the address of the selected AS-i slaves.


>

Input parameters
16165

Parameter Data type Description Possible values

xExecute BOOL Control execution of the FB FALSE Stop FB execution


TRUE Start one-time FB execution
enASi_Master ASI_MASTER Select AS-i master Master_1 AS-i master 1
Master_2 AS-i master 2
enASi_Slave ASI_SLAVE Address of the AS-i slave Slave_n AS-i slave to address n
(n = 1 ... 31)
enASi_SlaveTyp ASI_SLAVE_ Type of the AS-i slave SA_Slave Single or A slave
TYP
B_Slave B-Slave
enASi_Slave_new ASI_SLAVE New address of the AS-i slave Slave_n AS-i slave at address n
(n = 1 ... 31)
enASi_SlaveTyp_new ASI_SLAVE_ New type of the AS-i slave SA_Slave single slave or A slave
TYP
B_Slave B slave

100
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Output parameters
17021

Parameter Data type Description Possible values


xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. 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 FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set
 0x0001 Slave does not respond or change to offline mode during FB execution
 0x0002 Slave with old address not found (slave not detected)
 0x0003 Slave with address 0 found (slave not detected)
 0x0004 Slave with new address found
 0x0005 Error during deletion of the old address (Delete Error)
 0x0006 ExtendedID1 could not be read after writing (Read Error)
 0x0007 Error when writing ExtendedID1 (Set Error)
 0x0008 New address temporary stored
 0x0009 ExtendedID1 stored temporarily
 0x0018 Master is not in normal operation.

101
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Set_SlaveExtendedID1
16025

Function block type: Function block (FB)


Library: ACnnnn_Utils.library
Symbol in CODESYS:

>

Description
16169

The FB changes the Extended ID1 of the selected AS-i slave.


>

Input parameters
16170

Parameter Data type Description Possible values

xExecute BOOL Control execution of the FB FALSE Stop FB execution


TRUE Start one-time FB execution
enASi_Master ASI_MASTER Select AS-i master Master_1 AS-i master 1
Master_2 AS-i master 2
enASi_Slave ASI_SLAVE Address of the AS-i slave Slave_n AS-i slave to address n
(n = 1 ... 31)
enASi_SlaveTyp ASI_SLAVE_ Type of the AS-i slave SA_Slave Single or A slave
TYP
B_Slave B-Slave
bExtendedID1 BYTE Extended ID1 code of the selected Extended ID1 code
AS-i slave (hexadecimal representation)

102
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Output parameters
16148

Parameter Data type Description Possible values


xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. 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 FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set
 0x0003 Slave with address 0 found (slave not detected)
 0x0005 Error during deletion of the old address (Delete Error)
 0x0006 ExtendedID1 could not be read after writing (Read Error)
 0x0007 Error when writing ExtendedID1 (Set Error)
 0x0009 ExtendedID1 stored temporarily
 0x000E Invalid slave address (e.g. 0 or 0B specified)
 0x0018 Master is not in normal operation.
 0x0021 Invalid ExtendedID1 code

103
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Set_SlaveParameter
16026

Function block type: Function block (FB)


Library: ACnnnn_Utils.library
Symbol in CODESYS:

>

Description
16172

The FB changes the parameters of the selected AS-i slave.


>

Input parameters
16173

Parameter Data type Description Possible values

xExecute BOOL Control execution of the FB FALSE Stop FB execution


TRUE Start one-time FB execution
enASi_Master ASI_MASTER Select AS-i master Master_1 AS-i master 1
Master_2 AS-i master 2
enASi_Slave ASI_SLAVE Address of the AS-i slave Slave_n AS-i slave to address n
(n = 1 ... 31)
enASi_SlaveTyp ASI_SLAVE_ Type of the AS-i slave SA_Slave Single or A slave
TYP
B_Slave B-Slave
enASi_SlaveParam BYTE Parameters of the selected AS-i slave Slave parameters
(hexadecimal representation)

104
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Output parameters
17025

Parameter Data type Description Possible values

xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. 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 FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set
 0x0001 Slave does not respond or change to offline mode during FB execution
 0x000A Sslave not in LAS
 0x000B Data content invalid (e.g. parameter value >7 for A/B slaves)
 0x000E Invalid slave address (e.g. 0 or 0B specified)
 0x0018 Master is not in normal operation.

105
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Get_ASi_Data
16000

Function block type: Function block (FB)


Library: ACnnnn_Utils.library

Symbol in CODESYS:

>

Description
16033

The FB reads the following data from the selected AS-i master and stores the values in a structure
variable of data type ASI_DATA (→ ASI_DATA (STRUCT) (→ p. 117)):
 List of activated slaves – LAS
 List of detected slaves – LDS
 List of projected slaves – LPS
 List of configuration errors – LCE
 List of configuration errors - additional slave – LCEAS
 List of configuration errors - missing slave – LCEMS
 List of peripheral faults – LPF
 List of double address errors – LDAE
 Configuration data image – CDI
 Projected configuration data – PCD
 Input parameters of the AS-i slaves
 Outputs parameters of the AS-i slaves
>

Input parameters
16034

Parameter Data type Description Possible values


xEnable BOOL Control activiy of the FB TRUE FB is enabled
FALSE FB is disabled
enASi_Master ASI_MASTER Select AS-i master Master_1 AS-i master 1
Master_2 AS-i master 2
pASi_Data POINTER TO Structure variable in which the read Variable must be declared!
ASI_DATA data is to be stored.

106
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Output parameters
16035

Parameter Data type Description Possible values


xActive BOOL Signal confirms the FB execution FALSE Function block is inactive
TRUE FB is active (=is executed)
wCycleCount WORD Counter for FB cycles that were fully Number in hexadecimal representation
run through
xError BOOL Signal indicates if errors occurred FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set
 0xnF01 Unknown error 1
 0xnF02 Unknown/invalid target 1
 0xnF03 Unknown command ID 1
 0xnF04 Unknown parameters 1
 0xnF05 Timeout during processing 1
Legend:
1
Get_ASi_Data executes the FB ACnnnn_SysCmd sequentially with different command IDs in order to determine the individual
elements of the complex variable. In the returned error code, the nibble n indicates the command request where the error
occurred. n can have the following values:
1 = error with "Get LAS, LDA, LPF, LCE"
2 = error with "Get LPS"
3 = error with "Get CDI"
4 = error with "Get PCD"
5 = error with "Get Input Parameter"
6 = error with "Get Output Parameter"
7 = error with "Get LCEMS, LCEAS, LDAE"

107
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

9.1.2 Overview: System functions (FB_System)

Get_FieldbusInfo ..................................................................................................................................109
QuickSetupASi_Master ........................................................................................................................111
Set_TimeDate .......................................................................................................................................113
17460

108
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Get_FieldbusInfo
17453

Function block type: Function block (FB)


Library: ACnnnn_Utils.library
Symbol in CODESYS:

>

Description
17454

The FB reads information about the fieldbus and provides the values in a list. The following information
are read:
 Status of the fieldbus
 Fieldbus type
 Status of the Ethernet connection at port X6 and X7
 MAC addresses
 IP address of the fieldbus host
>

Input parameters
17455

Parameter Data type Description Possible values


xExecute BOOL Control execution of the FB FALSE Stop FB execution
TRUE Start one-time FB execution

109
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Output parameters
17456

Parameter Data type Description Possible values


aw_InfoList ARRAY[0...18] Fieldbus information Position of the data within the individual
OF WORD words → DS18: Fieldbus information
xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. 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 FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set
 0x0F01 Unknown error
 0x0F02 Unknown/invalid target
 0x0F03 Unknown command ID
 0x0F04 Invalid parameters
 0x0F05 Timeout during processing

110
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

QuickSetupASi_Master
15999

Function block type: Function block (FB)


Library: ACnnnn_Utils.library
Symbol in CODESYS:

>

Description
15902

The FB executes the quick setup routine on the selected AS-i masters.
>

Input parameters
15903

Parameter Data type Description Possible values


xExecute BOOL Control execution of the FB FALSE Stop FB execution
TRUE Start one-time FB execution
xMaster1 BOOL Select AS-i master 1 for quick setup FALSE No execution of quick setup,
AS-i configuration remains
unchanged.
TRUE Execution of quick set up on
AS-i master
xMaster2 BOOL Select AS-i master 2 for quick setup FALSE No execution of quick setup,
AS-i configuration remains
unchanged.
TRUE Execution of quick set up on
AS-i master

111
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Output parameters
15920

Parameter Data type Description Possible values


xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. 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 FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set
 0x0003 Slave with address 0 found (slave not detected)

112
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Set_TimeDate
15998

Function block type: Function block (FB)


Library: ACnnnn_Utils.library
Symbol in CODESYS:

>

Description
15949

The FB sets the system time (time and date) of the device using the transmitted input values.
>

Input parameters
15988

Parameter Data type Description Possible values


xExecute BOOL Control execution of the FB FALSE Stop FB execution
TRUE Start one-time FB execution
bDay BYTE Day 0x01 1
... ...
0x1F 31
bMonth BYTE Month 0x01 January
... ...
0x0C December
wYear WORD Year 0x07B3 1971
... ...
0x07F5 2037
bHour BYTE Hour 0x00 0
... ...
0x17 23
bMinute BYTE Minute 0x00 0
...
0x3B 59
bSecond BYTE Second 0x00 0
...
0x3B 59

113
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Output parameters
15990

Parameter Data type Description Possible values


xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. 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 FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
wDiagnostic WORD Diagnostic information → List below (Diagnostic codes)

Diagnostic codes:
 0x0000 No specific error is set
 0x0001 Transferred values for date/time are invalid and could not be set.
 0x0002 NTP active, time could not be adopted.

114
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

9.1.3 Enumeration types and complex variables

Enumeration types (ENUM)..................................................................................................................115


Complex variables (STRUCT) ..............................................................................................................117
15986

In addition to the standard data types, the CODESYS package from ifm electronic also features the
following enumeration types (ENUM) and complex variables (STRUCT):
>

Enumeration types (ENUM)


16176

The library ACnnnn_Utils provides the following enumeration types (ENUM):


>

ASI_ADDRESS_MODE (ENUM)
16177

Designation Description Variable Data type Value

ASI_ADDRESS_MODE AS-i autoaddressing mode  Auto_address_enable INT 0


 Auto_address_disable INT 1

>

ASI_MASTER (ENUM)
16178

Designation Description Variable Data type Value


ASI_MASTER Identifier for AS-i masters  Master_1 INT 1
 Master_2 INT 2

>

ASI_MASTER_MODE (ENUM)
16179

Designation Description Variable Data type Value


ASI_MASTER_MODE Operating mode of the AS-i master  Closed_mode INT 0
 Project_mode INT 1

115
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

ASI_SLAVE (ENUM)
16180

Designation Description Variable Data type Value

ASI_SLAVE Identifier for AS-i slaves  Slave_1 INT 1

 Slave_2 INT 2
 Slave_3 INT 3
 Slave_4 INT 4
 Slave_5 INT 5
 Slave_6 INT 6
 Slave_7 INT 7
 Slave_8 INT 8
 Slave_9 INT 9
 Slave_10 INT 10
 Slave_11 INT 11
 Slave_12 INT 12
 Slave_13 INT 13
 Slave_14 INT 14
 Slave_15 INT 15
 Slave_16 INT 16
 Slave_17 INT 17
 Slave_18 INT 18
 Slave_19 INT 19
 Slave_20 INT 20
 Slave_21 INT 21
 Slave_22 INT 22
 Slave_23 INT 23
 Slave_24 INT 24
 Slave_25 INT 25
 Slave_26 INT 26
 Slave_27 INT 27
 Slave_28 INT 28
 Slave_29 INT 29
 Slave_30 INT 30
 Slave_31 INT 31

>

ASI_SLAVE_TYP (ENUM)
16181

Designation Description Variable Data type Value


ASI_SLAVE_TYP Type of the AS-i slave  SA_Slave INT 0

 B_Slave INT 1

116
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

Complex variables (STRUCT)


15991

The library ACnnnn_Utils.library provides complex variables of the data type STRUCT. They are
used by the FBs, but they can also be used by the programmer in CODESYS projects for the
device-internal SPS.
>

ASI_DATA (STRUCT)
15992

117
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

Name Data type Description Possible values

 LDS_SA_Slave DWORD List of the active S/A slaves


Each bit represents an AS-i address:
0 = no slave active
1 = slave active
 LDS_B_Slave DWORD List of active B slaves → DS9 – Slave lists LAS, LDS, LPF, LCE,
words 4...7

 LAS_SA_Slave DWORD List of active S/A slaves


Each bit represents an AS-i address:
0 = no active slave
1 =active slave
 LAS_B_Slave DWORD List of active B slaves → DS9 – Slave lists LAS, LDS, LPF, LCE, words
0...3

 LPF_SA_Slave DWORD List of peripheral faults (S/A slaves) Each bit represents an AS-i address:
0 = no peripheral fault
1 = peripheral fault
→ DS9 – Slave lists LAS, LDS, LPF, LCE,
 LPF_B_Slave DWORD List of peripheral faults (B slaves) words 8...11

 LCE_SA_Slave DWORD List with configuration errors (S/A Each bit represents an AS-i address:
slaves) 0 = no configuration error
1 = configuration error
→ DS9 – Slave lists LAS, LDS, LPF, LCE,
 LCE_B_Slave DWORD List with configuration errors (B words 12...15
slaves)

 LPS_SA_Slave DWORD List of projected S/A slaves


Each bit represents an AS-i address:
0 = no projected slave
1 = projected slave
 LPS_B_Slave DWORD List of active B slaves
→ DS10 – Slave list LPS

 LCEMS_SA_Slave DWORD List of configuration errors: Each bit represents an AS-i address:
projected, but missing S/A slave 0 = no configuration error
1 = configuration error
 LCEMS_B_Slave DWORD List of configuration errors:
projected, but missing B slave → DS17 – AS-i master: Error lists LCEMS,
LCEAS, LDAE, words 0...3
 LCEAS_SA_Slave DWORD List of configuration errors:
additional S/A slave Each bit represents an AS-i address:
0 = no error
1 = error
 LCEAS_B_Slave DWORD List of configuration errors: → DS17 – AS-i master: Error lists LCEMS,
additional B slave LCEAS, LDAE, words 4...7

 LDAE_SA_Slave DWORD List of double address errors (S/A Each bit represents an AS-i address:
slaves) 0 = no double address error
1 = double address error
→ DS17 – AS-i master: Error lists LCEMS,
 LDAE_B_Slave DWORD List of double address errors (B LCEAS, LDAE, words 8...11
slaves)

 CDI ARRAY[0..63] Image of the current configuration One word is available per slave:
OF WORD data Bits 0...3 = IO code
(CDI = Configuration Data Image) Bits 4...7 = ID code
Bits 8...11 = Extended ID1 code
Bits 12...15 = Extended ID2 code
→ DS11 – Actual configuration data (CDI)

118
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

Name Data type Description Possible values

 PCD ARRAY[0..63] Image of the projected Each word contains data of one slave:
OF WORD configuration data Bits 0...3 = IO
(PCD = Projected Configuration Bits 4...7 = ID
Data) Bits 8...11 = ID1
Bits 12...15 = ID2
→ DS12 – Projected configuration data (PCD)
 InputParam_SA_Slave ARRAY[0..31] Input parameters of the S/A slaves Each byte contains parameters of one S/A
OF BYTE slave:
Bits 0...3 = P0-P3
Bits 4...7 = reserved
→ DS13 – Image of the input parameters of the
slaves (PI), words 0...15
 InputParam_B_Slave ARRAY[0..31] Input parameters of the B slaves Each byte contains parameters of one B
OF BYTE slave:
Bits 0...3 = P0-P3
Bits 4...7 = reserved
→ DS13 – Image of the input parameters of the
slaves (PI), words 16...31
 OutputParam_SA_Slave ARRAY[0..31] Output parameters of the S/A Each byte contains parameters of one S/A
OF BYTE slaves slave:
Bits 0...3 = P0-P3
Bits 4...7 = reserved
→ DS14 – Image of the output parameters of the
slaves (PP), words 0...15
 OutputParam_B_Slave ARRAY[0..31] Output parameters of the B slaves Each byte contains parameters of one B
OF BYTE slave:
Bits 0...3 = P0-P3
Bits 4...7 = reserved
→ DS14 – Image of the output parameters of the
slaves (PP), words 16...31

119
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

ASI_NET (STRUCT)
15993

The structure contains the complete process image (inputs and outputs) of an AS-i network.

Name Data type Description Possible values

 binIO ASI_BIN_IO Binary input and output data → ASI_BIN_IO (STRUCT) (→ p. 120)
 anaIO ASI_ANA_IO Analogue input and output data → ASI_ANA_IO (STRUCT) (→ p. 121)
-
>

ASI_BIN_IO (STRUCT)
16002

The structure contains the process data of the digital input and output slaves:

Name Data type Description Possible values


 bin_IN_Slaves ASI_BIN_IN Input data of the digital AS-i slaves → ASI_BIN_IN (STRUCT) (→ p. 120)
 bin_OUT_Slaves ASI_BIN_OUT Output data of the digital AS-i →-ASI_BIN_OUT (STRUCT) (→ p. 120)
slaves

>

ASI_BIN_IN (STRUCT)
16004

The structure contains the input data of the digital AS-i slaves:

Name Data type Description Possible values

 SA_Slave ARRAY[1...31] Input data of the digital S/A slaves, corresponds to the 1st to 15th word of the
OF BYTE 1 byte per S/A slave acyclic data record 2 (DS2)
→ DS2 – Digital inputs of the slaves and master
flags
 B_Slave ARRAY[1...31] Input data of the digital B slaves, corresponds to the 16th to 31st word of the
OF BYTE 1 byte per B slave acyclic data record 2 (DS2)
→ DS2 – Digital inputs of the slaves and master
flags

>

ASI_BIN_OUT (STRUCT)
16003

The structure contains the output data of the digital AS-i slaves.

Name Data type Description Possible values


 SA_Slave_bin_OUT ARRAY[1...31] Output data of the digital S/A slaves corresponds to the 1st to 15th word of the
OF BYTE (1 byte per S/A slave) acyclic data record 5 (DS5)
→ DS5 – Digital outputs of the slaves
 B_Slave_bin_OUT ARRAY[1...31] Output data of the digital B slaves corresponds to the 16th to 31st word of the
OF BYTE (1 byte per B slave) acyclic data record 5 (DS5)
→ DS5 – Digital outputs of the slaves

120
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

ASI_ANA_IO (STRUCT)
16001

The structure contains the process data of the analogue input and output slaves.

Name Data type Description Possible values

 ana_IN_Slave ARRAY[1..31] OF Input data and status flags of the → ASI_ANALOG_IN (STRUCT) (→ p. 121)
ASI_ANALOG_ analogue AS-i slaves
IN
 ana_OUT_Slave ARRAY[1..31] OF Output data and status flags of the → ASI_ANALOG_OUT (STRUCT) (→ p. 122)
ASI_ANALOG_OUT analogue AS-i slaves

>

ASI_ANALOG_IN (STRUCT)
15994

The structure contains the process data of the analogue input slave as well as the transmitted status
flags.

Designation Data type Description Possible values


 chan_1 INT Analogue value channel 1: corresponds to the 1st to 4th word of an
S or A input slave area comprising 5 words in the acyclic data
records 3 and 4 (DS3+4)
 chan_2 INT Analogue value channel 2:
S or A input slave → DS3 – Analogue inputs of slaves 1(A)...15(B)
→ DS4 – Analogue inputs of slaves 16(A)...31(B)
 chan_3 INT Analogue value channel 3:
S or B input slave
 chan_4 INT Analogue value channel 4:
S or B input slave
 flags ASI_ANALOG_OUT_ Status flags → ASI_ANALOG_IN_FLAGS (STRUCT)
FLAGS (→ p. 122)

121
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

ASI_ANALOG_IN_FLAGS (STRUCT)
15996

The structure contains the status flags of the analogue input slave.

Name Data type Description Possible values

 V0 BOOL Valid bit, channel 1 corresponds to the fifth word of an area


comprising 5 words in the acyclic data
 O0 BOOL Overflow bit, channel 1 records 3 and 4 (DS3+4)
 V1 BOOL Valid bit, channel 2 → DS3 – Analogue inputs of slaves 1(A)...15(B)
→ DS4 – Analogue inputs of slaves 16(A)...31(B)
 O1 BOOL Overflow bit, channel 2
 V2 BOOL Valid bit channel 3
 O2 BOOL Overflow bit, channel 3
 V3 BOOL Valid bit, channel 4
 O3 BOOL Overflow bit, channel 5
 na1 BOOL --
 TOA BOOL Transfer output, S/A slave
 na2 BOOL --
 TOB BOOL Transfer output, B slave
 na3 BOOL --
 TIA BOOL Transfer input, S/A slave
 na4 BOOL --
 TIB BOOL Transfer input, B slave

>

ASI_ANALOG_OUT (STRUCT)
15995

The structure represents the process data of the analogue output slaves as well as the transmitted
flags.

Designation Data type Description Possible values


 chan_1 INT Analogue value channel 1: corresponds to the acyclic data records 6
S or A output slave and 7 (DS6, DS7)
 chan_2 INT Analogue value channel 2: → DS6 – Analogue outputs of slaves 1(A)...15(B)
S or A output slave → DS7 – Analogue outputs of slaves
16(A)...31(B)
 chan_3 INT Analogue value channel 3:
S or B output slave
 chan_4 INT Analogue value channel 4:
S or B output slave
 flags ASI_ANALOG_OUT_ Status flags →-ASI_ANALOG_OUT_FLAGS (STRUCT)
FLAGS (→ p. 123)

122
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_Utils.library

>

ASI_ANALOG_OUT_FLAGS (STRUCT)
15997

The structure contains the status flags of the analogue output slave.

Name Data type Description Possible values

 na1 BOOL -- corresponds to the acyclic data record 8


(DS8)
 na2 BOOL --
→ DS8 – Status flags of analogue output data of
 na3 BOOL -- the slaves 1...31

 na4 BOOL --
 na5 BOOL --
 na6 BOOL --
 na7 BOOL --
 na8 BOOL --
 OVA BOOL Output valid, S/A slave
 na9 BOOL --
 OVB BOOL Output valid, B slave
 n10 BOOL --
 TOA BOOL Transfer Output, S/A slave
 na11 BOOL --
 TOB BOOL Transfer Output, B slave
 na12 BOOL --

123
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_SYS_CMD.library

>

9.2 Library ACnnnn_SYS_CMD.library

ACnnnn_SysCmd .................................................................................................................................125
17723

124
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_SYS_CMD.library

>

9.2.1 ACnnnn_SysCmd
15890

Function block type: Function block (FB)


Library: ACnnnn_SYS_CMD.library

Symbol in CODESYS:

>

Description
15893

Using the FB, individual commands can be sent to the system or to an AS-i master.
Each command refers to the data structures of one of the following elements:
 Command request channel: → Example: Change language setting of the device (→ p. 130)
 Command response channel: → Example: Date / time / read NTP settings (→ p. 131)
 Acyclic data record (DSx): → Example: Read LCEMS, LCEAS and LDAE of AS-i master 2 (→ p. 132)
>

Input parameters
15895

Parameter Data type Description Possible values

xExecute BOOL Control execution of the FB FALSE Stop FB execution


TRUE Start one-time FB execution
uCommandID WORD ID of the command to be executed → Table: System commands (→ p. 126)
→ Table: AS-i master commands (→ p. 127)
uTarget INT Device component to which the 0 system
command is to be sent
1 AS-i master 1
2 AS-i master 2
pDataIn POINTER TO Buffer for data that is assigned to the Commando parameter described in the
WORD command as input parameters. command request channel (word 3 to 120)
uSizeIn WORD Size of the buffer for the input
parameters (number of bytes)
pDataOut POINTER TO Buffer for data that is returned as Return values described in the command
WORD output parameters (results) reply channel (data as of word 5)
uSizeOut WORD Size of the buffer for the output
parameters (number of bytes)

125
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_SYS_CMD.library

>

Table: System commands


17053

uCommandID Description
0x0001 DS1 – System information
0x1101 Command 0x0101 – Quick set-up AS-i masters 1 + 2
0x1103 Command 0x0103 – Select user language
0x1104 Command 0x0104 – Change display settings
0x1105 Command 0x0105 – Set output control
0x1109 Command 0x0109 – Set date / time
0x110A Command 0x010A – Configure the NTP server settings
0x110B Command 0x010B – Read date / time / NTP settings
0x110C Command 0x010C – Reboot system
0x110D Command 0x010D – Read fieldbus info
0x1110 Command 0x0110 - Display target visualisation

Only execute system commands with the input parameter uTarget = 0!

Detailed information about the acyclic data sets and the command interface is given in the
supplement to the device manual of the SmartSPS DataLine AC14 (→ Overview: User
documentation for SmartPLC DataLine AC14 (→ p. 5)).

126
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_SYS_CMD.library

>

Table: AS-i master commands


17054

uCommandID Description / corresponding command


0x0002 DS2 – Digital slave inputs and master flags
0x0003 DS3 – Analogue inputs of the slaves 1(A)...15(B)
0x0004 DS4 – Analogue inputs of the slaves 16(A)...31(B)
0x0005 DS5 – Digital slave outputs
0x0006 DS6 – Analogue outputs of the slaves 1(A)...15(B)
0x0007 DS7 – Analogue outputs of the slaves 16(A)...31(B)
0x0008 DS8 – Status flags of the analogue outputs of slaves 1...31
0x0009 DS9 – Slave lists LAS, LDS, LPF, LCE
0x000A DS10 – Slave list LPS
0x000B DS11 – Current configuration data (CDI)
0x000C DS12 – Projected configuration data (PCD)
0x000D DS13 – Image of the input parameters of the slaves (PI)
0x000E DS14 – Image of the outputs parameters of the slaves (PP)
0x000F DS15 – Slave error counter, configuration error counter, AS-i cycle counter
0x0011 DS17 – AS-i master: Error lists LCEMS, LCEAS, LDAE
0x1001 Command 0x0001 – Change AS-i slave parameters
0x1003 Command 0x0003 – Project current AS-i network
0x1004 Command 0x0004 – Change LPS
0x1005 Command 0x0005 – Change the operating mode of the AS-i master
0x1006 Command 0x0006 – Change AS-i slave address
0x1007 Command 0x0007 - Set auto address mode of the AS-i master
0x1009 Command 0x0009 – Change extended ID1 in the AS-i slave
0x100A Command 0x000A - Change PCD
0x100D Command 0x000D – AS-i master supply voltage, symmetry, earth fault
0x1015 Command 0x0015 – Read ID string of an AS-i profile (S-7.4)
0x101A Command 0x001A – Read AS-i master info
0x101C Command 0x001C – Deactivate slave reset when changing to the protected mode
0x1021 Command 0x0021 - Read diagnostics string of an AS-i slave (S-7.4)
0x1022 Command 0x0022 - Read parameter string of an AS-i slave (S-7.4)
0x1023 Command 0x0022 - Write parameter string of an AS-i slave (S-7.4)
0x1024 Command 0x0024 – CTT2 standard read
0x1025 Command 0x0025 – CTT2 standard write
0x1026 Command 0x0026 – CTT2 vendor specific read
0x1027 Command 0x0027 – CTT2 vendor specific selective write
0x1040 Command 0x0040 – CTT2 device group read
0x1041 Command 0x0041 – CTT2 device group write
0x1042 Command 0x0042 – CTT2 vendor specific selective read from buffer
0x1043 Command 0x0043 – CTT2 vendor specific selective write from buffer

127
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_SYS_CMD.library

uCommandID Description / corresponding command

0x1044 Command 0x0044 – CTT2 vendor specific selective read


0x1045 Command 0x0045 – CTT2 vendor specific selective write
0x1046 Command 0x0046 – CTT2 device group selective read
0x1047 Command 0x0047 – CTT2 device group selective write
0x1049 Command 0x0049 – CTT2 vendor specific exchange
0x104A Command 0x004A – CTT2 device group exchange
0x104B Command 0x004B – CTT2 device group selective read from buffer
0x104C Command 0x004C – CTT2 device group selective write from buffer
0x1050 Command 0x0050 – Set AS-i master settings
0x1051 Command 0x0051 – Reset error counter

Only execute AS-i master commands with input parameter uTarget = 1 or 2!

Detailed information about the acyclic data sets and the command interface is given in the
supplement to the device manual of the SmartSPS DataLine AC14 (→ Overview: User
documentation for SmartPLC DataLine AC14 (→ p. 5)).

128
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_SYS_CMD.library

>

Output parameters
15897

Parameter Data type Description Possible values

uCount WORD Number of valid bytes in pDataOut integer value in hexadecimal


(uCount <= uSizeOut) representation
xReady BOOL Signal indicates if the execution of the FALSE FB is inactive or being
FB is terminated. executed.
TRUE FB execution is terminated.
xError BOOL Signal indicates if errors occurred FALSE FB is disabled or presently
while the FB was executed. executed or FB was executed
without error.
TRUE An error occurred when the FB
was executed.
uErrorCode WORD Error code of the executed command Command error code of the corresponding
command channel
OR: → List below (Diagnostic codes)

Diagnostic codes:
 0xnF01 Unknown error 1
 0x0F02 Unknown/invalid target
 0x0F03 Unknown command ID
 0x0F04 Invalid parameters
 0x0F05 Timeout during processing

129
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_SYS_CMD.library

>

Example: Change language setting of the device


17051

Task: Set the language of the graphic user surface of the device to "Spanish" with the FB
ACnnnn_SysCmd.
Command type: Command request channel
Input parameters of the FB:
Parameter Value Explanation
uCommandID 0x1103 Corresponding commando channel:
→ Command 0x0103 – Select user language (→ device manual supplement)
uTarget 0 System command
pDataIn arDataIn  Variable of the data type Array of Words
 arDataIn contains the command parameters
uSizeIn 0x0001 arDataIn only consists of 1 line since word 1 and 2 as well as 4 to 120 of the command
request channel are not considered.
pDataOut -- irrelevant since command request channel
uSizeOut -- irrelevant since command request channel

Content of arDataIn:
Word no. Contents Explanation
1 0x4553 Spanish

130
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_SYS_CMD.library

>

Example: Date / time / read NTP settings


17423

Task: Read the current system time and the NTP settings with the FB ACnnnn_SysCmd.
Command type: Command reply channel
Input parameters of the FB:
Parameter Value Declaration

uCommandID 0x110B Corresponding commando channel:


→ Command 0x010B – Read date / time / NTP settings (→ device manual supplement)
uTarget 0 System command
pDataIn -- irrelevant, since command reply channel
uSizeIn -- irrelevant, since command reply channel
pDataOut arDataOut  variable of the data type Array of Words
 contains the return values of the reply channel
uSizeOut 0x0007 Array consists of 7 lines since the reply channel returns 7 words (words 5 ... 11).

Content of arDataOut:
Word no. Content

1 Month Day
2 Year Year
3 Minutes Hours
4 reserved Seconds
5 NTP offset NTP status
6 ... 7 IP address NTP server

131
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Appendix Library ACnnnn_SYS_CMD.library

>

Example: Read LCEMS, LCEAS and LDAE of AS-i master 2


17424

Task: Read the error lists LCEMS, LCEAS and LDAE of the AS-i master 2 with the FB
ACnnnn_SysCmd.
Command type: acyclic data set
Input parameters of the FB:
Parameter Value Declaration
uCommandID 0x0011 Corresponding acyclic data set:
→ DS17 – AS-i master: Error lists LCEMS, LCEAS, LDAE (→ device manual supplement)
uTarget 1 Master command (1 = AS-i master 2))
pDataIn -- irrelevant
uSizeIn -- irrelevant
pDataOut arDataOut  Variable of the data type Array of Words
 contains the return values
uSizeOut 0x000C Array consists of 12 lines since the data set DS17 has exactly 12 words

Content of arDataOut:
Word no. Content
1 ... 4 LCEMS (list of configuration errors - missing slaves)

5 ... 8 LCEAS (list of configuration errors - additional slaves)


9 ... 12 LDAE (list of double address errors)

132
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Index

Digital input and output data ..................................................................33


10 Index Digital output data ..................................................................................35
Display operating state of the application .............................................55
A Display target visualisation ....................................................................59
Display web visualisation.......................................................................59
Access input and output data ................................................................30
Download the application to the device .................................................53
ACnnnn_SysCmd ................................................................................125
Activate CODESYS SPS .......................................................................52 E
Add and configure EtherCAT slave .......................................................25
Add EtherCAT master ...........................................................................23 Enumeration types (ENUM).................................................................115
Add fieldbus stack..................................................................................26 Enumeration types and complex variables .........................................115
Add visualisation to a project .................................................................44 Example
Change language setting of the device ...................................................... 130
Analogue input and output data ............................................................33
Date / time / read NTP settings ................................................................... 131
Analogue output data ............................................................................35
Read LCEMS, LCEAS and LDAE of AS-i master 2 ................................... 132
Appendix ................................................................................................60
Extend fieldbus functionality ..................................................................22
ASI_ADDRESS_MODE (ENUM) ........................................................115
ASI_ANA_IO (STRUCT)......................................................................121 F
ASI_ANALOG_IN (STRUCT) ..............................................................121
FB with cyclic execution ........................................................................37
ASI_ANALOG_IN_FLAGS (STRUCT) ................................................122
FB with one-time execution ...................................................................36
ASI_ANALOG_OUT (STRUCT) ..........................................................122
Fieldbus data .........................................................................................34
ASI_ANALOG_OUT_FLAGS (STRUCT) ............................................123
ASI_BIN_IN (STRUCT) .......................................................................120 G
ASI_BIN_IO (STRUCT) .......................................................................120
ASI_BIN_OUT (STRUCT) ...................................................................120 General safety instructions ......................................................................7
ASI_DATA (STRUCT) .........................................................................117 Get_ASi_Data ......................................................................................106
ASI_MASTER (ENUM) ........................................................................115 Get_ASi_PHY_Dat ................................................................................63
ASI_MASTER_MODE (ENUM) ...........................................................115 Get_CDI .................................................................................................81
ASI_NET (STRUCT) ............................................................................120 Get_FieldbusInfo .................................................................................109
ASI_SLAVE (ENUM) ...........................................................................116 Get_InputParameter ..............................................................................85
ASI_SLAVE_TYP (ENUM) ..................................................................116 Get_LAS ................................................................................................65
Available fieldbus stacks .......................................................................22 Get_LCE ................................................................................................71
Get_LCEAS ...........................................................................................73
C Get_LCEMS...........................................................................................75
Get_LDAE ..............................................................................................77
Change IP settings ................................................................................21
Get_LDS ................................................................................................67
Change network settings .......................................................................39
Get_LPF.................................................................................................79
Change properties of the web visualisation ..........................................46
Get_LPS ................................................................................................69
Change system time of the device ........................................................29
Get_OutputParameter ...........................................................................87
Change the properties of the target visualisation ..................................47
Get_PCD................................................................................................83
CODESYS programming software ........................................................10
Getting started .......................................................................................14
Complex variables (STRUCT) .............................................................117
Components of the ifm package............................................................11 H
Configure AS-i master ...........................................................................38
Configure AS-i slaves ............................................................................38 Hardware .................................................................................................9
Configure EtherCAT master ..................................................................24 I
Configure main task...............................................................................48
Configure SPS .......................................................................................21 ifm AS-i Package ...................................................................................11
Configure system ...................................................................................37 ifm weltweit • ifm worldwide • ifm à l’échelle internationale.................135
Configure task processing .....................................................................48 Input and output data of the fieldbus interface ......................................34
Configure visualisation ..........................................................................46 Input parameters....63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89,
91, 93, 95, 97, 99, 100, 102, 104, 106, 109, 111, 113, 125
Control interface of the ifm function blocks ...........................................36
Install CODESYS Development System ...............................................10
Create a visualisation ............................................................................45
Install the ifm package ...........................................................................12
Create CODESYS project .....................................................................15
Installation ..............................................................................................10
Create new project with SmartPLC DataLine AC14 .............................16
Create SPS application .........................................................................28 L
D Legal and copyright information ..............................................................4
Library ACnnnn_SYS_CMD.library .....................................................124
Delete application from SmartPLC DataLine AC14 ..............................53
Library ACnnnn_Utils.library ..................................................................61
Delete boot application via SD card ......................................................54
Licensing ..................................................................................................9
Description 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93,
95, 97, 99, 100, 102, 104, 106, 109, 111, 113, 125

133
ifm Programming Manual SmartPLC DataLine AC14 (V4.2.x) 12/2017
Index

Software ...................................................................................................9
M SSC interface...........................................................................................4
Manage AS-i network ............................................................................39 Start SPS application.............................................................................56
Modification history ..................................................................................6 States of the SPS application ................................................................55
Stop SPS application .............................................................................56
O Supported programming languages ......................................................29
Objects of a PLC application .................................................................27 Supported reset variants .......................................................................57
Operating mode of the SPS...................................................................55 Supported visualisation types................................................................43
Operating states of the SPS ..................................................................55 Switch operating states .........................................................................56
Operation ...............................................................................................50 Symbols and styles used .........................................................................5
Options to access input and output data ...............................................30 System configuration .............................................................................21
Output parameters .64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, System requirements...............................................................................9
92, 94, 96, 98, 99, 101, 103, 105, 107, 110, 112, 114, 129
Outputs data of the AS-i slaves .............................................................35
T
Overview Table
AS-i functions (FB_ASi) ................................................................................ 62 AS-i master commands ............................................................................... 127
CODESYS documentation of 3S .................................................................... 6 System commands ...................................................................................... 126
Project structure with SmartPLC DataLine AC14 ......................................... 17 Testing the SPS application ..................................................................49
System functions (FB_System) .................................................................. 108 Transfer CODESYS project to device ...................................................51
User documentation for SmartPLC DataLine AC14 ....................................... 5
U
P
Uninstall the ifm package ......................................................................13
PI controller..............................................................................................4
Update ifm package ...............................................................................12
Preliminary note .......................................................................................4
Use CODESYS online help ...................................................................18
Process data of the AS-i slaves ............................................................32 Use complex variables ..........................................................................39
Programming .........................................................................................27 Use EtherCAT master ...........................................................................23
Purpose of the document ........................................................................4 Use functions of the ifm package ..........................................................36
Q Use remanent variables.........................................................................28
Use visualisations ..................................................................................43
QuickSetupASi_Master .......................................................................111
V
R
Validity of the interface data ..................................................................31
Read configuration data of the slaves ...................................................41
Read network settings ...........................................................................40 W
Read parameter images ........................................................................40
Warnings used .........................................................................................8
read slave lists .......................................................................................40
Read status of the voltage supply .........................................................41
Required background knowledge ............................................................7
Reset......................................................................................................57
Reset the application (cold) ...................................................................58
Reset the application (origin) .................................................................58
Reset the application (warm) .................................................................58

S
Safety instructions ...................................................................................7
Send commands to the system and the AS-i master ............................42
Set network path of SPS .......................................................................19
Set parameters for visualisation task ....................................................48
Set the programming interface ..............................................................19
Set_AddressMode .................................................................................89
Set_ASi_Config .....................................................................................91
Set_LPS .................................................................................................93
Set_Mode...............................................................................................95
Set_PCD ................................................................................................97
Set_ProjectAll ........................................................................................99
Set_SlaveAddress ...............................................................................100
Set_SlaveExtendedID1 .......................................................................102
Set_SlaveParameter............................................................................104
Set_TimeDate ......................................................................................113

134
11 ifm weltweit • ifm worldwide • ifm à l’échelle
internationale
Version: 2017-12-18 8310

ifm electronic gmbh • Friedrichstraße 1 • 45128 Essen


www.ifm.com • Email: [email protected]
Service hotline: 0800 / 16 16 16 (only Germany, Mo-Fr 07.00...18.00 h)
ifm Niederlassungen • Sales offices • Agences
D Niederlassung Nord • 31135 Hildesheim • Tel. 05121 7667-0
Niederlassung West • 45128 Essen • Tel. 0201 36475 -0
Niederlassung Mitte-West • 58511 Lüdenscheid • Tel. 02351 4301-0
Niederlassung Süd-West • 64646 Heppenheim • Tel. 06252 7905-0
Niederlassung Baden-Württemberg • 73230 Kirchheim • Tel. 07021 8086-0
Niederlassung Bayern • 82178 Puchheim • Tel. 089 80091-0
Niederlassung Ost • 07639 Tautenhain • Tel. 036601 771-0

AE ifm electronic FZC • Saif Zone, Sharjah • phone +971- 6-5573601


AR ifm electronic s.r.l. • 1107 Buenos Aires • phone +54 11 5353-3436
AT ifm electronic gmbh • 1120 Wien • phone +43 / 1 / 617 45 00
AU ifm efector pty ltd. • Mulgrave Vic 3170 • phone +61 1300 365 088
BE ifm electronic n.v./s.a. • 1731 Zellik • phone +32 2 481 0220
BG ifm electronic eood • 1202 Sofia • phone +359 2 807 59 69
BR ifm electronic Ltda. • 03337-000 Sao Paulo / SP • phone +55-11-2672-1730
CA ifm efector Canada inc. • Mississauga, ON L5N 2X7 • phone +1 855-436-2262
CH ifm electronic ag • 4624 Härkingen • phone +41 / 800 88 80 33
CL ifm electronic SpA • Oficina 5041 Comuna de Conchalí • phone +56-2-32239282
CN ifm electronic (Shanghai) Co. Ltd. • 201203 Shanghai • phone +86 21 3813 4800
CZ ifm electronic, spol. s.r.o. • 140 00 Praha 4 • phone +420 267 990 211
DK ifm electronic a/s • 2605 Brøndby • phone +45 70 20 11 08
ES ifm electronic s.a. • 08820 El Prat de Llobregat • phone +34 93 479 30 80
FI ifm electronic oy • 00440 Helsinki • phone +358 75 329 5000
FR ifm electronic s.a. • 93192 Noisy-le-Grand Cedex • phone +33 0820 22 30 01
GB ifm electronic Ltd. • Hampton, Middlesex TW12 2HD • phone +44 / 20 / 8213 0000
GR ifm electronic monoprosopi E.P.E. • 15125 Amaroussio • phone +30 210 61 800 90
HU ifm electronic kft. • 9028 Györ • phone +36-96 / 518-397
IN ifm electronic India Private Limited • Kolhapur, 416234 • phone +91 / 231 / 267 27 70
IE ifm electronic (Ireland) Ltd. • Dublin 22 • phone +353 / 1 / 461 32 00
IT ifm electronic s.r.l. • 20864 Agrate Brianza (MB) • phone +39 39-6899982
JP efector co., ltd. • Chiba-shi, Chiba 261-7118 • phone +81 043-299-2070
KR ifm electronic Ltd. • 04420 Seoul • phone +82 2-790-5610
MX ifm efector S. de R.L. de C.V. • San Pedro Garza Garcia, N.L. 66269 • phone +52-81-8040-3535
MY ifm electronic Pte. Ltd • 47100 Puchong, Selangor • phone +603 8066 9853
NA ifm elctronic (pty) Ltd • 25 Dr. W. Kulz Street Windhoek • phone +264 61 300984
NL ifm electronic b.v. • 3843 GA Harderwijk • phone +31 341-438 438
NZ ifm efector pty ltd • 930 Great South Road Penrose, Auckland • phone +64 / 95 79 69 91
PL ifm electronic sp. z o.o. • 40-106 Katowice • phone +48 32 70 56 400
PT ifm electronic s.a. • 4410-137 São Félix da Marinha • phone +351 223 71 71 08
RO ifm electronic s.r.l • Sibiu 557260 • phone +40 269 224 550
RU ifm electronic • 105318 Moscow • phone +7 495 921-44-14
SG ifm electronic Pte Ltd • 609 916 Singapore • phone +65 6562 8661
SK ifm electronic s.r.o. • 831 06 Bratislava • phone +421 244 872 329
SE ifm electronic ab • 412 50 Göteborg • phone +46 31-750 23 00
TR ifm electronic Ltd. Sti. • 34381 Sisli, Istanbul • phone +90 212 210 50 80
TW ifm electronic • Kaohsiung City, 806, Taiwan R.O.C. • phone +886 7 3357778
UA TOV ifm electronic • 02660 Kiew • phone +380 44 501-85-43
US ifm efector inc. • Malvern, PA 19355 • phone +1 800-441-8246
VN ifm electronic Vietnam Co., Ltd. • 700000 Ho Chi Minh City • phone +84-28-2253.6715
ZA ifm electronic (Pty) Ltd. • 0157 Pretoria • phone +27 12 450 0412
Technische Änderungen behalten wir uns ohne vorherige Ankündigung vor.
We reserve the right to make technical alterations without prior notice.
Nous nous réservons le droit de modifier les données techniques sans préavis.

You might also like