| Contents | Index |
| On this page… |
|---|
The Ethernet for Control Automation (EtherCAT®) is an open, high-performance Ethernet network protocol for real-time distributed control. You can use an EtherCAT network instead of an Ethernet network because the EtherCAT protocol provides:
Deterministic and fast cycle times
Inexpensive hardware cost
EtherCAT networks consist of one master node and several slave nodes. The xPC Target EtherCAT sublibrary supports only the master node of an EtherCAT network. In other words, you cannot emulate slave nodes using these blocks. However, you can prototype multiple EtherCAT controllers, with multiple Ethernet cards, using these blocks.
This topic assumes that you:
Are familiar with Ethernet and EtherCAT networks
Are familiar with CAN networks
Are familiar with CANOpen networks
Have access to, familiarity with, and know how to use the Beckhoff® ET9000 EtherCAT configurator software
You can build models that contain EtherCAT blocks with xPC Target supported compilers, except for:
Microsoft® Visual C++® compiler versions less than Version 7.1
All Open Watcom compilers
Provide a dedicated Ethernet card on your target PC. A dedicated Ethernet card is to be used only for model-based EtherCAT communications and not for communication between the host PC and target PC. This requirement means that your target PC must have at least two Ethernet cards, one for host PC to target PC communications, and one for model-based EtherCAT communication. The xPC Target software model-based EtherCAT communication blocks support the following Intel (Vendor ID 0x8086) chipsets:
| Device ID | Chip Description |
|---|---|
| 0x1229 | Intel PRO/100 M Desktop Adapter: 82557, 82558, 82559, 82550, 82551 |
| 0x1209 | Fast Ethernet Controller: 82551xER, 82551IT |
| 0x1059 | Fast Ethernet PCI Controller: 82551QM |
| 0x2449 | Integrated 10Base-T/100Base-T TX Ethernet Controller: 8x559ER |
| 0x103A | LAN Controller: 82562ET, 82562EZ, 82563ET, 82801DB |
| 0x1039 | LAN Controller: 82562ET, 82562EZ, 82562VE, 82562VM |
| 0x1050 | Pro/100 VE Network Connection: 8201EB, 8201ER |
| 0x27DC | Intel PRO/100 VE Desktop Adapter: 82562V |
Download or purchase the Beckhoff ET9000 EtherCAT configurator software, available at:
http://www.beckhoff.com/english.asp?ethercat/et9000_et9200_et9300.htm
Navigate to http://www.mathworks.com/programs/ethercat/ and follow the download instructions to download a zip file. This zip file enables you to build and download EtherCAT models to the target PC. Failure to download the zip file prevents you from building and downloading EtherCAT models. You can create EtherCAT models without downloading the zip file.
Design and configure an EtherCAT network.
Create an EtherCAT configuration XML file for this network. The xPC Target EtherCAT blocks require this configuration XML file.
The xPC Target EtherCAT blocks support the following EtherCAT data types:
| EtherCAT Data Type | Data Type Size (bits) | Converted Simulink Data Type |
|---|---|---|
| bit | 1 | uint8 |
| bit8 | 8 | uint8 |
| bitarr | 8 (bit array) | uint8 |
| bitarr16 | 16 (bit array) | uint16 |
| bitarr32 | 32 (bit array) | uint32 |
| BOOL | 1 | Boolean |
| int8 | 8 | int8 |
| int16 | 16 | int16 |
| int32 | 32 | int32 |
| int64 | 64 | Not available |
| uint8 | 8 | uint8 |
| uint16 | 16 | uint16 |
| uint32 | 32 | uint32 |
| uint64 | 64 | Not available |
| float | 32 | real32_T |
| double | 64 | real_T |
The xPC Target EtherCAT blocks are not available in the standard xPC Target library. Instead, to access these blocks, from the MATLAB Command Window, type:
xpcethercatlib
The EtherCAT block library is displayed.

This topic describes a basic workflow for using the xPC Target EtherCAT sublibrary. It assumes that you:
Have an EtherCAT network
Have access to the EtherCAT configurator software
Know how to use the EtherCAT configurator software to create a configuration XML file
See Before You Start for more information.
Connect to the EtherCAT network.
Use the Beckhoff ET9000 configurator to configure the EtherCAT network.
This step produces a network configuration file, contained in an XML file.
From the Beckhoff ET9000 configurator, export the XML configuration file.
In the xPC Target model for the EtherCAT master, add an xPC Target EtherCAT Init block.
Double-click the Init block and enter the configuration file name from step 3 in the EtherCAT configuration file parameter. Use single quotes around the configuration file name.

Configure the rest of the block.
Add and configure other EtherCAT blocks, such as the EtherCAT Rx Var and EtherCAT Tx Var blocks. At the very least, each model must contain the EtherCAT Init, EtherCAT Rx Frames, and EtherCAT Update blocks. Add an EtherCAT Rx Var or EtherCAT Tx Var block for every EtherCAT device variable that is linked to a variable in an ET9000 task.
When you add EtherCAT blocks to the model, the blocks automatically obtain the list of variables from the XML configuration file specified in their associated EtherCAT Init block. The parameter dialog boxes of these blocks are updated with the configuration information.
Repeat steps 1 to 6 for each EtherCAT network that you want. Use a different Ethernet card interface for each EtherCAT network.
The EtherCAT blocks have the following execution priority, from first to last:
This topic lists the configurator components that have corresponding xPC Target elements. It does not describe how to use the configurator. See the Beckhoff ET9000 EtherCAT Configurator for documentation on how to use the tool.
The EtherCAT configuration file that you specify in the EtherCAT Init block describes the network, including the device variables of the network. When you specify a device variable from this network, the block variable information corresponds to signal information on the block mask and block parameter dialog box.
If your model contains the EtherCAT COE Read and EtherCAT COE Write blocks, include in the configuration file at least one cyclic input/output task linked to one of the slave device input/output channels.
Do not name the configuration file with the name modelname.xml.
Create at least one task for data transfers.
To perform data transfers at multiple rates, create multiple tasks in the configurator. The data transfer rates must be multiples of the fastest task rate. The task rate that you create in the configurator must match the fastest rate in the Simulink model.
You can create more than one task at the same rate.
| ET9000 EtherCAT Configurator Component | Corresponding xPC Target Component |
|---|---|
| Execution rate of EtherCAT task | Sample Time/Task Rate |
| Scalars and vectors | Dimension |
| BitSize | Type Size (see EtherCAT Data Types) |
| Data Type+BitSize | Signal Type (see EtherCAT Data Types) |
| BitOffs − 80 | Signal Offset |
| EtherCAT device variable that is linked to a variable in an ET9000 task | EtherCAT Rx VarSignal Name |
| Task scheduling | EtherCAT UpdateTask priorities |
| Tasks | EtherCAT UpdateTask Id List |
| Each device variable in Process Image entity | Depending on purpose, EtherCAT Rx Var or EtherCAT Tx Var block |
![]() | Model-Based EtherCAT Communications Support | Blocks — Alphabetical List | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |