| Contents | Index |
Real-Time Windows Target
The Packet Output block sends unformatted binary data. After you have added a Packet Output block to your model, double-click the Digital Output block to open the Block Parameters: Digital Output dialog box.
The driver must be Standard Devices > Serial Port, Standard Devices > UDP Protocol, Standard Devices > File, or Vector > CAN Device. Specify parameter values as required, then click OK or Apply. When you install a UDP device, enter port addresses in decimal format in the Standard Devices UDP Protocol dialog box.
Any serial output port can send data with sample rates up to 500 Hz. To enable a faster sample rate of up to 10 kHz for some output serial ports, see the following. The software does not support this option with all types of serial output hardware.
Click Install new board.
From the drop-down list, select Standard Devices > Serial Port.
The Standard Devices Serial Port dialog box is displayed.
In the Standard Devices Serial Port dialog box, select the Direct port access check box.
Continue as usual, and then click OK when done.
Enter a value representing how frequently you want the block to execute and interact with the I/O hardware. The block will also synchronize your model with the real-time clock at this sample rate.
Enter the number of timer ticks that your model can lag behind the real-time kernel. When the model lags by more than this number, the block reports an error and simulation stops. Otherwise, simulation continues even if some ticks are missed.
Select this check box to display the current number of missed ticks as a block output.
Select this check box to grant other programs more CPU time while the kernel waits for a response from the hardware.
Enter the ID of the packet to receive. If your protocol does not have packet IDs, this parameter is disabled.
Enter the number of bytes to be transmitted in the output packet. This number must be the same as the number of bytes required by the type specifications in Output packet field data types.
Enter a string, or a cell array of strings, that specifies how data provided by the application will be formatted into a packet for output to the device. The Packet Output block has an input port corresponding to each string in Output packet field data types. Changing the number of strings automatically changes the number of ports.
Each string has the format [n*]datatype. The data described by the string has the type specified by datatype and the width specified by n; or 1 if n is not specified. For example, 'double' means one double value, and '4*int8' means a vector of four int8 values.
The signal input to each port of the Packet Output block can be a scalar or vector of any Simulink data type. The string for each port specifies the type to be used when its signal is output to the device. If the format string for a port matches the type of the signal input to that port, the signal value appears verbatim in the output packet.
You can also perform type conversion on output. For example, if an input signal is a four-element int16 vector, but the corresponding string is '4*int8', each of the four integers is converted to an int8 before being written to the packet. The resulting data occupies four bytes in the output packet.
From the list, select:
Little Endian
Default. Receive multibyte values in little-endian format.
Big Endian
Receive multibyte values in big-endian format.
Select this check box to indicate that the block has an output port that signals 1 if the block is ready to accept new data, and 0 otherwise.
Select this check box to indicate that the block has an output port that signals 1 if a data error has occurred, and 0 otherwise.
Optional. Enter a vector that has the same number of elements as the sum of the widths of the input signals across all ports. The specified data is sent when simulation begins, before any other data that is output during simulation.
Optional. Enter a vector that has the same number of elements as the sum of the widths of the input signals across all ports. The specified data is sent when simulation ends, after any other data that is output during simulation.

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 |