To download NI software, including the products shown below, visit ni.com/downloads.
OverviewVector 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 2020 or later for version 4.
The required DLLs are included in the version 4 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 4. 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.
Description-Separate-2
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
Gentlemen, thank you very much for putting in all this work!
I'm trying to work with a CANcaseXL. I installed all the drivers and tried "\Vector XL LV2018 v3 Hooovahh Edit FD and 64 Bit\CAN\Vector Example CAN Read Write.vi". I'm getting an error 6117 from "CAN Open Channel.vi".
Any ideas?
Yeah that is weird. Where do the values for the Channel Settings come from? I recommend calling the CAN Get Channels which should return an array of channels that the XL drivers found. Then you can index the first one, or check for the array size to be what you expect. With my VN1630 it does enumerate the first device as Hardware Index and Hardware Channel at 0, so your settings might be correct.
The drivers seem installed since the error 117 XL_ERR_NOT_IMPLEMENTED is an error from the driver. Can you use this hardware with any other Vector software on this computer? Is the hardware seen in the Vector Hardware Config program? I'm not sure what would cause this error.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
The Channel Settings do come from the CAN Get Channels VI, I just posted the isolated issue.
Vector Hardware Config tool does see the hardware.
Update: I tried Version 3 (instead of 4) with "CAN Open Channel.vi" and that at least got me past this VI without errors. Next error I ran into (vector xl driver error 112XL_ERR_INVALID_ACCESS) was at "CAN Receive.vi".
Just for kicks, I tried using Vector XL LV2011 v2.zip and luckily I was able to communicate with the Vector CANcaseXL module without any errors. I was able to transmit and receive CAN messages.
Since I have a setup where one code set works and one doesn't, please let me know if there are any tests I can run that might help fix any issues.
Hello to all
Has anyone made an example with ethernet? I am trying to create it but I am getting an error in the method create driver config.
Hello, is there a way to assign a session to a string value for the Automotive Diag Command Set to read the vector device as something like CAN1?
From what I can understand, the ADC set needs a string value of the Channel and Hardware to use for Diag Comm, so CAN1@nixnet will assign it to Channel 1 of an XNET Card and there seems to be a few options to modify to some other hardware, like using XNET on cRIO. So I am hoping there is a way to do something like CAN1@canXLControl to use the Auto Diag commands in LabVIEW, using a Vector Device.
@SteveG87, NI's ADC toolkit is not compatible with non-NI hardware. You cannot put in a string for something for the Vector hardware and have it work. It only supports XNet, and NI-CAN devices. A large part of the ADCS toolkit uses the ISO 15765 protocol. I have a blog post talking about it here, along with some code and examples on how to do UDS and other similar multi frame messages, using Vector hardware. The source is available, and open, but comes with no support.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
How can I send and receive the messages defined in the LDF with these tools?
Is there an automatic "translation" from the LDF frames to the BUS signal and back or do I have to send or encode the message manually in HEX format [0B 00 00 FE FE FE 3F 0A E8] (ID + 8 data bytes)?
As I understand the "Read ldf.vi", I cannot select and send the defined messages or frames from the LDF, or do I understand something wrong? please help me.
I'm unfamiliar with the Read LDF.zip in this post. In the past I would use XNet to read and parse DBCs and LDFs. The XNet API software can be installed without any additional license, and the database, and conversion can be done without any XNet hardware. There are functions for importing an LDF or DBC, and then you can use the property nodes to get the scaling, and bit information. If you do install XNet software there should also be an XNet Database Editor, which allows you to import files, and look at the frames, signals, and other settings.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
Hi everyone!
Do you know that in vector XL api is there a way to confirm if the Channel i'm trying to open is available or is being used by another application?
Best regards.
Has anyone created a wrapper for the ETH messages? I am trying to create one to read and write ETH frames.
Kindly post any ideas or sample wrappers created.
Thanks in advance,
yshiv
There is no good way to respond to requests that appear as comments in an example-code document.
And for some reason ni.com stopped sending me notifications when people post comments here.
If you want to ask a question: DO IT IN THE FORUM, NOT HERE. (See bold red note in document text.)
LDF: The Read ldf vi just parses an ldf file. You have to write the code to use the information from the ldf with the wrapper library yourself.
It is possible, I have done it, it works well. But I don't own the IP, it isn't open source or mine to share.
Is the channel open elsewhere? Check the permissionMask output when you open the port. If it is the same as your accessMask then you have control. Any bits that are missing in the mask has been opened somewhere else.
ETH: No, I haven't don't the Ethernet part of the API yet. You are welcome to add it, thanks.
I added this wrapper library in the first place in the hopes that others would contribute (like @Hooovahh has, thanks Hooovahh 😉).
Yes you are correct. I hate these types of large data manipulation functions because they can be error prone like this. If anyone else needs to fix this, don't try to update each Data65 all the way down. Instead you can right click on 63, then say add element then make that 64. Do the same on the build array to add an input where needed. Oddly enough I must have miscounted too because the Data95 is added to the end multiple times. Delete the two duplicates and the last 2 items in the build array. I'll plan on a release fixing this.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
Hello @Hooovahh, thank you for Version 4 and to support CAN-FD. Is it possible to add A2L file and dcm file in your vector drivers? It will be good to do calibration from dcm file and to read and write some signals from A2L file.
A2L parsing is a pain for sure, but also it is outside of the scope of this driver level tool. If I were to ever release something it would be a separate toolkit that handles just that. The only thing I've been able to do is use NI's ECU Measurement and Calibration Toolkit to read the A2L file. Once you get the file opened and understood you then usually need XCP or CCP to do the actual communication. I have some very minor success with with running a trial of the NI toolkit, then looking at the CAN bus to see what was sent and received. Using that I was able to write some codes that does the Connect, Get Status, Get PAG Processor, Get DAQ Info, Unlock, and only then can you do things like Get and Set Characteristics which is what I presume you need to do. What I've come up with is fairly ugly, and uses NI's code from the ECU MC toolkit to do the heavy lifting. So distributing what I've done online isn't an option.
Another challenge is just my experience with XCP, CCP, and A2Ls if fairly limited. There's lots of variation in the communication and it isn't something I deal with often so I don't know what things to look out for or issues. I've done stuff with ISO15765, and UDS, most of my career and I have probably forgotten more about that, than I know about A2Ls.
If someone else can come up with a parsing utility for the A2Ls Maybe I could use it and share what I have. Things like Get XCP Property from the name, Get ECU Names, Measurement Names, Characteristic Names, Event Channel Names, Defined Pages, Groups, Functions, Get Address Property, Data Type, Byte Order, Minimum, and Maximum of Parameters or Characteristics. Realistically it is something like 150 functions wrapped into a couple Polymorphic VIs.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord