For both Transforms, the input port parameters along with the Transform properties determine the output port parameters and run-time behavior. Set the Base Data Type and Base Data Endianness in the Transform's properties.
For both Transforms, no data interpretation is performed (such as to convert to variable length strings).
This Transform accepts a one-dimensional array signal as input and outputs a message signal. It is useful for converting vector signals from a Simulink model.
The size of the array and message are determined by the input signal. If an array element is not updated, it retains its value from the previous transition. For this reason, it is recommended to clear (zero out) the array before loading a new message.
The input has a signal type of Array. The Y dimension must be 1; at transform load time, an error is thrown if it is greater than 1.
The output is a fixed-length message. The length of the message is determined by multiplying the X dimension of the input array by sizeof(base data type). The sizeof base data type is determined as Uint8 = 1, Uint16 = 2, or Uint32 = 4. To view the message in MxVDev, use the Signal Properties to select the appropriate text encoding.
At run time, for each array transition received on the input port, a message transition is created such that each array element integer is encoded into a little or big endian byte stream. These bytes are positioned in the corresponding message bytes. The default value for the output is zeros.
The Transform properties are configured with a Base Data Type of UInt16 and a Base Data Endianness of big-endian (such as for Unicode big-endian text). The maximum length of the array is 5. This creates an output port that sends a message with a fixed length of 10.
For more examples, see the StringSample project.
This Transform accepts a message signal as input and outputs a one-dimensional array. It is useful for converting message signals for input to a Simulink model.
The input has a signal type of Message. Use the Signal Properties to select the appropriate text encoding for viewing the message in MxVDev.
The output is an array sized X-by-1, where X is the maximum message-length divided by sizeof(base data type). The sizeof base data type is determined as Uint8 = 1, Uint16 = 2, or Uint32 = 4. At transform load time, an error is thrown if the maximum message-length is not a multiple of sizeof(base data type).
At run time, for each message transition received on the input port, an array transition is created such that each sizeof(data type) bytes of the message are interpreted either a little-endian or big-endian integer. This value is transmitted in a corresponding array element. Only those array positions that have changed are transmitted.
Variable length messages are padded with zeros from the end of the message to the maximum message-length.
The Transform properties are configured with a Base Data Type of UInt16 little-endian variable-length (such as for Unicode text). The maximum length of the message is 32 bytes. This creates an output port that sends 16-by-1 array transitions.
At run time the following messages are sent: