PROFINET IndraControl XM21 ctrlX CORE plus X3 Profinet connection using CoDeSys Fieldbus libraries

PROFINET - Connect ctrlX COREplus X3 with IndraControl XM21

sanX
New Contributor

1. Overview

In this article, it will be explained how to connect a ctrlX COREplus X3 with a IndraControl XM21 using the PROFINET connection. This connection can also be done between a ctrlX CORE X3 and an IndraControl XM21. The IndraControl will be first configured using the IndraWorks Engineering program, and the ctrlX CORE will be configured with the CoDeSys Profinet libraries using ctrlX PLC Engineering program.

ctrlX CORE plus X3 IndraControl XM21 PROFINET Connection

2. Prerequisites
3. IndraControl XM21 configuration

Note: It will be assumed that the user knows how to install the IndraWorks Engineering program

1. Connect the IndraControl XM21 to the Engineering computer using the Ethernet port located in the IndraControl XM21 (XF5) and plug it to the computer Ethernet port. Make sure to establish correctly the static IP address. Once done this, open the IndraWorks Engineering program and create a new project:

  1. Create a new project
  2. Select "empty project"
  3. Enter a project name
  4. Press "Ok"

Project creation

2. Add device

  1. Right click over the project name
  2. Press "Add"
  3. Select "Add" again
  4. Choose the type of IndraControl (In this case we will use the IndraControl XM2 series)
  5. Double click over "IndraControl XM2"

Device selection

  • Step 1: General Properties -> Introduce a device name and press "Next"
  • Step 2: Hardware/communication
  1. Select the Device release
  2. Select the communication type
  3. Introduce the XM2 IP address
  4. Select the PLC gateway
  5. Test the connection

Hardware/Communication configuration

  • Step 3: Extended settings. Keep everything as default
  • Step 4: Function packages. Only select Programmable Logic Control

Function packages configuration

  • Step 5: Interfaces
  1. Extensionmodule: In this case only the RT-Ethernet will be used
  2. sercos: Choose SercosIII Master
  3. Press "Finish" and wait until the configuration is performed

Interfaces configuration

3. Set PROFINET device

  1. Right click over "Not_Used"
  2. Select "Set device"
  3. Select "PROFINET IO Controller XM"

Profinet IO Controller addition

  • Configure the device
  1. Double click over "PROFINET_IO_Controller_XM"
  2. Select the "General" tab
  3. Choose an IP address for the PN-Device
  4. Configure the IP address range

Ethernet node configuration

4. Add PN-Device description: To be able to scan and recognise the Profinet device or to add the PN-Device it is required to install the device description. In this case, the ctrlX CORE description is needed.

  • Press the following link and download the ctrlX CORE device description

ctrlX CORE device description download

  • Return back to the IndraWorks Engineering program, and select "Tools" -> "Device database"

Device Database Menu access

  • Press "Add devices

Device addition

  • Select the previously unzipped .xml file.

GSDML file selection

5. Add PN-Device to the devices tree

  1. Right click over "PROFINET_IO_Controller_XM"
  2. Select "Add"
  3. Select "Add" again

Device addition

  1. Select the I/O section
  2. Double click over CODESYS Profinet Device
  3. Close the window

Codesys Profinet device addition

  • Configure CODESYS Profinet Device
  1. Double click over CODESYS Profinet Device
  2. Define a station name
  3. Check the IP address

ctrlX CORE node configuration

  • Add input:
  1. Right click over "ctrlx-core-xcr"
  2. Add
  3. Module
  4. Input
  5. Select "Input 8 Bit"

Input variable addition

  • Follow the same steps for the output:
  1. Right click over "ctrlx-core-xcr"
  2. Add
  3. Module
  4. Input
  5. Select "Output 8 Bit"

Output variable addition

 

6. Write a little program to write values 

  • Global variable definition
  1. Double click over "UserVarGlobal"
  2. Define the variable "counter"

Global variable definition

  • Program definition
  1. Double click over "PlcProg (PRG)"
  2. Define variables
  3. Write the lines of code:
//Counter
UserVarGlobal.counter := UserVarGlobal.counter + 1;
//Input will take the counter value
input := UserVarGlobal.counter;
//Equal output with input
output := input;

Variable and code description

7. Map the variables

  • First, the input variable will be mapped
  1. Double click over "Input_8Bit(Input 8Bit)"
  2. Select the I/O Mapping tab
  3. Write the desired variable to map. In this case it will be the "input". To add it it is required to write "Application.PlcProg.input"

Variable mapping

Note: To find easier the variable, double click over the black space, expand the tree and double click over the variable

