To download NI software, including the products shown below, visit ni.com/downloads.
Vector provides an API for performing low level control of their hardware. The code posted here is primarily wrappers around their XL Driver APIs. These functions come in the form of the vxlapi.dll, and vxlapi64.dll.
Vector has some very nice products for testing vehicle communication buses such as CAN, LIN, MOST and FlexRay.
They sell some very expensive software and some reasonably priced hardware to go along with it.
You can buy just the unlicenced hardware and use the freely available driver that comes along with it in your own custom applications.
Vector XL series hardware or VN series hardware and drivers installed. This includes the older CANCase and newer VN16xx USB devices.
Windows Device Driver for the Vector hardware. Check if your device is recognized in Windows Device Manager.
LabVIEW 2018 or later for version 3.
The required DLLs are included in the version 3 zip. For those that don't the instructions below are for acquiring these drivers.
To get the dll and driver go to the Vector download page and download it. Just be sure to choose the right options when finding the XL Driver Library containing the dll.
IGNORE THE LABVIEW DRIVER! It is quite restrictive, and requires a rather expensive license.
From the download page select: XL Driver Library > Drivers & Firmware > All
Now click the button that says "Show Results...". You should now have a list of drivers available. Again, ignore the LabVIEW one. Download the XL Driver Library X.X.
Unfortunately the header file supplied with the driver dll doesn't readily import into LabVIEW. We had to make some significant modifications to it before it worked. Then I had to go through and make quite a number of corrections once it was done.
If you're curious the modified header file is called vxlapi3.h.
Here I just provide wrappers and an example or two to get you started. Below is one simple example of transmitting a CAN frame.
Hooovahh has made several changes based on user feedback, and released it as Version 3. The two main improvements to this version is to support CAN-FD reading and writing, and to support 64-bit LabVIEW as well. A more clean example also allows for simple reading and writing of frames, along with reading analog and digital values on hardware that supports it.
The "Basic LIN test.vi" assumes you are using the LIN channel to monitor a running LIN connection. It works as a silent slave node on the network.
To actually receive any LIN frames there must already be a LIN master communicating with another LIN slave.
VI in attached zip file.
"Simulate LIN network.vi" will transmit from one LIN channel set up as a Master node to other LIN channels set up to respond as Slave nodes.
There is now also a "Simulate LIN network -master transmit.vi" which allows you to transmit data from a Master to Slaves. (Remember that a master node MUST HAVE A PULL-UP!)
CAN Receive example added due to popular demand (updated with documentation and code tidy):
All example VIs and dependencies should now be contained in this latest zip file.
If you find any bugs or updates needed feel free to send me a message.
If you have a support request please post it in the LabVIEW Forum, NOT HERE. I will get a notification and reply in the forum if you add vxlapi as a tag.
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.