Codesys Beijer

Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

iX TxB SoftControl (Codesys runtime 3.5.7.

10)
– FnIO-S Modbus RTU KI00378 2016-05

1 Function and area of use


With the HMI soft controllers in the iX TxB SoftControl series, any HMI application can
have an intuitive graphic iX interface with total CODESYS control.

This document goes through the basic settings required and tips to quickly get started with iX
TxB SoftControl and Modbus RTU communication.

The terminal iX TxB SoftControl communicates with a remote I/O (Crevis FnIO-S Serie) in a
Modbus RTU network (NA-9173 and NA-9473).

2 About this Start Up document


This Start Up document should not be considered as a complete manual. It is an aid to be able
to start up a normal application quickly and easily.

Copyright © Beijer Electronics, 2016


This documentation (below referred to as ‘the material’) is the property of Beijer Electronics. The holder or
user has a non-exclusive right to use the material.
The holder is not allowed to distribute the material to anyone outside his/her organization except in cases
where the material is part of a system that is supplied by the holder to his/her customer.
The material may only be used with products or software supplied by Beijer Electronics.
Beijer Electronics assumes no responsibility for any defects in the material, or for any consequences that
might arise from the use of the material.
It is the responsibility of the holder to ensure that any systems, for whatever applications, which is based on
or includes the material (whether in its entirety or in parts), meets the expected properties or functional
requirements.
Beijer Electronics has no obligation to supply the holder with updated versions.

All safety and accident prevention regulations relevant to your specific application must be observed in the
system design, installation, configuration, maintenance, servicing and testing of this product.

When making programs for this product make sure to leave sufficient CPU power for the HMI-part of the
product to be able to execute smoothly.
A good rule of thumb is to keep the CPU-load around or below 80%. The CPU load can be monitored by
looking at the SystemTagCPULoad system-tag found in the iX Developer environment.

1 (31)
Beijer Electronics Automation AB − a Beijer Electronics Group company
Head Office Subsidiaries
Normal.dotm, 130103

Beijer Electronics Automation AB Norway, Drammen: Beijer Electronics AS,  +47 32 24 30 00


P.O. Box 426, Stora Varvsgatan 13a Denmark, Roskilde: Beijer Electronics A/S,  +45 75 76 66
SE-201 24 Malmö, SWEDEN
Telephone +46 40 35 86 00
Fax +46 40 93 23 01

Reg no. 556701-3965  VAT no SE556701396501  www.beijer.se  [email protected]


iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

Use the following software and drivers in order to obtain a stable application:

Programming software, Image, Driver (iX HMI to SoftController)


• See StartUp document KI00375 (iX TxB SoftControl, Basic setting)

Driver, CODESYS
• Modbus Com Ver 3.4.0.0, communication to Crevis remote I/O
• Modbus Master Ver 3.5.7.0, communication to Crevis remote I/O
• Modbus Slave Ver 3.5.4.0, communication to Crevis remote I/O

In this document we have used following software


• CoDeSys 3.5 SP7 Patch 1 (compiler version 3.5.7.10)
• iX Developer 2.20 SP1

In this document we have used following hardware


• iX T7B SoftControl
• Remote I/O, Crevis FnIO-S Series, NA-9173 and I/O modules

For further information we refer to


• iX Developer Reference Manual (MAxx831)
• iX Developer User's Guide (MAxx832D)
• Driver help in iX Developer
• CoDeSys, Manuals and help in the software

This document and other Start Up documents can be obtained from our homepage.
Please use the address [email protected] for feedback on our Start Up documents.
Normal.dotm, 070221

www.beijer.se 2 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

