Detailed instructions for use are in the User's Guide.
[. . . ] Target Support PackageTM 4 User's Guide
How to Contact The MathWorks
Web Newsgroup www. mathworks. com/contact_TS. html Technical Support
www. mathworks. com comp. soft-sys. matlab suggest@mathworks. com bugs@mathworks. com doc@mathworks. com service@mathworks. com info@mathworks. com
Product enhancement suggestions Bug reports Documentation error reports Order status, license renewals, passcodes Sales, pricing, and general information
508-647-7000 (Phone) 508-647-7001 (Fax) The MathWorks, Inc. 3 Apple Hill Drive Natick, MA 01760-2098
For contact information about worldwide offices, see the MathWorks Web site. Target Support PackageTM User's Guide © COPYRIGHT 20092010 by The MathWorks, Inc.
The software described in this document is furnished under a license agreement. The software may be used or copied only under the terms of the license agreement. [. . . ] The Windows OS does not have a selection; the default base rate priority is set to THREAD_PRIORITY_HIGHEST (10) and the process running the generated code has NORMAL_PRIORITY_CLASS. The process running single-tasking models has Default scheduling policy when model is single-tasking or there is a single rate in the model. Static priority of the process is 0 in this case.
3-10
4
Block Reference
Host CAN Blocks (canmsglib) (p. 4-3) Target preference blocks for target boards Target preference blocks for target boards
4
Block Reference
Host CAN Blocks (canmsglib)
CAN Pack CAN Unpack Pack individual signals into CAN message Unpack individual signals from CAN messages
4-2
Host Communication (hostcommlib)
Host Communication (hostcommlib)
Byte Pack Byte Reversal Byte Unpack UDP Receive UDP Send Convert input signals to uint8 vector Reverse order of bytes in input word Unpack UDP uint8 input vector into Simulink data type values Receive UDP packet Send UDP message
4-3
4
Block Reference
4-4
5
Blocks -- Alphabetical List
Byte Pack
Purpose Library Description
Convert input signals to uint8 vector Host Communication (hostcommlib) Using the input port, the block converts data of one or more data types into a single uint8 vector for output. With the options available, you specify the input data types and the alignment of the data in the output vector. Because UDP messages are in uint8 data format, use this block before a UDP Send block to format the data for transmission using the UDP protocol.
Dialog Box
Input port data types (cell array) Specify the data types for the different signals as part of the parameters. Enter the data types as Simulink types in the cell array, such as 'double' or 'int32'. The order of the data type entries in the cell array must match the order in which the data arrives at the block input. The block always has at least one input port and only one output port.
5-2
Byte Pack
Byte alignment This option specifies how to align the data types to form the uint8 output vector. Alignment can occur on 1, 2, 4, or 8-byte boundaries depending on the value you choose. Given the alignment value, each signal data value begins on multiples of the alignment value. The alignment algorithm ensures that each element in the output vector begins on a byte boundary specified by the alignment value. Byte alignment sets the boundaries relative to the starting point of the vector. Selecting 1 for Byte alignment provides the tightest packing, with no holes between any data types for any combination of data types and signals. In such cases, specifying a 2-byte alignment can produce 1byte gaps between uint8 or int8 values and another data type. In the pack implementation, the block copies data to the output data buffer 1 byte at a time. You can specify any of the data alignment options with any of the data types.
Example
Use a cell array to enter input data types in the Input port data types parameter. The order of the data types you enter must match the order of the data types at the block input.
5-3
Byte Pack
In the cell array, you provide the order in which the block expects to receive data--uint32, uint32, uint16, double, uint8, double, and single. With this information, the block automatically provides the proper number of input ports. Byte alignment equal to 2 specifies that each new value begins 2 bytes from the previous data boundary. The example shows the following data types:
{'uint32', 'uint32', 'uint16', 'double', 'uint8', 'double', 'single'}
When the signals are scalar values (no matrices or vectors in this example), the first signal value in the vector starts at 0 bytes. Then, the second signal value starts at 2 bytes, and the third at 4 bytes. [. . . ] This option defaults to
double.
Blocking time (seconds) For each sample, wait this length of time for a UDP packet before returning control to the scheduler. Note This parameter appears only in the UDP Receive block from the Target Support Package product. Sample time (seconds) Specify how often the scheduler runs this block. In real-time operation, setting this option to a large value reduces the likelihood of dropped UDP messages. [. . . ]