Updating NI-XNET CAN Frames Payload Using Signals in Frames on LabVIEW

Updated Mar 11, 2024

Environment

Software

  • LabVIEW

Driver

  • NI-XNET

While working with XNET, you might need to manipulate the payload data of the CAN frames using the signals contained within these frames. 
There could be multiple reasons why this would be needed, for instance, manipulating the signals in CAN frames and calculating the CRC from the manipulated payload in another VI and sending it to the CAN bus.
Before you start, make sure that your LabVIEW and NI-XNET versions are compatible by checking here.
The following steps will show you how to update Frame data using those signals through the use of Property Nodes.

1. Input a Frame data array of clusters on the input: This will serve as the data needed to be updated. 
2. Initialize an array of boolean bits to serve as the array that will update the payload.
3. Grab the Signals from the input frame using the XNET Frame Property Node.
4. Use the XNET Signals Property Node to update to grab the value of the start bit and total number of bits in the signal.
5. Update the signal to whatever value is needed.
6. Turn the input value to an array of bits, and use it to update the initialized array to reflect whatever value is needed.
7. Split the array of bits and make an array of unsigned integers.
8. Bundle the payload into the Frames data cluster.

XNET Frame Signal Manipulation.png
Note: In order to use this snippet, download this image, and then drag and drop it on your LabVIEW block diagram.


The resulting VI uses the values of the signals in the Frames and updates the data of the input Frames.