The example demonstrates how to perform CAN Bus Frame and Signal conversion, leveraging the NI-XNET API for parsing the database.
The attached zip contains an example VI demonstrating the signal to frame, and frame to signal conversion, using a class. This code uses the XNet API for database parsing but the conversion itself is done with pure G. The Frames to Signal conversion function is a polymorphic VI and supports 4 different modes: Single Sample Double, which reads the latest value for the signal, XY which reads every value along with a timestamp for each value, Waveform, which reads every value into a waveform, and Single Sample String, which reads signals and displays them by converting doubles to strings, and displaying enumerated signals as their string representations. Going in the reverse direction is also supported with the String to Frames supporting an array of doubles, or an array of strings.
Steps to Implement or Execute Code
There are three examples on the root with instructions in each. For the Basic and Mux example just run the VI and look at the output. For the Conversion Speed Test, select the conversion test to perform by changing the tab value, then run the VI.
Additional Information or References
**The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text 'NIVerified'. Read here for more information about the new Example Guidelines and Community Platform.**
NI社区“代码范例交流区”(Example Code Exchange)中的代码范例已获得MIT许可。