0% found this document useful (0 votes)
125 views41 pages

System Manual Ecomatcontroller

Uploaded by

Mattia Canuti
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)
125 views41 pages

System Manual Ecomatcontroller

Uploaded by

Mattia Canuti
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/ 41

>

>

System Manual

Starter kit for ecomatController

EC2121

CODESYS Version 3.5 or higher

English
11 / 2019
80282814 / 00
Starter kit for ecomatController EC2121

Contents

1 About this manual 4


1.1 Legal and copyright information ...........................................................................................4
1.2 Explanation of Symbols .......................................................................................................5
1.3 Purpose of the document .....................................................................................................5
1.4 Required previous knowledge ..............................................................................................5
1.5 Required software ................................................................................................................6
1.6 Overview: User documentation for EC2121 ........................................................................6
1.7 Overview: documentation for CODESYS 3.n ......................................................................7
1.8 Change history .....................................................................................................................7

2 Prepare the controller 8


2.1 Hardware installation ...........................................................................................................8
2.2 Install UpdateTool on the PC ...............................................................................................8
2.3 Establish a connection between the controller and the PC via Ethernet. ............................9
2.3.1 Connect the controller and the PC ............................................................................................... 9
2.3.2 Check and set the network settings of the PC .............................................................................. 9
2.3.3 Test connection between the controller and PC ......................................................................... 11
2.4 Check and update OS version ...........................................................................................12

3 Installation 15
3.1 Prepare installation ............................................................................................................15
3.2 Carry out installation ..........................................................................................................17
3.2.1 Install the programming software CODESYS 3.5 ....................................................................... 17
3.3 Start CODESYS 3.5 ...........................................................................................................19
3.4 Install packages .................................................................................................................20
3.4.1 Start the package manager ........................................................................................................ 20
3.4.2 Install packages with the package manager ............................................................................... 20

4 Features of a PLC 22
4.1 Cyclical program processing ..............................................................................................22
4.2 Time response ...................................................................................................................23
4.2.1 Cycle time................................................................................................................................... 23
4.2.2 Watchdog ................................................................................................................................... 23
4.2.3 Response time ........................................................................................................................... 23

5 A first program 24
5.1 Device tree .........................................................................................................................26
5.2 Connect to the device ........................................................................................................27
5.3 Create the program ............................................................................................................30
5.3.1 Suppress SafetyPLC in the device tree ...................................................................................... 30
5.3.2 Cyclical program processing ...................................................................................................... 30
5.3.3 Structured programming ............................................................................................................. 31
5.3.4 Create new block........................................................................................................................ 31
5.3.5 Function block diagram (FBD) .................................................................................................... 32
5.3.6 Program linking .......................................................................................................................... 33
5.3.7 Address binary inputs and outputs ............................................................................................. 34
5.3.8 Call in PLC_PRG........................................................................................................................ 35
5.3.9 Structured text (ST) .................................................................................................................... 36
5.4 Transfer and test the program ...........................................................................................37
5.4.1 Transfer program ........................................................................................................................ 37
5.4.2 Test program .............................................................................................................................. 38

2
Starter kit for ecomatController EC2121

6 Annex 39
6.1 The I/O simulator box .........................................................................................................39
6.1.1 Inputs.......................................................................................................................................... 39
6.1.2 Outputs ....................................................................................................................................... 40
6.1.3 Communication reset ................................................................................................................. 40

7 Index 41

3
Starter kit for ecomatController EC2121

1 About this manual


Content
Legal and copyright information ...............................................................................................................4
Explanation of Symbols ............................................................................................................................5
Purpose of the document .........................................................................................................................5
Required previous knowledge ..................................................................................................................5
Required software ....................................................................................................................................6
Overview: User documentation for EC2121 .............................................................................................6
Overview: documentation for CODESYS 3.n ...........................................................................................7
Change history .........................................................................................................................................7
26077

>

1.1 Legal and copyright information


39648

