Home

mlamp

Download EtherCat_Exampes.zip

EtherCAT Example

This example shows how to read and write IDN"s with ServoDrive over EtherCAT.
Another example shows how to read and write SDO"s with CAN over EtherCAT as well as downloading
a firmware file with File over EtherCAT.

Product description

ServoDrive over EtherCAT
This example shows how to read and write IDN"s with ServoDrive over EtherCAT. As hardware a
Rexroth IndraDrive is used. It is also possible to switch the device to another one which uses
ServoDrive over EtherCAT.

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

File over EtherCAT
This example shows how to read and write SDO"s with CAN over EtherCAT as well as downloading a
firmware file with File over EtherCAT. It is also demonstrated how to get information about the master
and slaves, like the number of active slaves or the state of the slave.
As hardware two analog terminals with CAN over EtherCAT are used. The File over EtherCAT functions are
implemented theoretically, without hardware.

For device configuration several startup parameters can be set. For devices which use CAN over EtherCAT
an index and sub index is used for each parameter. For each parameter it is possible to read or write
the value as number or byte array with a maximum of four bytes.

More information

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

Two startup parameters are already set at the beginning. Look at the "startup parameters" tab on the device.
The "slave" tab shows the EtherCAT address which is used to select the device. In the "EtherCAT_Master"
device under the "Master" tab the correct source address, where the device is connected must be set.

SoE: First the program has to wait for the EtherCAT master to be ready. Afterwards the IDN number 32
is read from device 1001 which was already set at startup. Additionally an IDN is written to the device
and afterwards it is read again once as UINT value and as byte array.
It is possible to read the name, attribute, unit, minimum, maximum and value of an IDN. Use the specific
value at "byElem" for that. The "byDrive"value is not set, because the used device only has one.
The index of the EtherCAT master is set at "usiCom" and the address in "uiDevice". Depending on the device,
the timeout must be set high enough.

File over EtherCAT
For device configuration several startup parameters can be set. For devices which use CAN over
EtherCAT an index and sub index is used for each parameter. For each parameter it is possible to read
or write the value as number or byte array with a maximum of four bytes.

Parameters for EL4132 and EL3142 are set before startup. By double click on one of these devices the
"Startup parameters" tab is shown. One is already set and with the "New" button, more can be selected.
The "Slave" tab shows the EtherCAT address which is later used for selecting the device. In the
"EtherCAT_Master" device under the "Master" tab the correct source address, where the device is
connected must be set.

CoE: First the program has to wait for the EtherCAT master to be ready. Afterwards the parameter
from device 1002 which is already set is read in a byte array and as dword. Additionally a parameter
of four bytes is written and read afterwards. A parameter larger than four bytes is also written in this
example.
So far only the parameter values are used, but it is also possible to read the complete entry into a
byte array. These values are device specific. All function blocks contain an "udiSdoAbort" variable.
If an operation is canceled, this variable returns an abort code. The error to this code can be found
in the CANOpen Spec.

FoE: This function demonstrates a way how to download a fictional firmware with File over EtherCAT.
After the EtherCAT master is ready, memory for the complete firmware will be allocated. Then the specific
slave is set to boot mode to download the firmware. When the download is finished, the memory will be
released.
The upload function has no direct relation to the firmware example it shall only demonstrate how the
instance is called.

System requirements and restrictions

System requirements and restrictions Info
Programming System CODESYS Development System Version 3.5.14.0 or higher
Runtime System CODESYS Control Version 3.5.14.0
AdditionalRequirements ServoDrive over EtherCAT: Rexroth IndraDrive Basic Cs (or any other device which uses ServoDrive over EtherCAT). To run the example with a CoDeSys Control Win V3 the WinPcap library must be installed (for a free download look at winpcap.org) .Add the component “Component.5=SysEthernet” into“~\3SCoDeSys\GatewayPLC\CoDeSysControl.cfg”.File over EtherCAT: EtherCAT Beckhoff EK 1100EL4132

|Required Accessories | -|

Screenshot thumbnail
Screenshot "ServoDrive over EtherCAT"
Screenshot thumbnail
Screenshot "ServoDrive over EtherCAT"
Screenshot thumbnail
Screenshot "File over EtherCAT"
Screenshot thumbnail
Screenshot "File over EtherCAT"