3 Table of Contents
1 Function and area of use ....................................................................................................................................... 1
2 About this Start Up document .............................................................................................................................. 1
3 Table of Contents ................................................................................................................................................... 3
4 First step! ................................................................................................................................................................ 4
5 Program example ................................................................................................................................................... 4
6 iX TxB SoftControl connections ........................................................................................................................... 5
7 Driver versions used in CODESYS ...................................................................................................................... 6
8 Configuration of CODESYS and Modbus RTU ................................................................................................. 7
Create a new CODESYS project................................................................................................................... 7
Adding Modbus RTU drivers ........................................................................................................................ 7
Modbus configuration settings ..................................................................................................................... 9
Modbus RTU Slave, NA-9173, Example ..................................................................................................... 11
Global Variable List (for programming and export to iX Developer) ........................................................ 12
I/O mapping, Modbus Slave ....................................................................................................................... 15
PLC Settings ............................................................................................................................................... 17
Write program ............................................................................................................................................ 18
Export Variables to iX Developer............................................................................................................... 20
Transfer CODESYS project to iX TxB SoftControl..................................................................................... 22
9 Configuration of iX Developer (iX TxB SoftControl) ....................................................................................... 24
Rename the driver....................................................................................................................................... 24
Import of variables ..................................................................................................................................... 25
iX driver help for SoftControl Direct Access .............................................................................................. 27
iX Developer project................................................................................................................................... 28
Download iX project to T7B SoftControl ................................................................................................... 28
10 Hardware iX TxB SoftControl, NA-9173 .......................................................................................................... 29
Installation.................................................................................................................................................. 29
Dip Switch setting, NA-9173 ...................................................................................................................... 30
Dip Switch setting, NA-9473 ...................................................................................................................... 31
Normal.dotm, 070221

www.beijer.se 3 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

4 First step!
For best understanding and easy working with iX TxB SoftControl we recommend:
• Read through StartUp document KI00375 (iX TxB SoftControl, Basic setting).
• Prepare the computer with the programming tools CODESYS and iX Developer.
• Basic knowledge of CODESYS. There is a quick start in CODESYS help file.
• Download manuals
• Install iX TxB SoftControl device description in CODESYS.

Note!
Always use the correct version of the drivers and software!

5 Program example
Supplied with this document there is a folder containing example program för iX Developer
and CODESYS. This is a program that can be opened and/or downloaded to the iX TxB
SoftControl panel for reference. Included is also a export folder to upload the project via
USB-memory.

Tip!
By importing the CODESYS project the installation of the iX TxB device and driver libraries
are automaticly made on your computer.
Normal.dotm, 070221

www.beijer.se 4 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

6 iX TxB SoftControl connections

24 VDC COM 1/2 LAN A USB LAN B COM 3/4

RTU

TCP

Ethernet
Modbus
EtherCAT
Note!
COM Ports 1, 2 and 3 are supported.
These ports are locked and can not be switched by the software:
COM 1 – RS232
COM 2 – RS485
COM 3 – RS232

RS422 will not be possible to use unless using a protocol converter.


Normal.dotm, 070221

www.beijer.se 5 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

7 Driver versions used in CODESYS


This step is important!
As described in the Start-Up document Basic Settings regarding runtime version, it’s
important to use the correct compiler version and library versions that match the CODESYS
runtime version.

A rule of thumb is that you should add the latest driver version but never go above the
runtime version.*

For example, the Modbus TCP Master driver.


Below you can see a list of driver versions, the list is different depending on the CODESYS
versions that’s installed on your PC.

The version 3.5.6.0 is the correct version because this is the highest version available that’s
not above the runtime version, in this case 3.5.7.10:

This is the correct version because CODESYS 3.5.7.10 is/have been installed on the PC

* Exception to the rule is bugfixes made within the same CODESYS service pack (patches).
For example, using driver version 3.5.7.40 for runtime version 3.5.7.10 is OK.
Normal.dotm, 070221

www.beijer.se 6 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

8 Configuration of CODESYS and Modbus RTU


Create a new CODESYS project
Create a new standard project using iX TxB SoftControl as device.
Tip!
See Start-Up document Basic Settings for info on how to do so.

Adding Modbus RTU drivers


The iX TxB SoftControl uses the drivers Mobdus Master COM Port and Modbus Slave COM
Port to communicate with the slaves.
A generic Modbus COM driver is added for the connection to the COM port on the device.