© 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)
• Modbus® is the property of the Schneider Electric SE, France (→ www.schneider-electric.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

4
Starter kit for ecomatController EC2121

>

1.2 Explanation of Symbols


34171

WARNING
Warning of serious personal injury.
Death or serious irreversible injuries may result.

CAUTION
Warning of personaly injury.
Slight reversible injuries may result.

NOTICE
Warning of damage to property

Important note
Non-compliance can result in malfunction or interference
Information
Supplementary note
► ... Request for action
> ... Reaction, result
→ ... "see"
abc Cross-reference
123 Decimal number
0x123 Hexadecimal number
0b010 Binary number
[...] Designation of pushbuttons, buttons or indications

>

1.3 Purpose of the document


57252

These instructions describe how to prepare and program a controller of the device family for mobile
applications, ecomatmobile from ifm electronic gmbh, using the CR711S controller as example.
These instructions are intended for the operation in conjunction with the starter kit EC2121; it can,
however, also be used independently.
This document will be continuously updated.
The current version is available for download on the ifm website: → www.ifm.com
>

1.4 Required previous knowledge


57253

This manual addresses people with basic knowledge in automation technology. Experience in PLC
technology and basic knowledge in Ethernet networks are useful.
>

5
Starter kit for ecomatController EC2121

1.5 Required software


57254

To reproduce the descriptions in this manual, the following software components are required:
 UpdateTool
 Programming software CODESYS 3.5
 Controller-specific packages for CODESYS 3.5
The software versions referred to in this manual are on the USB flash drive supplied with the starter
kit.
The current software versions are available for download on the ifm website: → www.ifm.com
>

1.6 Overview: User documentation for EC2121


57255

The documentation of the starter kit consists of the following modules:


Document Content/Description
Data sheet EC2121 Technical data of the starter kit
Data sheet CR711S Technical data of the controller
System manual starter kit for Step-by-step explanations how to prepare and program a PLC CR711S
ecomatController
Original operating instructions  Instructions for installation, electrical installation and commissioning
 Technical data

Programming manual  Functions of the set-up menu of the device


 Creation of a CODESYS project with this device
 Target system configuration with CODESYS
 Programming the device-internal PLC using CODESYS
 Description of the device-specific CODESYS function libraries

If any documents are not available, they can be requested from ifm or can be downloaded from the ifm
website: → www.ifm.com

6
Starter kit for ecomatController EC2121

>

1.7 Overview: documentation for CODESYS 3.n


54178

3S-Smart Software Solutions GmbH (→ www.codesys.com) offers the following user documentation to
program the device using CODESYS:
Document Content / Description
Online help  Context-sensitive help
 Description of the CODESYS programming system
After the programming system is installed, the following is stored and accessible on the hard disk of
the PC/laptop:
...\Programme (x86)\3S CODESYS\CODESYS\Online Help

The online help is for programming the standard PLC. The CODESYS online help only applies
to the safety PLC with restrictions.
► Please read this programming manual when programming the safety PLC.
CODESYS installation  Remarks about the installation of the programming system CODESYS
and first steps  First steps for handling the CODESYS programming system
After the installation of the programming system stored and accessible on the hard disk of the
PC/laptop:
...\Programme (x86)\3S CODESYS\CODESYS\Documentation

CODESYS user manual [H2] CODESYS Safety SIL2 - IEC Programming Guidelines.pdf
Safety SIL2 This document is for programmers who program safety-related controllers.
The CODESYS user manual only applies to the safety PLC with restrictions.
► Please observe this programming manual when programming the safety PLC.

If any documents are not available, they can be requested from ifm or can be downloaded from the ifm
website:
→ www.ifm.com
>

1.8 Change history


57256

Date State Change


11 / 2019 00 Creation of the document.

7
Starter kit for ecomatController EC2121

2 Prepare the controller


Content
Hardware installation ................................................................................................................................8
Install UpdateTool on the PC....................................................................................................................8
Establish a connection between the controller and the PC via Ethernet. ................................................9
Check and update OS version ...............................................................................................................12
57257

>

2.1 Hardware installation


57258

Connect the 81-pole AMP connector to the controller:


► Pull out the locking slide on the connector until the end stop.
► Attach the connector to the controller and click home.
► Insert the slide to lock the connector on the controller.
> The AMP connector is connected to the controller.

Connect the voltage supply via an external voltage source 24 V DC (not supplied):
► Connect the voltage source to both 4 mm lab sockets on the prewired connection cable:
 plus pole - red
 minus pole - black
> The LEDs SYS0 and SYS1 are on or flash green.

If one of the LEDs SYS0 or SYS1 is permanently on in red, there is a hardware fault or system
fault (→ Data sheet CR711S > Operating states of the system).

>

2.2 Install UpdateTool on the PC


57259

To install the UpdateTool_Vn.n.n.n on the PC:


► Copy the folder x:\ecomatController\UpdateTool_Vn.n.n.n from the supplied USB flash
drive to the PC.

The user must have write access in the target directory.


The directory path must not contain any blanks.

Recommendation: Copy the UpdateTool to the desktop or the project folder.

8
Starter kit for ecomatController EC2121

>

2.3 Establish a connection between the controller and the PC


via Ethernet.
57260

>

2.3.1 Connect the controller and the PC


57261

To connect the controller to the PC:


► Connect the supplied network cable (Ethernet cable) to:
 the interface ETH0 of the controller
 the Ethernet interface of the PC
> The controller and PC are connected to the network cable.
>

2.3.2 Check and set the network settings of the PC


57262

Changes in the network settings of the PC require extended user rights.


Contact your system administrator.

To check and, if necessary, set the network settings of the PC:


► Switch on the PC.

9
Starter kit for ecomatController EC2121

► Activate the Windows menu [Internet Protocol Properties Version 4 (TCP/IPv4:


for example [Start] > right click > [Network Connections] > [Ethernet] > [Change adapter settings]
> [Ethernet] > right click > [Properties]
(→ Figure below)

► Click the [Properties] button.


► Select the menu item [Use the following IP address].
► Check the IP address on 192.168.82.xxx and set, if necessary.

The following addresses are already used and must not be used for the PC:
192.168.82.21 (gateway), 192.168.82.247 (controller)

► Enter the subnet mask (255.255.255.0).


► Enter the default gateway (192.168.82.21) (→ Figure below).
► Confirm the settings with [OK].

10
Starter kit for ecomatController EC2121

> The network settings were changed.

Summary of the network settings:


Setting Value
Internet protocol TCP/IP
IP address 192.168.82.xxx (except .21 and .247)
Subnet mask 255.255.255.0
Gateway IP address 192.168.82.21

>

2.3.3 Test connection between the controller and PC


57263

The connection can be tested with the UpdateTool.

NOTE!
If the instructions on the screen are not complied with,
> the controller may be damaged.
► Strictly follow the instructions on the screen during the entire update process.

► Start Update.bat in the folder of the UpdateTool.

11
Starter kit for ecomatController EC2121

► Confirm with [Enter] twice.


> The menu appears.

► Select menu item [Ping device] by entering [2] and confirming with [Enter].
> The ping replies are displayed. When the ping replies are displayed as shown in the figure, the
connection is OK.

► Return to the menu with [Enter].


From the menu, the next step can be taken: → Check and update OS version (→ p. 12)

>

2.4 Check and update OS version


57265

The OS version of the device can be checked and updated with the UpdateTool.

12
Starter kit for ecomatController EC2121

Check OS version:
► In the menu of the UpdateTool, select the menu item [Continue update process] by entering [4]
and confirming with [ENTER].
> After a short time, information about the current controller and the update menu (→ figure) appear
in the window.

The figure shows that OS version 2.9.0.2 is on the controller. Now an update to version 3.0.0.3 is to be
made

NOTE!
If the instructions on the screen are not complied with,
> the controller may be damaged.
► Strictly follow the instructions on the screen during the entire update process.

Update OS version:
► To start the update process, select menu item update V3.0.0.3 by entering [13] and confirming
with [Enter].

13
Starter kit for ecomatController EC2121

> The update process starts. During the update process, various messages appear; to conclude, the
following success message is displayed:

► Exit the UpdateTool with [Enter] and twice [q].

14
Starter kit for ecomatController EC2121

3 Installation
Content
Prepare installation .................................................................................................................................15
Carry out installation ...............................................................................................................................17
Start CODESYS 3.5 ...............................................................................................................................19
Install packages ......................................................................................................................................20

>

3.1 Prepare installation


57267

The major part of the required software is on the supplied USB flash drive.
Since the used controller can also be used for applications with functional safety, it is
necessary for legal reasons that you download the controller-specific packages directly from
ifm's website.
In this way, you are registered as customer of this controller and will be automatically informed
in the event of changes (e.g. to the firmware or documentation).

Download the packages from ifm's website:


► → www.ifm.com > selection of your country > CR711S [Search] > select product page of CR711S
from the search results

15
Starter kit for ecomatController EC2121

► Open tab [Downloads] > click [Target and documentation package] under [Software Download]

> Login page for my ifm appears


► Log in to my ifm.

16
Starter kit for ecomatController EC2121

If you do not have your my ifm- access data, you have to register as customer beforehand.

> The website to download safety operating systems is displayed.


► Download the package for [CR711S (Version V3.0.0.3)] and save it on your PC.

>

3.2 Carry out installation


57268

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

>

3.2.1 Install the programming software CODESYS 3.5


57269

Administrator rights are required for the installation on the PC.

On the supplied USB flash drive you find the 32-bit version of CODESYS since its use is
compulsory.

To install the programming software CODESYS 3.5:


► Start the installation program Setup_CODESYS<Version>.exe in the main directory on the
supplied USB flash drive.
> The window to select the installation directory [Choose Destination Location] appears.

For parallel installation of several different CODESYS versions on the PC, the installation
directory has to be adapted accordingly.

> Click the [Browse…] button.


> The window to enter the installation directory [Choose Folder] appears.

17
Starter kit for ecomatController EC2121

► Change the installation path in C:\Program Files (x86)\3S CODESYS V3.5 SP11 and confirm with
[OK].

► Activate the [Next >] button to continue the installation.


> The installation wizard will guide you through the installation. It is recommended to apply the
default settings during further installation.

18
Starter kit for ecomatController EC2121

>

3.3 Start CODESYS 3.5


57270

Administrator rights are required to install the packages on the PC.

After the first program start, the packages belonging to the controller have to be installed.
► Start CODESYS as admin with: desktop symbol [CODESYS V3.5 SP11] > (right click) > [Run as
administrator].

> CODESYS starts.


> CODESYS user interface appears.

19
Starter kit for ecomatController EC2121

>

3.4 Install packages


57271

► Install the following packages in the indicated order:


1. Package of the controller (ifm_R360-3_Vn.n.n.n.package)
2. Safety SIL2 package from 3S (3S_CODESYS_Safety_SIL2_Vn.n.n.n.package)
3. Safety SIL2 extension package from ifm
(ifm_R360-3_CODESYS_Safety_SIL2_Extensions_V0.0.0.6.package)
>

3.4.1 Start the package manager


57272

► Select [Tools] > [Package Manager] to start the package manager.


> Package manager appears.
> Window shows installed packages.

>

3.4.2 Install packages with the package manager


Install packages:
► Click [Install...].
> The file explorer appears.
► Select the file ifm_R360-3_Vn.n.n.n.package from the directory
x:\ifm_CR711S_Vn.n.n.n\CODESYS_Package of the supplied USB flash drive and [Open].
► Acknowledge the licence agreement.
► Select [Complete Setup].
► Confirm the message [The package has been successfully installed. […]] with [Exit].
> The [Package Manager] window shows the installed package.
► Repeat the installation process for the packages 3S_CODESYS_Safety_SIL2_Vn.n.n.n.package
and ifm_R360-3_CODESYS_Safety_SIL2_Extensions_V0.0.0.6.package in the directory
x:\ifm_CR711S_Vn.n.n.n\CODESYS_Package\PlugIn.

20
Starter kit for ecomatController EC2121

> To conclude, the package manager shows all installed packages.

► Click [Close] to quit the package manager.

To complete the installation of the packages, CODESYS has to be restarted.


► Exit CODESYS.
► Restart CODESYS by double-clicking on the desktop symbol [CODESYS V3.5 SP11].
> The installed packages are now available.
> Done: The conditions for programming are now met.

Basics of programmable logic controllers: → Features of a PLC (→ p. 22)


or continue to programming: → A first program (→ p. 24)

21
Starter kit for ecomatController EC2121

4 Features of a PLC
Content
Cyclical program processing ..................................................................................................................22
Time response ........................................................................................................................................23
57274

This chapter describes some basics of programmable logic controllers. Should you have some
knowledge of the operation of a PLC, you can skip this chapter.

>

4.1 Cyclical program processing


57275

Characteristic of PLC systems is the cyclical program processing, i.e. after processing of the
application program, processing is automatically started from the beginning.
This ensures that the input signals are read continuously. Changes are found and considered in the
application program.

If input signals of the switches and sensors change during processing of the application program, this
may lead to incorrect results for the output signals. Therefore the input signals are copied to a
clipboard (process image of the inputs - PII) at the beginning of the cycle.
The application program then only works with the signals from the PII when the inputs are read. The
results for the outputs are also written to the clipboard (process image of the outputs - PIO) during
processing.
When processing of the application program is completed (end of cycle), the signals are transferred
from the PIO to the outputs and the actuators switch accordingly.

22
Starter kit for ecomatController EC2121

>

4.2 Time response


57276
>

4.2.1 Cycle time


57277

The time a controller needs for one cycle is called cycle time.
Typically, this time is in the ms range.
The cycle time is also the time an input signal has to be present to be reliably detected by the
controller.
If a signal is shorter, it depends on whether it happens to come at that point of time at which the inputs
are read. Only then will it be recognised.
With the ecomatController, the cycle time is determined by the configuration of the tasks.

It is recommended to define as few tasks as possible.


That means, usually one task is sufficient. You may need a second task for a bus system.

>

4.2.2 Watchdog
57278

A PLC monitors itself if the cycle is correctly processed. The case that a program cycle is not complete
is dangerous. Then no inputs are read. A change of the state on the input, e.g. "limit switch reached"
cannot be processed.
The status of the output cannot change, e.g. the drive keeps on running although the limit switch has
been reached.
The watchdog function exists to avoid such states. If the end of the cycle has not been reached within
a certain time which is started with each new cycle, the watchdog becomes active. The controller is
stopped and the outputs are disconnected.
What can cause such an event?
1. Hardware error

If a processor fails, for example, the controller must pass into a safe state.
2. Program error

If loops or jumps are used in programming, it is possible that processing takes too long or in the
worst case a closed loop leads to the situation that the end of the cycle cannot be reached.

>

4.2.3 Response time


57279

This value is often used to characterise the time response of a PLC.


This is the time that elapses from a change of an input signal to the corresponding response of the
output.
If an input signal changes only shortly after the PII has been written and is therefore not copied to the
PII before the following cycle, the output signal changes after two cycles.
In the worst case, the response time = 2 * cycle time.

23
Starter kit for ecomatController EC2121

5 A first program
Content
Device tree .............................................................................................................................................26
Connect to the device .............................................................................................................................27
Create the program ................................................................................................................................30
Transfer and test the program ................................................................................................................37
57280

When all packages have been installed, a first program for test purposes should be written.
To do so, a new project is created with [New project...] when CODESYS has been started.
ifm provides one template each for every controller. The basic elements and configurations in these
basic projects are already prepared.

Create a new project with a template:

► Select [Template project with ifm CR711S].


► Enter file name [Name: Project01].
► Select the target folder [location: …\Dokumente\CODESYS 3\Starter kit EC2121].
> CODESYS opens the template for the controller CR711S. This is an unprepared project in which
hardware-specific settings have already been made.

24
Starter kit for ecomatController EC2121

When a new project is created via [Empty project], the hardware-specific settings have to be
made manually.

25
Starter kit for ecomatController EC2121

>

5.1 Device tree


On the left side of the CODESYS project view, there is the device tree. It contains all components for
the configuration, administration and programming of the controller.
The structure can be seen in the figure:

The main elements are described as follows:


Element Description

CR711S (CR711S) Logical father controller, provides access to the general settings of CR711S.
SafetyPLC (CR711S SIL2) Contents of the SafetyPLC, provides access to the contents of the safety controller.
StandardPLC (CR711S Standard) Contents of the StandardPLC, provides access to the contents of the standard
controller.
PLC logic Contains the application of the respective controller.
Local_IO (Local IO) Provides access to the configuration options of the inputs and outputs.
HMI (HMI) Provides access to the configuration options of the operating and display elements.
Communication (Communication) Provides access to configuration options of the communication interfaces.

26
Starter kit for ecomatController EC2121

The ecomatController devices contain two independent programmable logic controllers:


 StandardPLC (CR711S standard)
 SafetyPLC (CR711S SIL2)

For this first introduction, only the StandardPLC is used. The distribution of the resources (e.g.
memory) to the two controllers does not have to be taken into account here.
>

5.2 Connect to the device


57282

First of all, check the connection to the controller:


► In the device tree: Double-click on the controller [CR711S (CR711S)].
> The corresponding detailed view of CR711S appears.

► Select tab [Communication Settings].


► Click [Scan network…].

27
Starter kit for ecomatController EC2121

► Window [Select device] appears.

► Select [Gateway-1] on the left and search for the controller by clicking the [Scan network] button.
> The controller appears below the gateway.

It is possible that the function [Scan network] has to be executed twice.

► Select the controller and click [OK].


> The window [Device User Logon] appears.

28
Starter kit for ecomatController EC2121

► Enter user name admin and no password and confirm with [OK].

If a password was already set, it has to be entered for login.

> The connection to the controller is established.


> The green circle on the controller signals that the connection has been established.

29
Starter kit for ecomatController EC2121

>

5.3 Create the program


57283

In the first small program a two-hand control is to be implemented which is used for presses, for
example. There are two pushbuttons on the press which are installed so that they cannot be operated
with one hand. That means that the operator has to press one pushbutton with each hand to release
the press. This ensures that no hand gets underneath the press.
For the simulation, the IO-simulator box is used with the following signals:
Operand Comments
IN0100 Press, pushbutton 1
IN0101 Press, pushbutton 2
OUT0000 Press release signal

>

5.3.1 Suppress SafetyPLC in the device tree


Since only the controller StandardPLC is used for the first program, the section of the SafetyPLC is
suppressed in the device tree.
► Click minus sign before [SafetyPLC (CR711S SIL2)].
> The branch [SafetyPLC (CR711S SIL2)] is closed.

>

5.3.2 Cyclical program processing


In CODESYS 3.5, the program has to be processed cyclically. A program block has to exist to which a
task is assigned.
One task and one program block PLC_PRG are already pre-configured in the used template. The
program block PLC_PRG is assigned to the task and is therefore activated cyclically.
In the program block PLC_PRG other program blocks (also called POU - Programming Organization
Unit) are started. They can be programs, function blocks and functions.
>

30
Starter kit for ecomatController EC2121

5.3.3 Structured programming


57286

In principle, the complete program can be contained in only one block such as the PLC_PRG. This
becomes quite confusing, however, and the fault location is difficult.
It is better to distribute different program sections to different blocks. Then the blocks are activated one
after the other in PLC_PRG.
Therefore one separate program block press is created for the press controller in this example.
>

5.3.4 Create new block


57287

To create a new block:


► In the device tree: Select [Application] > (right click) > [Add Object] > [POU…].
> The window [Add POU] appears.
► Configure POU and complete with [Add]:
 [Name:] Press
 [Type:] Program
 [Implementation language:] function block diagram (FBD)

> The new block appears.

31
Starter kit for ecomatController EC2121

>

5.3.5 Function block diagram (FBD)


57288

FBD (function block diagram) is a graphic programming language in the standard IEC 61131-3. Blocks
with symbols from the boolean algebra, for example, are added to the program.
Since FBDs are particularly suited for boolean functions, it is also used in the example program.

To enter more complex formulas, a textual language from IEC 61131-3 such as structured text
(ST) is better suited and clearer than FBD.

The upper part of the block is for the declaration of variables.


Underneath, there is the first (still empty) network. In this area, the program is created.
On the right, there is a section with the available tools.

32
Starter kit for ecomatController EC2121

>

5.3.6 Program linking


57289

According to the task, the output signal must only be active if both input signals are active.
This functionality can be implemented with an AND operator. The general symbol for an AND operator
is shown in the image below:

To add a link in CODESYS:


► In the [Toolbox] section: Drag a [Box] to the first network.
> [Start here] appears.
► Drop the block on [Start here].

> The block is added.

This operator is called AND operator in CODESYS. It is entered in the block.


► Click the question marks [???] in the block.

33
Starter kit for ecomatController EC2121

► Enter AND and confirm with [Enter].

>

5.3.7 Address binary inputs and outputs


57290

The links to the inputs and outputs are still missing.


For the first small program, the terms from I/O mapping are used: device tree > Local_IO > Inputs >
I/O mapping

Only apply this use of the inputs and outputs:


 in case of binary use of all inputs and outputs
 if all inputs and outputs use the standard settings of the diagnostic level (→ data sheet)
Resetting faults (e.g. excessive current) is only possible by switching off and on again.
Basic recommendation: Configure the inputs and outputs via the integrated function blocks.

Background:
If inputs or outputs from I/O mapping are used, these values are updated at the end of the
cycle. If you have configured such an input or output simultaneously in the program via a
function block, this value will be overwritten. This is usually not what you want.
If you use both methods in parallel (binary inputs via I/O mapping, other inputs via function
blocks), it may become unclear which may cost a lot of time during set-up, fault location or
program changes.
In addition it has to be noted that it is not possible to reset diagnostic errors via I/O mapping.
The integrated function blocks, however, have an input xResetError so that reset is also
possible during the program sequence.

The first input to be connected is IN0100. It is addressed via IN0100_I:


► Click the question marks [???] of the upper input of the AND operator.
► Enter IN0100_I..
> When the dot has been entered, a selection menu with the attributes of the input appears.
► Since it is a binary input, select the property [ValueDigital].

► Repeat the same procedure with input IN0101 for the second input of the AND operator.
> Both control inputs are connected to the AND operator.

34
Starter kit for ecomatController EC2121

To transfer the link result to the output, an assignment has to be added to the output of the AND
operator:
► Drag an [Assignment] to the output of the AND operator in the section [Toolbox] and drop it at the
appearing green square.

Then name the binary output in the same way as the inputs:
► Click the question marks [???] at the input of the AND operator.
► Enter OUT0000_Q..
► Select the property [ValueDigital].

> Then the inputs of the AND operator are connected to the input signals and the link result is
assigned to the output.

>

5.3.8 Call in PLC_PRG


57291

The block PLC_PRG is the block which is automatically called by the controller.
To ensure that the block Press is processed, it has to be called in the block PLC_PRG.
>

35
Starter kit for ecomatController EC2121

5.3.9 Structured text (ST)


57292

The block PLC_PRG is here programmed in Structured Text (ST). This is a textual programming
language of the standard IEC 61131-3 which follows the programming language PASCAL.
Since commands are entered here in text format, there are no tools in this programming window.
The implementation part consists of a text editor in which instructions are entered. Each instruction
has to be finished with a semicolon.
► Call the block Press with the following command: Press();

► Save the project by clicking on the save symbol.

> The program is completed.


> The project is saved.

36
Starter kit for ecomatController EC2121

>

5.4 Transfer and test the program


57293

To test the program, it has to be transferred to the controller. A connection to the controller was
already established in chapter Establish a connection between the controller and the PC via
Ethernet. (→ p. 9). If required, the steps can be repeated.
>

5.4.1 Transfer program


57294

Since the device comprises the two controllers (SafetyPLC and StandardPLC), the user has to
choose to which controller the program should be transferred.
► Set the StandardPLC as active application: [StandardPLC] > [Application] > context menu > [Set
Active Application]

The option [Set Active Application] only appears if the application is not yet active.
The active application is highlighted in bold type.

► Log in to the controller: [Application] > context menu > [Login]


> Application is compiled and transferred. During the transfer, the LEDs [SYS0] and [SYS1] are
flashing green/yellow.
> When the transfer of the program is finished: The controller is in the stop mode. The LED [SYS0]
lights yellow.

► Restart the controller: [Application] > context menu > [Start]


> The controller is in the RUN mode. LED [SYS0] flashes yellow.

37
Starter kit for ecomatController EC2121

>

5.4.2 Test program


57295

Now the program can be tested.


When the potentiometers are positioned at the right end stop, both switches [IN0100] and [IN0101]
can be switched on. Only if both switches are switched on, is the lamp [OUT0000] on.

This behaviour can also be seen in CODESYS. Here, a supplied H signal is shown as TRUE and an L
signal as FALSE.

Congratulations! You have successfully created your first program in CODESYS 3.5, loaded it to the
controller and tested it.

38
Starter kit for ecomatController EC2121

6 Annex
Content
The I/O simulator box .............................................................................................................................39
57296

>

6.1 The I/O simulator box


57297

The I/O simulator box is used for the simulation of input and output signals and the reset of
communication parameters of the controller. Six inputs and outputs each are connected via the box.

>

6.1.1 Inputs
57298

The input circuit is shown in the image below using [IN0100] as example.

The following modes can be simulated on the inputs:


 binary input (IN_DIGITAL_CSI)
 voltage measurement 0...10 V (IN_VOLTAGE_10)

39
Starter kit for ecomatController EC2121

 voltage measurement 0...32 V (IN_VOLTAGE_32)


 ratiometric voltage measurement / operating voltage ratio (IN_VOLTAGE_RATIO)

The potentiometer forms a voltage divider to also simulate analogue values. When a value is set on a
potentiometer and the corresponding switch is activated, this value is sent to the controller.
In case of binary use of the input, the potentiometer has to be positioned at the right end stop. That
means that the switch supplies the operating voltage (+24 V DC), i.e. an H signal, to the input.
Since we work under ideal conditions (short cable lengths, "clean" voltage supply, no internal and
external noise signals), ground can be connected via GNDsys in the analogue modes.

► If used in the field, the notes on laying and connecting the signal, voltage and ground
cables in the original operating instructions have to be observed.

>

6.1.2 Outputs
57299

The output circuit is shown in the image below using [OUT0000] as example.

The following modes can be simulated on the outputs:


 binary output (OUT_DIGITAL_CSO)
 PWM output
>

6.1.3 Communication reset


57300

Should a connection to the controller not be possible, the interface parameters can be reset to factory
setting using the switch [RESET COM].

40
Starter kit for ecomatController EC2121

Purpose of the document ........................................................................5


7 Index R
A Required previous knowledge .................................................................5
A first program .......................................................................................30 Required software....................................................................................5
About this manual ....................................................................................4 Response time .......................................................................................27
Address binary inputs and outputs ........................................................40
Annex .....................................................................................................46
S
Start CODESYS 3.5...............................................................................20
C Start the package manager ...................................................................21
Call in PLC_PRG ...................................................................................42 Structured programming ........................................................................38
Carry out installation ..............................................................................19 Structured text (ST) ...............................................................................42
Change history.........................................................................................6 Suppress SafetyPLC in the device tree.................................................37
Check and set the network settings of the PC ......................................10
Check and update OS version...............................................................13
T
Communication reset .............................................................................47 Test connection between the controller and PC ...................................11
Connect the controller and the PC ........................................................10 Test program .........................................................................................43
Connect to the device ............................................................................33 The I/O simulator box ............................................................................46
Create new block ...................................................................................38 Time response .......................................................................................27
Create the program................................................................................37 Transfer and test the program ...............................................................43
Cycle time ..............................................................................................27 Transfer program ...................................................................................43
Cyclical program processing ...........................................................25, 37
W
D Watchdog ...............................................................................................27
Device tree.............................................................................................31

E
Establish a connection between the controller and the PC via Ethernet.
.................................................................................................................9
Explanation of Symbols ...........................................................................4

F
Features of a PLC..................................................................................25
Function block diagram (FBD) ...............................................................39

H
Hardware installation ...............................................................................9

I
Inputs .....................................................................................................46
Install packages .....................................................................................21
Install packages with the package manager .........................................22
Install the programming software CODESYS 3.5 .................................19
Install UpdateTool on the PC...................................................................9
Installation ..............................................................................................17

L
Legal and copyright information ..............................................................4

O
Outputs ..................................................................................................47
Overview
documentation for CODESYS 3.n .................................................................. 6
User documentation for EC2121 .................................................................... 5

P
Prepare installation ................................................................................17
Prepare the controller ..............................................................................9
Program linking ......................................................................................39

41

You might also like