Codesys CMT Quick Start Guide
Codesys CMT Quick Start Guide
Codesys CMT Quick Start Guide
Maple Systems, Inc. | 808 134th St. SW, Suite 120, Everett, WA 98204 | 425.745.3229
Table of Contents
Set up CODESYS and Device .......................................................................................................................... 3
Creating a CODESYS Project .......................................................................................................................... 4
Connect CODESYS to EBPro .......................................................................................................................... 7
Connect iR-ETN to CODESYS ....................................................................................................................... 13
Connect iR-COP to CODESYS ....................................................................................................................... 19
Connect iR-ECAT to CODESYS ..................................................................................................................... 26
3. Activate CODESYS on your cMT device by connecting it to the internet, opening the HMI system
settings menu, unlocking it, select the Network tab and ensure Obtain an IP Address
Automatically is enabled. Then open the CODESYS tab and enter the CODESYS Activation Code
and click Active.
b. In the Standard Project menu, select the Weintek Built-in CODESYS (Weintek Labs., Inc.)
device:
b. Click Scan Network and select the cMT-X device. Note that the last two IP address octets
are converted to hex and used the identifier in square brackets seen here as cMT-1E10
[000E]. This makes the IP address of this cMT device xxx.xxx.0.14:
d. Note that it is also possible to simply type the IP address of the cMT-X device into the
Scan Network tab device section:
Clicking on this will open the errors and warnings. If there are any errors, and this is the
first CODESYS project created, build errors are likely due to missing libraries. Open the
errors and double click one to open the Library Manager:
To fix this, simply click the Download Missing Libraries button, then with all libraries
selected, click Download:
b. Select Build -> Generate Code to generate the XML file, which can be found in the
project directory:
c. You can now access all tags from your CODESYS project in EBPro.
1. Right click on Device (Weintek Built-in CODESYS) and select Add Device:
2. In the Add Device window, select Fieldbuses -> Ethernet Adapter -> Ethernet version 3.5.10 and
click Add Device:
5. Select the new Modbus TCP Master device, then select Fieldbuses -> Modbus -> Modbus TCP
Slave -> Modbus TCP Slave and click Add Device:
7. Double click the Modbus TCP Master device and navigate to the ModbusTCPMasterParameters
tab and set AutoReconnect to TRUE:
8. With CODESYS connected to the base device, i.e. Device (Weintek Built-in CODESYS), click […] in
the Ethernet device General tab and select the Network interface corresponding to the Ethernet
device’s IP address:
9. Double click on the Modbus TCP Slave device and go to the ModbusTCPSlave Parameters tab.
There, change the Unit-ID Parameter to match the Unit ID on the iR-ETN module:
11. Double click on PLC_PRG in the Devices pane and add a Boolean tag:
12. With the tag added, double click on the Modbus TCP Slave device once more, go to the
ModbusTCPSlave I/O Mapping tab, expand the Variable tree entirely and click the […] button to
connect it to the new read Boolean tag:
1. Right click on Device (Weintek Built-in CODESYS) and select Add Device:
2. In the Add Device window, first check the Display all versions checkbox, and then select
Fieldbusses -> CANbus -> CANbus version 3.5.10 and click Add Device:
7. To map tags to the CANopen device, first add tags to the PLC_PRG application. In this example,
BOOL tags are used as the only IO module connected to the iR-COP is an iR-DM16-P:
9. Now map the variables in PLC_PRG to the IO modules attached. In this example, we are only
using a iR-DM16-P, so we will double click that module, navigate to the CANopen-Module I/O
Mapping tab, and connect each created Boolean variable and attach them to the corresponding
IO:
2. In the Add Device window, check the Display all versions checkbox and then select FieldBusses -
> EtherCAT -> Master -> EtherCAT Master Version 3.5.10.0 and click Add Device:
6. Add all attached IO modules in order. This can be done in two ways:
a. Scan for Devices
i. Right click the EtherCAT Master device and click Scan For Devices. If the gateway
for the EtherCAT Master device is set up, and the PC is able to login to the
CODESYS device, this will automatically scan the connected iR-ECAT module and
find all attached IO modules, allowing them to be added all at once. In this
example, only a DM16-P is connected:
9. While in the EtherCAT I/O Mapping tab of the iR_ECAT device, set the Always update variables
to Enabled 2 (always in bus cycle task):
10. Finally, in the iR_ECAT device settings, go to the Expert Process Data tab and check the PDO
Assignment and PDO Configuration checkboxes in the Download section:
AW-10101092 Rev 00
Maple Systems, Inc. | 808 134th St. SW, Suite 120, Everett, WA 98204 | 425.745.3229