| Contents | Index |
| On this page… |
|---|
What Is Model-Based Ethernet Communications? |
The xPC Target software supports communication from the target PC to other systems or devices using raw Ethernet (Ethernet packets). Raw Ethernet is a direct method to send and receive packets with the target application using the Ethernet protocol. To transfer data using Ethernet packets, you must manually create Ethernet frames. This topic assumes that you are knowledgeable about the Ethernet standard 802.3 standard.
Before you start, provide a dedicated Ethernet card on your target PC. A dedicated Ethernet card is to be used only for model-based Ethernet 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 Ethernet communication. The xPC Target software model-based Ethernet communication blocks support the Intel 8255X chip family.
To use the model-based Ethernet blocks, specify the PCI bus and slot number of the dedicated Ethernet card in the Ethernet Init block. To identify which Ethernet card is available:
Boot the target PC with which you want to perform model-based Ethernet communications.
Examine the startup screen on the target PC. Note the PCI bus and slot information on the bottom right of the display. For example, this Ethernet card is located on PCI bus 3, slot 10. This Ethernet card is installed on the target PC for dedicated communication between the host PC and target PC.

In the MATLAB Command Window, type
getxpcpci('all')This command determines which PCI boards are installed in the target PC.
Examine the list of PCI boards and look for the Ethernet cards.
In the list, find the Intel 8255X Ethernet card that is not in the bus and slot displayed on the target PC monitor.
Note the PCI bus and slot of the free Intel 8255X Ethernet card. This will be the Ethernet card you can use for model-based Ethernet communications.
A number of the Ethernet blocks require you to enter MAC addresses. The MAC address must be vector-based. To obtain the vector-based version of a MAC address, use the macaddr command. This command converts a string-based MAC address to a vector-based one. For example:
macaddr('01:23:45:67:89:ab')
[1 35 69 103 137 171]When an Ethernet block requires a MAC address, you can enter either of the following in the address field:
Command macaddr('MAC address string'), for example:
macaddr('01:23:45:67:89:ab')Vector-based output from the macaddr command, for example:
[1 35 69 103 137 171]
The xPC Target Ethernet block library uses pointers to refer to network buffers. Blocks can pass pointers to these buffers as single uint32pointers. They can also refer to a chain of network buffer packets.
The Filter Type and Filter Address blocks accept a chain of network buffers as input. Based on the criteria specified in the masks of these blocks, the drivers parse each buffer on the chain and either pass the packets through the port or drop the packets. When using these blocks, create your models with filter blocks to pass data only from expected sources.
The raw Ethernet blocks have the following execution priority, from first to last:
All other raw Ethernet and network buffer library blocks
To access the xPC Target Ethernet library blocks, in the xPC Target block library, double-click Ethernet. The xPC Target Ethernet library is displayed.

The xPC Target Ethernet library contains commonly used Ethernet blocks at the top level of the library. Use these blocks to create your models.
The Ethernet library also has a sublibrary, Network Buffers, which contains blocks specific to the management of Ethernet network buffers. The blocks in this sublibrary are core blocks that you might want to use to create other subsystems. However, the top-level Ethernet blocks provide enough functionality for model-based Ethernet communications. See Network Buffer Library for Model-Based Ethernet Communications Support for an alphabetical list of network buffer blocks.
![]() | Model-Based Ethernet Communications Support | xPC Target Demonstrations for Model-Based Ethernet Communications | ![]() |

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 |