Input variable mapping

  • The same steps are followed for the output variable:
  1. Double click over "Output_8Bit(Output 8Bit)"
  2. Select the I/O Mapping tab
  3. Double click over the blanck space or press over the three points
  4. Expand the "Application" tree -> Expand the PLC program tree to find the defined variables
  5. Double click over the "output" variable
  6. Press "Ok" to close the window

Output variable mapping

4. ctrlX COREplus X3 configuration
  • In this section, it will be shown how the ctrlX COREplus X3 has to be configured. First, connect the ctrlX CORE to the Engineering computer using the Ethernet connection. It is recommended to check the instructions shown in the following link: Quick Start Guide ctrlX CORE 

1. Open ctrlX PLC Engineering program and create a new project

  1. Select "New project"
  2. Select the ctrlX CORE template
  3. Provide a project name
  4. Press "Ok" to close the window

Project creation

2. Communicate to the ctrlX CORE

  1. Right click over "Device"
  2. Select "Communication settings"

Communication settings window access

  1. Enter the ctrlX CORE IP address
  2. Test the connection and cehck the message
  3. Close the window

Communication between ctrlX CORE and PLC program configuration

Note: Before starting with the communication configuration it is required to install the CoDeSys Fieldbus libraries. Please follow the steps shown here: Manual - CODESYS Fieldbus communication packages for ctrlX CORE. In the case the user has access to the collaboration room, download the packages from this link.

3. Add Ethernet device

  1. Right click over "Device"
  2. Select "Add device"

Device addition

  • In the Profinet IO tab -> Ethernet Adapter, select "Ethernet" and press "Add device"

Ethernet node addition

4. Configure Ethernet node

  1. Double click over "Ethernet"
  2. Click over "Browse" to find the ctrlX CORE network connections
  3. Select the "eth1" connection
  4. Press "Ok" to close the window

Ethernet node configuration

  • Write the IP address defined in the IndraControl XM21. In this case it was 192.168.10.2. Write the subnet mask (255.255.255.0).

Ethernet node configuration

5. Add CoDeSys Profinet device

  1. Right click over "Ethernet"
  2. Select "Add device"

Device addition

  • In the Profinet IO Device tree, select "CODESYS Profinet Device" and click over "Add device"

Codesys Profinet node addition

6. Change priorities

Double click over "Profinet_communicationTask" -> Include a priority of 37 as a recommendation

Priority change

For the "Profinet_IOTask" the same steps are followed:

Double click over "Profinet_IOTask" -> Include a priority of 30 as a recommendation

Priority change

7. Configure CODESYS Profinet Device

  1. Double click over "CODESYS_Profinet_Device"
  2. Select "Use project parameters"
  3. Write the station name defined in the IndraControl XM21. In this case "ctrlx-core-xcr"

Profinet node configuration

8. Add Input

  1. Right click over "CODESYS_Profinet_Device"
  2. Select "Add device"

Device addition

  • In the Profinet IO Module -> Input, select "Input 8Bit" and click over "Add device"

8Bit input addition

9. Add output

  1. Right click over "CODESYS_Profinet_Device"
  2. Select "Add device"

Device addition

  • In the Profinet IO Module -> Output, select "Output 8Bit" and click over "Add device"

Output_8bit addition

  • Now that both devices are configured, we are ready to test the connection

5. Testing

1. In the ctrlX PLC Engineering program, generate code and transfer the PLC program to the ctrlX CORE

Generate code and login buttons

2. Accept the program creation by clicing over "Yes"

3. Click the Run button

Run button

4. In the IndraWorks Engineering, perform similar steps. Click over the login button to transfer the PLC program to the IndraControl XM21

Login button

5. Accept the message by clicking over "Yes"

6. Press the Run button

Run button

  • Accept the message by clicking over "Yes"

Note: If everything works fine, the following symbols should be visible in the PLC Engineering program

Connection state check

  • In the case it does not work, perform a "Reset cold" and run the PLC program again

Reset cold

  • To check the received values, go to "Output_8bit" and check if the values are updated

Check that values are not updated

  • If the values are not updated as shown in the previous image, it is required to follow the steps:
  1. Unlog
  2. Select "Enabled 2"

Data update configuration

  • Login again, run the program, and check the updated values

Data exchange check

If still does not work, close the output window and open it again. Or also try to reset cold.

Note: In the IndraWorks Engineering program it is also possible to check the sent values

Data exchange check

6. Related Links
LunatiX
LunatiX
Hi, I'm Stefan from the DCEM Application Team. If you have any questions, do not hesitate to contact me.
Editorial work by: sanX
2 Comments
Must Read
Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist