Skip to main content

Example: Servodrive over EtherCAT

Product: CODESYS EtherCAT

Description

This example shows how you can read and write IDNs with ServoDrive over EtherCAT. As hardware, a Rexroth IndraDrive is used. You can also exchange the device with another device which uses ServoDrive over EtherCAT.

Additional information

You can set several startup parameters in the device configuration. These parameters are called IDNs for devices using ServoDrive over EtherCAT. For each IDN, you can set the name, attribute, unit, minimum, maximum, and value as a number or byte array with a maximum of four bytes.

_example_img_servodrive_over_ethercat1.png

Two startup parameters are already set at the beginning. Look at the Startup Parameters tab on the device. The General tab shows the EtherCAT address used to select the device. For the EtherCAT_Master device under the General tab, you need to set the correct source address where the device is connected.

_example_img_servodrive_over_ethercat2.png

SoE: First, the program has to wait until the EtherCAT Master is ready. Afterwards, the IDN number 32 is read from device 1001 which was already set at startup. In addition, an IDN is written to the device and afterwards it is read again one time as a UINT value and as a byte array.

You can read the name, attribute, unit, minimum, maximum, and value of an IDN. To do this, use the specific value at byElem. The "byDrive" value is not set because the used device has only one channel (=axis). The index of the EtherCAT Master is set at usiCom and the address at uiDevice. Depending on the device, you may need to set the timeout high enough.

System requirements and restrictions

Programming system

CODESYS Development System (version 3.5.14.0 or higher)

Runtime system

CODESYS Control Win (version 3.5.14.0)

Add-on components

-

Note

_example_icon.png DOWNLOAD Project