8.2.1 Modbus COM


• Highlight Device (iX TxB SoftControl) and right click
• Click Add Device and mark Modbus COM version 3.4.0.0.
• Click Add Device
Normal.dotm, 070221

It’s important to use the correct version! See chapter 7 for more details.

www.beijer.se 7 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

8.2.2 Modbus RTU Master


Now we can add the Modbus RTU Master.
• Highlight Modbus COM and right click.
• Click Add Device and mark Modbus Master. COM Port version 3.5.7.0.
• Click Add Device.

8.2.3 Modus RTU Slave


In the same way, we now have to add Modbus RTU Slave under the master.
• Highlight Modbus_Master_COM_Port and right click.
• Click Add Device and mark Modbus Slave, COM Port version 3.5.4.0.
• Click Add Device.
Normal.dotm, 070221

www.beijer.se 8 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

Modbus configuration settings


When we have a tree-structure like the picture below, we have to change some settings.

8.3.1 General Modbus RTU COM Port settings


• Double click on Modbus_COM.
• In the General tab, change settings so that they match the slave. COM Port, Baudrate,
Parity etc.

• In the same way, change settings for the Modbus Master COM Port, if needed.
Normal.dotm, 070221

www.beijer.se 9 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

8.3.2 Remote IO configuration (Modbus RTU Slave)


In the Modbus RTU Slave, we now have to setup the Modbus protocol for the remote IO, in
this case NA-9173.
• Double click on Modbus_Slave_COM_Port.
• Change Slave Address to that of the slave in the General tab.

• Click on the Modbus Slave Channel tab.


• Click on Add Channel…
• For this application, set like the picture below.
More information in next chapter.

Result
Normal.dotm, 070221

www.beijer.se 10 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

Modbus RTU Slave, NA-9173, Example


• Analog input ST-3424, 4 channel 0-10 V
• Analog output ST-4422, 2 channel 0-10 V
• Digital input ST-1218 (8 channel), ST-1214 (4 channel)
• Digital output ST-2328 (8 channel), ST-2524 (4 channel, with diagnostic)

8.4.1 Input and Output Register Map


• 6 register for input (address 0x0000 – 0x0005)
• 3 register for output (address 0x0800 – 0x0802)

Input Process Image (mode 2, default)


