IFM Electronic AC1401, AC1411, AC1402, AC1412, AC1421 Programming Manual

...
Programming Manual
AS-i Gateway AC14
with fieldbus interfaces
AC1401/02 AC1411/12 AC1421/22
Firmware release: 4.2.x
CODESYS release: 3.5.9.73 or higher
English
ifm Programming Manual AS-i Gateway AC14 (4.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 AS-i Gateway 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 ............................................................................................................................10
4 Installation 11
4.1 CODESYS programming software .....................................................................................11
4.1.1 Install CODESYS Development System..................................................................................... 11
4.2 ifm AS-i Package................................................................................................................12
4.2.1 Components of the ifm package ................................................................................................. 12
4.2.2 Install the ifm package ................................................................................................................ 13
4.2.3 Update ifm package ................................................................................................................... 13
4.2.4 Uninstall the ifm package ........................................................................................................... 14
5 Getting started 15
5.1 Create CODESYS project ..................................................................................................16
5.1.1 Create new project with AS-i Gateway AC14 ............................................................................. 17
5.1.2 Overview: Project structure with AS-i Gateway AC14 ................................................................ 18
5.2 Use CODESYS online help ................................................................................................19
5.3 Set the programming interface ...........................................................................................20
5.3.1 Set communication path to PLC ................................................................................................. 20
6 System configuration 21
6.1 Configure PLC....................................................................................................................21
6.2 Configure Ethernet interface ..............................................................................................22
6.2.1 Available fieldbus stacks ............................................................................................................ 22
6.2.2 Add fieldbus stack ...................................................................................................................... 23
7 Programming 24
7.1 Objects of a PLC application ..............................................................................................24
7.2 Create PLC application ......................................................................................................25
7.2.1 Use remanent variables.............................................................................................................. 25
7.2.2 Supported programming languages ........................................................................................... 26
7.2.3 Change system time of the device ............................................................................................. 26
2
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
Content
7.3 Access input and output data .............................................................................................27
7.3.1 Options to access input and output data .................................................................................... 27
7.3.2 Validity of the interface data ....................................................................................................... 28
7.3.3 Process data of the AS-i slaves .................................................................................................. 29
7.3.4 Fieldbus data .............................................................................................................................. 31
7.4 Use functions of the ifm package .......................................................................................33
7.4.1 Control interface of the ifm function blocks ................................................................................. 33
7.4.2 Configure system ....................................................................................................................... 35
7.4.3 Configure AS-i master ................................................................................................................ 35
7.4.4 Configure AS-i slaves ................................................................................................................. 35
7.4.5 Manage AS-i network ................................................................................................................. 36
7.4.6 Send commands to the system and the AS-i master .................................................................. 39
7.5 Use visualisations ..............................................................................................................40
7.5.1 Supported visualisation types ..................................................................................................... 40
7.5.2 Add visualisation to a project ...................................................................................................... 41
7.5.3 Create a visualisation ................................................................................................................. 42
7.5.4 Configure visualisation ............................................................................................................... 43
7.6 Configure task processing .................................................................................................45
7.6.1 Configure main task ................................................................................................................... 45
7.6.2 Set parameters for visualisation task .......................................................................................... 45
7.7 Testing the PLC application ...............................................................................................46
8 Operation 47
8.1 Transfer CODESYS project to device ................................................................................48
8.1.1 Activate CODESYS PLC ............................................................................................................ 49
8.1.2 Download the application to the device ...................................................................................... 50
8.1.3 Delete application from AS-i Gateway AC14 .............................................................................. 50
8.1.4 Delete boot application via SD card ........................................................................................... 51
8.2 Operating states of the PLC ...............................................................................................52
8.2.1 Operating mode of the PLC ........................................................................................................ 52
8.2.2 States of the PLC application ..................................................................................................... 52
8.2.3 Switch operating states .............................................................................................................. 53
8.3 Reset ..................................................................................................................................54
8.3.1 Supported reset variants ............................................................................................................ 54
8.3.2 Reset the application (warm) ...................................................................................................... 55
8.3.3 Reset the application (cold) ........................................................................................................ 55
8.3.4 Reset the application (origin) ...................................................................................................... 55
8.4 Display web visualisation ...................................................................................................56
8.5 Display target visualisation ................................................................................................57
9 Appendix 58
9.1 Library ACnnnn_Utils.library ..............................................................................................59
9.1.1 Overview: AS-i functions (FB_ASi) ............................................................................................. 60
9.1.2 Overview: System functions (FB_System) ............................................................................... 106
9.1.3 Enumeration types and complex variables ............................................................................... 113
9.2 Library ACnnnn_SYS_CMD.library ..................................................................................121
9.2.1 ACnnnn_SysCmd ..................................................................................................................... 121
10 Index 129
11 ifm weltweit • ifm worldwide • ifm à l’échelle internationale 131
3
ifm Programming Manual AS-i Gateway AC14 (4.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 AS-i Gateway 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

This document applies to the following devices of the type"AS-i Gateway AC14":
AS-i Gateway AC14 with Profinet device interface (AC1401/AC1402)  AS-i Gateway AC14 with Profibus slave interface (AC1411/AC1412)  SmartSPS AC14 with EtherNet/IP device interface (AC1421/AC1422)
It is part of the device and contains information about the correct handling of the product.
Read this document before using the device. Keep this document during the service life of the device.
>
4
18872
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
Preliminary note Symbols and styles used

1.3 Symbols and styles used

...
Instructions
> ...
Reaction, result ...
Cross-reference or internet link
123 0x123 0b010
Decimal number Hexadecimal number Binary number
[...]
Designation of pushbuttons, buttons or indications
Document
Content / Description
Data sheet
Technical data of the device as a table
Operating instructions *
Notes on mounting and electrical installation of the device Set-up, description of the operating and display elements, maintenance information, scale
drawing
Device manual
Notes on operation of the device via GUI and web interface Error elimination Description of the fieldbus data
Supplement device manual
Description of the acyclic data sets and the command interface
Programming manual
Creation of a project with the device using CODESYS Configuration of the device using CODESYS Programming of the PLC of the device Description of the device-specific CODESYS function libraries
The user can download all documents from the ifm website.
>

1.4 Overview: User documentation for AS-i Gateway AC14

ifm electronic provides the following user documentation for the models of the device class "AS-i Gateway AC14":
13839
6998
*... The operating instructions are supplied with the device.
5
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
Preliminary note Overview: CODESYS documentation of 3S
>
Document
Content / Description
Online help
Context-sensitive help Description of the CODESYS programming system Description of components and function libraries
CODESYS installation and first steps
Remarks about the installing of the CODESYS programming system First steps for handling the CODESYS programming system
Version
Topic
Date
00
New creation of document
xx/201x

1.5 Overview: CODESYS documentation of 3S

18296
3S GmbH provides the following user documentation for programming PLC of AC4S:
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
6
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
Safety instructions General safety instructions

2 Safety instructions

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

2.1 General safety instructions

8516
Read this document before setting up the product and keep it during the entire service life. Only use the product for its intended purpose. If the operating instructions or the technical data are not adhered to, personal injury and/or damage to
property may occur. Improper or non-intended use may lead to malfunctions of the device, to unwanted effects in the
application or to a loss of the warranty claims. The manufacturer assumes no liability for any consequences caused by tampering with the device or
incorrect use by the operator.
Observe these operating instructions. Adhere to the warning notes on the product.
>

2.2 Required background knowledge

13323
This document is intended for people with knowledge of control technology and PLC programming to IEC 61131-3.
To program the PLC, these people should also be familiar with the CODESYS software. This document is intended for specialists. Specialists are people who, based on their relevant training
and experience, are capable of identifying risks and avoiding potential hazards that may be caused during operation or maintenance of the product. The document contains information about the correct handling of the product.
Read this document before use to familiarise yourself with operating conditions, installation and
operation. Keep this document during the entire duration of use of the device.
Follow the safety instructions.
213
7
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
Safety instructions Warnings used
>
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.

2.3 Warnings used

13685
8
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
System requirements Hardware

3 System requirements

Hardware .................................................................................................................................................. 9
Software.................................................................................................................................................... 9
Licensing.................................................................................................................................................10
Component
Description
Release
CODESYS Development System
Programming software CODESYS Development System für PLC programming according to norm IEC 61131-3
3.5 SP9 Patch 7 Hotfix 3
Package "CODESYS for ifm SmartPLC StandardLine"
Device and interface description of AS-i Gateway
AC14
Function libraries for programming of the PLC
1.6.4.14
The assured characteristics and functions described in this manuals are only accessible with the indicated releases of the software components!
ifm electronic provides the software components for downloading on its website: www.ifm.com > Service > Download > Industrial communication
>
16903

3.1 Hardware

16904
Device of the AS-i Gateway AC14 product family with firmware V4.2.x  PC/laptop for CODESYS development system ( system requirements CODESYS development
system V3.x)
Ethernet connection between CODESYS-PC/laptop and configuration interface (X3) of the device
>

3.2 Software

16905
To program the device-internal PLC of the AS-i Gateway AC14, the following software components are required:
9
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
System requirements Licensing
>
Article description
Article no.
1x CODESYS V3 license AS-i Gateway AC14
E71400
Use of the device-internal CODESYS PLC of AS-i Gateway AC14 without valid license constitutes a violation of applicable law!

3.3 Licensing

All models of the device family AS-i Gateway AC14, to be programmed using the CODESYS Development System 3.5 SP9 Patch 7 Hotfix 3, must be licensed. A valid license label can be purchased from ifm electronic.
16906
10
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
Installation CODESYS programming software

4 Installation

CODESYS programming software .........................................................................................................11
ifm AS-i Package ....................................................................................................................................12
>

4.1 CODESYS programming software

The CODESYS Development System (short: CODESYS) is a platform for the creation of PLC applications according to the standard IEC 61131-3.
>

4.1.1 Install CODESYS Development System

To install the software "CODESYS Development System":
Install the programming system CODESYS 3.5 SP9 Patch 7 Hotfix 3 ( CODESYS installation and first steps). > CODESYS 3.5 SP9 Patch 7 Hotfix 3 is installed on the programming PC/laptop.
17146
7282
18596
11
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
Installation ifm AS-i Package
>
Components of the ifm package .............................................................................................................12
Install the ifm package ............................................................................................................................13
Update ifm package ................................................................................................................................13
Uninstall the ifm package .......................................................................................................................14
Familiarise yourself with the following CODESYS functions!
Package Manager
Online help > CODESYS Development System > Manage packages and licences
Component
Description
AC14SL.devdesc.xml
Device description of the basic module
ACnnnn_EthernetAdapterSL.devdesc.xml
Device description of Ethernet interface
ACnnnn_Modbus_Master.devdesc.xml
Device description of the Modbus master (extension of the Ethernet interface)
ACnnnn_Modbus_Slave.devdesc.xml
Device description of the Modbus slave device (extension of the Ethernet interface)
ACnnnn_Utils.library
Function library with AS-i Gateway AC14 specific CODESYS function blocks and data structures
ACnnnn_SYS_CMD.library
Function library with function block for access to the command interface of AS-i Gateway AC14 from a CODESYS application
AC14SL.template
Template for AC14 StandardLine
AC14SL.template.project
Template for AC14 StandardLine project
AC14.ico
Symbol image of the AC14

4.2 ifm AS-i Package

>

4.2.1 Components of the ifm package

To program the AS-i Gateway AC14, ifm provides the CODESYS package "CODESYS for ifm SmartPLC StandardLine" (short: ifm package). The ifm package (file: ifm_SmartPLC_StandardLine_V1_6_4_14.package) contains the following components:
17679
17552
12
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
Installation ifm AS-i Package
>

4.2.2 Install the ifm package

To install the package "CODESYS for ifm SmartPLC StandardLine":
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

To update an installed package "CODESYS for ifm SmartPLC StandardLine":
1 Download new version of the ifm package
Got to the product page of the device on the ifm website. Download ifm_SmartPLC_StandardLine_V1_6_4_14.package and save it on the CODESYS PC/laptop.
2 Uninstall the old version of the ifm package
Uninstall the ifm package (→ p. 14)
3 Install a new version of the ifm package
Install the ifm package (→ p. 13)
4 Update device libraries
In the device tree: Click on [Device (ifm_SmartPLC_StandardLine)]. Select [Project] > [Update Device].
> [Update Device] windows appears. Click on [Update Device] to start the update process. > New device libraries are loaded. > Project tree view is updated.
Click on [Exit] to close the Package Manager. Save the project.
7283
12267
13
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
Installation ifm AS-i Package
>

4.2.4 Uninstall the ifm package

To uninstall the package "CODESYS for ifm SmartPLC StandardLine":
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.
12270
14
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
Getting started ifm AS-i Package

5 Getting started

Create CODESYS project ......................................................................................................................16
Use CODESYS online help ....................................................................................................................19
Set the programming interface ...............................................................................................................20
15858
15
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
Getting started Create CODESYS project
>
Create new project with AS-i Gateway AC14 .........................................................................................17
Overview: Project structure with AS-i Gateway AC14 ............................................................................18
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

5.1 Create CODESYS project

17129
16
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
Getting started Create CODESYS project
>
To avoid errors during manual system configuration, it is explicitly recommended to use the project template from ifm electronic when creating the AS-i Gateway AC14 project in CODESYS.

5.1.1 Create new project with AS-i Gateway AC14

Qualifications
> All required software components are correctly installed ( Installation ( p. 11)). > CODESYS successfully started.
1 Create a new project
Select [File] > [New Project...]. > The window to enter the project properties appears:
17682
Set the following values:
1. [Templates]: Select [ifm_SmartPLC_StandardLine 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 AS-i Gateway AC14. > The window [Devices] shows the device tree of the project ( Overview: Project structure with AS-i Gateway
AC14 ( p. 18)).
17
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
Getting started Create CODESYS project
2 Save the project
1
[Device (AC14)] represents the AS-i Gateway AC14 in the CODESYS project. → Configure PLC (→ p. 21)
2
[PLC Logic] contains the PLC applications of the AS-i Gateway AC14. → Objects of a PLC application (→ p. 24)
3
[ASi_Master_1] contains the process data images of the AS-i slaves at AS-i master 1 → Access input and output data (→ p. 27)
4
[ASi_Master_2] contains the process data images of the slaves at AS-i master 2 → Access input and output data (→ p. 27)
5
[Fieldbus_Interface] provides access to the inputs and outputs of the fieldbus interface. → Access input and output data (→ p. 27)
6
[Ethernet] represents the configuration node Ethernet adapter of the device. → Configure Ethernet interface (→ p. 22)
Select [File] > [Save Project]. > CODESYS saves the project.
>

5.1.2 Overview: Project structure with AS-i Gateway AC14

17132
A CODESYS project contains all components for the programming and administration of PLC applications. All components of a project are shown in the window [Devices] in a hierarchic tree view. CODESYS projects with an AS-i Gateway AC14 have the following structure:
18
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
Getting started Use CODESYS online help
>
Familiarise yourself with the CODESYS development system! In particular with the
following topics:
Names and functions of the user interface elements  Basic menu functions  Programming techniques and methods for data retention

5.2 Use CODESYS online help

6989
This manual only describes the integration, configuration and the programming of the AS-i Gateway AC14 using the CODESYS development system.
For the description of user actions and user interface elements the CODESYS terminology will be used.
Standard functions and methods of CODESYS will not be described. At the beginning of each section there will be a reference to the corresponding chapters of the CODESYS online help.
To access the online help of the CODESYS development system:
Start CODESYS. > The CODESYS user interface appears. Press [F1]. > Online help of the CODESYS development system appears.
19
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
Getting started Set the programming interface
>

5.3 Set the programming interface

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

5.3.1 Set communication path to PLC

To configure the connection between CODESYS programming software and the PLC of the AS-i Gateway AC14:
1 Preparations
Connect CODESYS PC/laptop and configuration interface (X3) of the device. Optional: Adjust IP settings of the Ethernet interfaces.
2 Select communication settings
In the device tree: Double click on [Device ifm_SmartPLC_StandardLine] In the editor window: Click on [Communiation Settings] tab.
> Editor window shows the communication settings of the device.
3 Select gateway
Select the required gateway from the [Gateway] list. List shows the selected gateway.
4 Select network path
Press [Scan network...]. > [Select Device] window appears. Select gateway and press [Scan network] to start the scanning process. > CODESYS scans the Ethernet network for accessible devcies. > Window shows network path and detected devices.
18494
18500
Select the [AS-i Gateway AC14] node. > Information field displays detailed information of the selected node. Press [OK] to select the network path to the PLC. > CODESYS is able to download data to the PLC of the AS-i Gateway AC14.
20
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
System configuration Configure PLC

6 System configuration

Configure PLC ........................................................................................................................................21
Configure Ethernet interface...................................................................................................................22
Familiarise yourself with the following CODESYS functions!
Generic device editor
Online help > CODESYS Development System > Reference user interface > Objects> object 'device' and generic device editor
>

6.1 Configure PLC

The PLC is configured via the "Generic Device Editor" of the CODESYS programming system. The programmer can access the device editor of the PLC via the following node in the device tree:
To configure the device-internal PLC:
In the device tree: Double-click on [ifm_SmartPLC_StandardLine] > The editor window shows device editor of the device-internal PLC.
Configure PLC. Save the project to apply changes.
18498
18961
21
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
System configuration Configure Ethernet interface
>
Available fieldbus stacks ........................................................................................................................22
Add fieldbus stack ..................................................................................................................................23
Familiarise yourself with the following CODESYS functions!
Menu command "Attach device"
Online help > CODESYS Development System > Devices > Attach Device...
Configure EtherCAT (master)
Online help > Fieldbus support > EtherCAT Configuration Editor
Configure modbus TCP (master/slave)
Online help > Fieldbus support > Modbus Configuration Editor
Designation
Fieldbus
Manufacturer
Modbus TCP Master
Modbus TCP
3S - Smart Software Solutions GmbH
Modbus TCP Slave
Modbus TCP
3S - Smart Software Solutions GmbH

6.2 Configure Ethernet interface

>

6.2.1 Available fieldbus stacks

The Ethernet internet (X3) of the device can be declared and operated as an additional fieldbus interface. For this, a fieldbus stack must be assigned to the interface in CODESYS. Presently, the device supports the following fieldbus stacks:
17701
18518
22
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
System configuration Configure Ethernet interface
>
Familiarise yourself with the following CODESYS functions!
Modbus configurator
Online help > Fieldbus support > Modbus configurator

6.2.2 Add fieldbus stack

To declare the Ethernet interface as a fieldbus interface:
1 Create/load CODESYS project
Create or load CODESYS project with the AS-i Gateway AC14.
2 Add fieldbus stack
In the device tree: Right-click on [X3 (Ethernet)]. In the context menu: Select [Add Device...].
> Window [Add device] appears. Set the following values:
1. [Vendor]: Select [<All vendors>].
2. In table: Select the requested fieldbus stack in the [Name] column.
3. [Name]: Enter name of the fieldbus stack.
Click on [Add Device]to add the requested fieldbus stack to the project. > In the device tree: CODESYS adds the selected fieldbus stack as sub-element of the Ethernet interface.
3 Configure the fieldbus stack
Configure added fieldbus device. Save the project to apply changes.
18659
23
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
Programming Objects of a PLC application

7 Programming

Objects of a PLC application ..................................................................................................................24
Create PLC application ...........................................................................................................................25
Access input and output data .................................................................................................................27
Use functions of the ifm package ...........................................................................................................33
Use visualisations ...................................................................................................................................40
Configure task processing ......................................................................................................................45
Testing the PLC application....................................................................................................................46
Familiarise yourself with the programming according to the standard IEC 61131-3!
1
[Application] is the container of the PLC application
2
[Library manager] provides access to the standard and device-specific function libraries.
3
[PLC_PRG (PRG)] provides access to the program editor of the application → Create PLC application (→ p. 25)
4
[Task configuration] provides access to the settings of the task processing → Configure main task (→ p. 45)
This chapter provides information about the programming of the PLC of the device.
>

7.1 Objects of a PLC application

All objects of a PLC application are listed as subelements of the node [Application] in the device tree. In the basic configuration a PLC application contains the following objects:
7074
7143
If needed, the programmer can add additional objects to the PLC application ( Add visualisation to a
project ( p. 41)).
24
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
Programming Create PLC application
>
Familiarise yourself with the following CODESYS functions!
Program application
Online help > CODESYS Development System > Program application
Programming reference
Online help > CODESYS Development System > reference programming
The memory area for RETAIN variables comprises 4072 bytes. Pay attention to the maximum size of the RETAIN memory area when declaring RETAIN
variables!

7.2 Create PLC application

To create a PLC application:
In device tree: Double-click on [PLC_PRG (PRG)] > The editor window shows the programming surface:
17691
Program the application in the editor.
>

7.2.1 Use remanent variables

The PLC of the device supports the use of remanent variables. Variables declared as VAR RETAIN are stored in a memory area that is also maintained when the device is switched off.
The declaration of a variable as RETAIN also influences its behaviour when the PLC application is reset ( Supported reset variants ( p. 54)).
18522
25
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
Programming Create PLC application
>
Library
ion Block Diagram (FBD)
ACnnnn_Utils.library
X X X X X
X
ACnnnn_SYS_CMD.library
X X X X X
X
Legend: X ... is supported
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. 111))  System command 0x1109 with function block ACnnnn_SysCmd ( ACnnnn_SysCmd
( p. 121))

7.2.2 Supported programming languages

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

7.2.3 Change system time of the device

18271
26
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
Programming Access input and output data
>
Options to access input and output data ................................................................................................27
Validity of the interface data ...................................................................................................................28
Process data of the AS-i slaves .............................................................................................................29
Fieldbus data ..........................................................................................................................................31
Familiarise yourself with the following CODESYS functions!
Addresses according to IEC standard 61131-3:
Online help > CODESYS Development System > Programming Reference > Operanden > Addresses
Access to IEC address via AT declaration:
Online help > CODESYS Development System > Programming Reference > Declaration > AT Declaration
Definition of an ALIAS for an IEC address:
Online help > CODESYS Development System > Programming Reference > Data Types > References
Coupling of a program variable to an address (mapping):
Online help > CODESYS Development System > Configuring I/O Links

7.3 Access input and output data

>
17447

7.3.1 Options to access input and output data

In a CODESYS project, each input and output has a physical address according to the IEC standard (e.g. %IW5). CODESYS offers the following options to access this address from a PLC application and thereby to access the input and outputs data of the device:
Direct access to IEC address  Access to IEC address via AT declaration  Definition of an ALIAS for an IEC address  Link a program variable to an IEC address (mapping)
17621
27
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
Programming Access input and output data
>
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!

7.3.2 Validity of the interface data

18413
In order to facilitate the access to inputs and outputs of AS-i slaves, AS-i Gateway AC14 projects offer clearly defined interfaces in the device tree ( Overview: Project structure with AS-i Gateway AC14 ( p. 18)).
Depending on the active instance for accessing the outputs of the AS-i slaves (Manual, Gateway, PLC), the CODESYS data mapper only updates certain address areas of the interfaces. The following table shows which address areas of the i/o interfaces provide valid data values while in a certain operating mode:
28
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
Programming Access input and output data
>
1
Digital input and output data of the slave at AS-i master 1: Digital input and output data ( p. 30)
2
Analogue input and output data of the slaves at AS-i master 1: Analogue input and output data ( p. 30)
3
Digital input and output data of the slave at AS-i master 2: Digital input and output data ( p. 30)
4
Analogue input and output data of the slaves at AS-i master 2: Analogue input and output data ( p. 30)
Consider validity of the interface data ( Validity of the interface data ( p. 28))!
The function library ACnnnn_Utils.library contains the complex variable ASi_NET. The variable represents all inputs and outputs of a completely developed AS-i network. The programmer can use this data structure to store the process images of the inputs and outputs of an AS-i network. ( ASI_NET (STRUCT) ( p. 117))

7.3.3 Process data of the AS-i slaves

17584
The project tree offers direct access to the cyclically updated process images of the inputs and outputs of the AS-i slaves.
29
ifm Programming Manual AS-i Gateway AC14 (4.2.x) 12/2017
Programming Access input and output data
>
To access the digital process data of the slaves at AS-i master 2 in a system with 2 AS-i masters: Double click on [ASi_2_binaryIO]
To access the analogue process data of the slaves atAS-i Master2 in a system with 2 AS-i masters: Double-click on [ASi_2_analogIO]
Digital input and output data
To access the digital process data of the slaves at AS-i master 1:
In the device tree: Double click on [ASi_1_binaryIO] > The editor window shows a structured list of the digital inputs and outputs of the AS-i slaves.
In column [Variable]: Mouse click on to make individual variables visible.
>
Analogue input and output data
To access the analogue process data of the slaves at AS-i master 1:
In the device tree: Double-click on [ASi_1_analogIO] > Editor window shows a structured list of the analogue inputs and outputs of the AS-i slaves.
17625
17626
In column [Variable]: Mouse click on to make individual variables visible.
30
Loading...
+ 101 hidden pages