| Contents | Index |
Embedded Coder/ Embedded Targets/ Host Communication
Embedded Coder/ Embedded Targets/ Operating Systems/ Embedded Linux
Embedded Coder/ Embedded Targets/ Operating Systems/ VxWorks
Simulink Coder/ Desktop Targets/ Host Communication
Windows (windowslib)
Note If your target system uses Linux or Windows, get the UDP block from the appropriate library, linuxlib or windowslib. |
The UDP Receive block receives UDP packets from an IP network port and saves them to its buffer. With each sample, the block output, emits the contents of a single UDP packet as a data vector.
The generated code for this block relies on prebuilt .dll files. You can run this code outside the MATLAB environment, or redeploy it, but be sure to account for these extra .dll files when doing so. The packNGo function creates a single zip file containing all of the pieces required to run or rebuild this code. See packNGo for more information.

Specify the IP port number upon to receive UDP packets. This value defaults to 25000. The value can range 1–65535.
Specify the IP address from which to accept packets. Entering a specific IP address blocks UDP packets from any other address. To accept packets from any IP address, enter '0.0.0.0'. This value defaults to '0.0.0.0'.
Make the receive buffer large enough to avoid data loss caused by buffer overflows. This value defaults to 8192.
Specify the maximum length, in vector elements, of the data output vector. Set this parameter to a value equal or greater than the data size of any UDP packet. The system truncates data that exceeds this length. This value defaults to 255.
If you disable Output variable-size signal, the block outputs a fixed-length output the same length as the Maximum length for Message.
Set the data type of the vector elements in the Message output. Match the data type with the data input used to create the UDP packets. This option defaults to uint8.
If your model supports signals of varying length, enable the Output variable-size signal parameter. This checkbox defaults to selected (enabled). In that case:
The output vector varies in length, depending on the amount of data in the UDP packet.
The block emits the data vector from a single unlabeled output.
If your model does not support signals of varying length, disable the Output variable-size signal parameter. In that case:
The block emits a fixed-length output the same length as the Maximum length for Message.
If the UDP packet contains less data than the fixed-length output, the difference contains invalid data.
The block emits the data vector from the Message output.
The block emits the length of the valid data from the Length output.
The block dialog box displays the Data type for Length parameter.
In both cases, the block truncates data that exceeds the Maximum length for Message.
Set the data type of the Length output. This option defaults to double.
For each sample, wait this length of time for a UDP packet before returning control to the scheduler. This value defaults to inf, which indicates to wait indefinitely.
Specify how often the scheduler runs this block. Enter a value greater than zero. In real-time operation, setting this option to a large value reduces the likelihood of dropped UDP messages. This value defaults to a sample time of 0.01 s.
Specify the width of packets the block accepts. When you design the transmit end of the UDP communication channel, you decide the packet width. Set this option to a value as large or larger than any packet you expect to receive.
Specify the size of the buffer to which the system stores UDP packets. The default size is 8192 bytes. Make the buffer large enough to store UDP packets that come in while your process reads a packet from the buffer or performs other tasks. Specifying the buffer size prevents the receive buffer from overflowing.
Byte Pack, Byte Reversal, Byte Unpack, UDP Send

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 |