Conversion Mode
- Updated2025-10-10
- 3 minute(s) read
This mode is intended to convert NI-XNET signal data to frame data or vice versa. It does not use any NI-XNET hardware, and you do not specify an interface when creating this mode.
Conversion occurs with the nxConvertFramesToSignalsSinglePoint or nxConvertSignalsToFramesSinglePoint functions. None of the Read or Write functions work with this mode; they return an error because hardware I/O is not permitted.
Conversion works similar to Single-Point mode. You specify a set of signals that can span multiple frames. Signal to frame conversion reads a set of values for the signals specified and writes them to the respective frame(s). Frame to signal conversion parses a set of frames and returns the latest signal value read from a corresponding frame.
In addition, the nxConvertFramesToByteArraySinglePoint and nxConvertByteArrayToFramesSinglePoint functions allow for raw byte extraction/insertion of the signal bytes from/to a frame. For this mode, the conversion session must only span one signal, and this signal must be byte aligned (both start bit and number of bits). If these conditions are not met, the functions will return an error. Byte ordering is ignored in this case; the bytes are transferred in ascending order from/to the frame. This mode will work for signals >64 bits as well; it is the only way of accessing such signals.
Example 1: Conversion of CAN Frames to Signals
Suppose you have a database with a CAN frame with ID 0x123 and two unsigned byte signals assigned to it (byte 1 and byte 2).
Creating an appropriate conversion session and calling nxConvertFramesToSignalsSinglePoint with the following input
results in the following signal values being returned:
Explanation: The data are taken from frame 4. Frames 1 and 3 are ignored because they have a wrong (unmatched) ID. Frame 2 is ignored because its data are overwritten later with the values from frame 4, because frames are processed in the order of input.
Example 2: Conversion of Signals to FlexRay Frames
Suppose you have two FlexRay frames with slot ID 3 and 6, and each one has assigned a two-byte, Big Endian signal at byte 2 and 3 (zero based). Suppose also that all relevant default values of other signals in the frame are 0.
Creating an appropriate conversion session and calling nxConvertSignalsToFramesSinglePoint with the following input
causes the following frames to be generated:
Explanation: The first signal is converted to the byte sequence 0x01, 0x02 (1 x 256 + 2), and the byte sequence is placed at byte 2 of the frame with slot ID 3. The second signal is converted to byte sequence 0x03, 0x04 (3 x 256 + 4) and placed at byte 2 of the frame with slot ID 6. All other data are filled with the default values (0).