Addr. #15 #14 #13 #12 #11 #10 #9 #8 #7 #6 #5 #4 #3 #2 #1 #0
0x0000 Analog Input Ch0 high byte (Slot#1) Analog Input Ch0 low byte (Slot#1)
0x0001 Analog Input Ch1 high byte (Slot#1) Analog Input Ch1 low byte (Slot#1)
0x0002 Analog Input Ch2 high byte (Slot#1) Analog Input Ch2 low byte (Slot#1)
0x0003 Analog Input Ch3 high byte (Slot#1) Analog Input Ch3 low byte (Slot#1)
0x0004 Empty Discrete In 4pts Discrete In 8 pts (Slot#3)
Always 0 (Slot#4)
0x0005 Empty Diagnostic In 4pts Empty Discrete In 4pts
Always 0 (Slot#7) Always 0 (Slot#5)
Output Process Image (mode 0, default)
Addr. #15 #14 #13 #12 #11 #10 #9 #8 #7 #6 #5 #4 #3 #2 #1 #0
0x0800 Analog Output Ch0 high byte (Slot#2) Analog Output Ch0 low byte Slot#2)
0x0801 Analog Output Ch1 high byte (Slot#2) Analog Output Ch1 low byte Slot#2)
0x0802 Empty Discrete Out 4pts
Discrete Out 8pts (Slot#6)
(Slot#7)
0x = hex => 0x0800 = 800 hex
In our example we use Function Code 23 (Read/Write multiple register in one telegram).
If you change the function code to “04” (read input register) and code “16” (write multiple
register) there will be two telegram to the slave node.
Normal.dotm, 070221

www.beijer.se 11 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

Global Variable List (for programming and export to iX Developer)


8.5.1 Global Variable list
• Highlight Application entry in Devices.
• Right click and select Add Object.
• Select Global Variable List.
• Give the variable list a name.

• Write global name for the I/O.


The global name should be connected in Modbus RTU I/O Mapping.
Normal.dotm, 070221

www.beijer.se 12 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

• Write global name for memory cells and register (volatile memory)
Normal.dotm, 070221

www.beijer.se 13 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

8.5.2 Persistent variables (32 kbyte)


Persistent variables (non-volatile memory) can ONLY be declared in a special global
variables list, which is assigned to an application. There might be only ONE such list per
application.

• Highlight Application.
• Right click and select Add Object.
• Choose Persistent Variables..

• Write Persistent Variables (non-volatile)


Normal.dotm, 070221

www.beijer.se 14 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

I/O mapping, Modbus Slave


Go back to the Modbus RTU Slave and click on the tab
ModbusGenericSerialSlaveI/OMapping..

• Map the global variable list to the corresponding I/O’s, analog and digital.
• Starting with inputs:
Normal.dotm, 070221

www.beijer.se 15 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

• Outputs:

Note!
There are 3 ways of mapping I/Os:
1. Create variables in Global Variable list and connect the variables in I/O Mapping (above).
2. Create variables “on the fly” by typing directly into the I/O Mapping (a star symbol will
appear to notify that the variable has been created). The variables will be available just
like normal GVL.
3. Use IEC addressing. Usefulll in some special cases.

• Mark!
Always update variables and select Enable 2.
- All variables status are updated (even those not used in the program).
See Online Help for more information.

Note!
Not nessary if the Always update variables is set in PLC Settings (parent setting). This is
recommended and will be the general behaviour for the application.
Normal.dotm, 070221

See next chapter.

www.beijer.se 16 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

PLC Settings
In the PLC Settings of the Device (double click Device) there are options related to the IO
handling that can be changed depending on application.
We recommend to change Always update variables to “Enabled 2”.

See CODESYS Online Help for detailed information (click F1 to open help).
Normal.dotm, 070221

www.beijer.se 17 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

Write program
Normal.dotm, 070221

www.beijer.se 18 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

• Rebuild the program

• If no Error, go to next step!


View error, warning and message with the Messages window View\Messages

Note!
• When Generate code is made there can be warning like the picture.
It´s only a warning. The project is working correct.

• Compiler warning like “C0308” can be unchecked.


Menu\Project\Project setting\Compiler warnings.
Normal.dotm, 070221

www.beijer.se 19 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

Export Variables to iX Developer


In order to be able to export variables from CODESYS to iX Developer a
“Symbol configuration” object is needed. Symbol Configuration will create a xml-file which
can be imported to iX Developer.
• Highlight Application, right click and select Add Object.
• Choose Symbol configuration.

• Make sure to Build the project first.


• Simply check the variable list/lists that should be exported.

The xml file for iX Developer is created automaticly when you transfer the project to the iX
TxB SoftControl or when executing Generate code from Menu\Build. The file is saved in
same folder as the CODESYS project.
Normal.dotm, 070221

www.beijer.se 20 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

It’s important to note that the variables that are selected in the Symbol Configuration also
desides which variables that can be externaly accessed, for example iX Developer or other
devices/hardware using ARTI protocol.
Therefore, the Symbol Configuration have to be downloaded to the Device each time it has
been changed and a new xml-file will be created. The iX Developer taglist also have to match
the Symbol Configuration in order to connect to the variables.
If you are trying to access a tag that is not available in the Symbol Configuration you will get
a controller error message in the iX HMI application.
Normal.dotm, 070221

www.beijer.se 21 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

Transfer CODESYS project to iX TxB SoftControl


A gateway needs to be created in order to communicate between the PC and the HMI.
• Double click on Device (TxB SoftControl).
• Select the Communication settings tab.
• If no gateway is present, create one by selecting Add Gateway (choose default value).
• Click on Scan Network and double click on your device.
• The last two digits in the ID (65 in the picture below) corresponds to the last byte in the IP
address, written in Hex.
(Hex 65: Dec 101).

Note!
If you can’t find the device via Scan network, try to manually enter the IP address.
Normal.dotm, 070221

www.beijer.se 22 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

• Download the project to the device (TxB SoftControl) which was selected.
Menu\Online\Login.

• The project will now be downloaded to the device.


• Set the PLC (SoftController) to RUN state with “F5” or the symbol.

• Green will indicate working communication!


Normal.dotm, 070221

www.beijer.se 23 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

9 Configuration of iX Developer (iX TxB SoftControl)


Setup an iX application
• In the start-up wizard, select Create New Project.
• Choose the iX TxB SoftControl panel size on which the application will run (T7B
SoftControl in this example)
• Click “Next”
• Select the driver. The brand is CODESYS and the protocol is SoftControl Direct Access

• Click Next
• Enter the name and the path of the project
• Click Finish

Rename the driver


• In click Tags and go to the tab Controllers.
• Change the name to SoftController
Normal.dotm, 070221

www.beijer.se 24 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

Import of variables
At this stage, it’s time to import the xml-file that was exported from CODESYS.
• Go to the tab Tags.
• In the window, choose the Import tags to option and select the controller name.

• Browse to the location where the CODESYS project is saved.

• Select the xml file with the same name as the CODESYS project.

Tip! Check the option “Connect selected import file to project” to remember the connection.

• Click Import.
• A import dialog will appear, select All items and press OK
• The imported variable(s) should now be featured in the taglist
Normal.dotm, 070221

www.beijer.se 25 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

9.2.1 Import rules for connected import file


The import module makes it possible to import symbols and structs from XML export file
generated by CODESYS.
• Click on “….” to add rules for the import.

Function in Import module


• This would import all tags starting with “application” or which included the text “HMI”
Normal.dotm, 070221

www.beijer.se 26 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

iX driver help for SoftControl Direct Access


• In the tab Controllers, select the controller and click on the button Settings…
• This picture show default values, normaly no changes are needed.
• Driver help is opend when click on Help.

Timeout and Driver help


Normal.dotm, 070221

www.beijer.se 27 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

iX Developer project
Add and configure a project in iX Developer.
• You can copy from the example project

Download iX project to T7B SoftControl


Finally download the iX project to the device
• Menu\Project\Download
• After the validation is performed, a screen with the available devices appears.
Highlight the panel and click Download.

After download, the HMI application starts up and communicates with the SoftControl!
Normal.dotm, 070221

www.beijer.se 28 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

10 Hardware iX TxB SoftControl, NA-9173


Installation
Connect iX TxB SoftControl to NA-9173 / NA-9473 like the picture.
The iX TxB SoftControler support COM 1, 2 and 3.

iX TxB-SC
NA-9173

120 Ω 120 Ω

iX TxB-SC NA-9473

120 Ω 120 Ω

• Use CAB112 to connect iX TxB SoftControl with NA-9173 / NA-9473


Normal.dotm, 070221

www.beijer.se 29 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

Dip Switch setting, NA-9173


Set the slave address to 1:
- MSD (X10) set to 0
- LSD (X1) set to 1

• Communication (SW1-4:ON, SW5-8:OFF)


COM 2, Baud Rate 115200, Enable Watchdog, 8 Bit, None Parity,
1 Stop Bit, RTU mode
Normal.dotm, 070221

www.beijer.se 30 (31)
iX TxB SoftControl (Codesys runtime 3.5.7.10) - FnIO-S Modbus RTU KI00375 2016-05

Dip Switch setting, NA-9473


The dip switches are placed at left side of NA-9473

• Set Node adress to 1 (SW1, 1:ON, 2-4:OFF)

• Set Baudrate to 115200, RTU mode (SW2, 1-3:ON, 4:OFF)

NOTE!
Byte Format are fixed to: 8 Bit, No Parity, 1 Stop Bit
Normal.dotm, 070221

www.beijer.se 31 (31)

You might also like