OverviewI have spent some time creating and updating these wrapper VIs for the Vector XL driver vxlapi.dll.I thought it might be a good idea to upload it here instead of in the forum, that way I can update it when new hardware is released or bugs are found and fixed. Descriptionhas 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 (vxlapi.dll) that comes along with it in your own custom applications.RequirementsVector XL series hardware or VN series hardware and drivers installedvxlapi.dll (See below for driver library installation)LabVIEW 2011 or later. Driver dll DownloadTo get the dll and driver go to the 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's useless and requires a rather expensive license. Well ok, it probably isn't useless, but it gives you very little control or functionality compared to directly calling the dll.From the download page select: XL Driver Library Drivers & Firmware AllNow 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 (I'm currently using 9.0.34).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.I have NOT included the dll, header file or API documentation. These you must get from the Vector website as per their terms and conditions.These VIs are provided for free.
They come without any warranty. If you decide to copy them and try to sell them, don't blame me if Vector takes legal action against you.Here I just provide wrappers and an example or two to get you started.
Below is one simple example of transmitting a CAN frame. ExamplesThe '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 dependancies should now be containied 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, NOT HERE. I will get a notification and reply in the forum if you add vxlapi as a tag. Two years ago, I made my best to make my HWCAN work and it worked, but I always felt that my VIs were not enough good to anyone.
Early this year I saw your comment in my post and i got curius, but had no time, but now there is a new project and I have to develop some SW/HW for it so.I've just looked your VIs and they seems to be nice. Specially because I'd need the DriverConfiguration VI, which I never develop, maybe I could now automate the process I left before and make them more reliable.Well, thanks again for this sharing and keep doing nice things!!Regards. Very cool awesome work. I couldn't help but notice I can transmit but not receive? Is the DLL capable of doing a receive on CAN? And regarding the transmit is it possible to have a hardware timed transmit? Say if we wanted to transmit every 10ms is our only option with the API be to call the transmit every 10ms?
Or does the DLL support a retransmit of a message? Thanks.EDIT: Never mind about the receive I'm an idiot. It isn't under the CAN section because it isn't CAN specific it is under VIs called xl Receive. Okay I found 2 bugs both quite minor and I'm not sure one is even your fault.First, in the xlOpenPort command you tell it the size of the rxQueue. I set this to 100, then wrote on the bus over 150 messages. As expected I only got 100 and the other 50 were lost because the queue was too small. But what was strange is the XL Status returned Success, instead of XLERRQUEUEISFULL.
I added some code to detect if the number of messages read were equal to the buffer size and if so to set that error.Second, using your CAN Transmit there is no way to write a message that is in the extended format, but be 0x7FF or less. If the ArbID is greater then 0x7FF it must be extended, but if it is less then that it can be extended or not.

To fix this I added code to set the appropriate bit inside the Data 3 byte to tell the transceiver to write it as extended or not.I also was not able to find any information on retransmitting CAN messages using this library. Maybe that is what you get when you pay for the LabVIEW API Vector has developed. Size of the rxQueue.set this to 100, then wrote on the bus over 150 messages. The XL Status returned Success, instead of XLERRQUEUEISFULL.' Yep, that sounds like a bug with the driver.
Not much I can do about that with the wrapper VIs.' There is no way to write a message that is in the extended format, but be 0x7FF or less.' The arbitration ID is a U32, the CAN protocol uses 11 for standard ID or 29 bits for ectended, BUT the vector CAN vxlapi driver uses bit 32 of the arbitration ID value to determine if the message is extended. So, 0x000007FF will be standard ID, 0x800007FF will be 0x7FF as an extended ID message.NOTE: NI CAN uses bit 30 to indicate an extended ID message. Nibo wrote: Do you have some examples for receive module?The 'Simulate LIN network.vi' shows how you can receive LIN type XL Events. It is almost identical for receiving CAN type XL Events.It should be noted that there is a bug in the vxlapi.dll for receiving LIN type XL Events.For CAN XL events you can read multiple XL Events from the buffer in a single read.However for LIN XL events you can only read one at a time.Consult the 'XL Driver Library - Description.pdf' api document for instructions.
Hi ToryK:I tried you provided VI on CAN communication, Most of them are working fine. Just having one question on CAN receive message function. In original Vector manual, the receive function should use Set Notification to create thread for trig messgae ready. Then received message.But I thought this kind of method can't work in LV. So I just tried use XL Receive.VI to get message and it seems work. But the problem is message feed to Get Event String.VI will trsnalste as wrong data. But the raw tag data is correct.

Do you have anu idea on this kind of issue? The receive function can use Set Notification but it doesn't have to.You can use to get the notification.I have used it for CCP and UDS when I only want to receive a response, not monitor all messages.Otherwise you can just poll for messages in the receive buffer (similar to what you are doing).The method you are using to get messages will fail if less than 2 messages are available in the buffer. If only one xlEvent is present the function will output an error and you will discard the xlEvent. If you are going to poll for messages you should use the xlGetReceiveQueueLevel function to check if messages are available before reading them from the buffer.Tag Data: I never use the xlGetEventString function. Maybe it has a problem?I use 'VXLAPI-ConvertDataTo-sxlcanmsg.vi' which I wrote to extract CAN tag data.You are also assuming that all xlEvents received will actually be CAN type events. XlReceive will also receive error frames, chipstate events etc etc.
Perhaps the message you are receiving is not a CAN event but contains old (seemingly valid) data. But maybe the string would reflect that? I don't know. Hello sallesa,I have not used LIN as master to send data to slaves, only to get data from them.The xlLinSetSlave function description in the XL Driver Library document states:'This function is also used to setup a slave task within a master node.'
Labview Serial Driver
Vector's 'LIN protocol reference chart' also states that a response can be sent by a slave or a master.So I guess you set the master node to respond to it's own request header. Then any slave nodes listening will be able to get the data when you use xlLinSendRequest.So try this:1. Use xlLinSetSlave on the master node to set a slave task to fill in the data you wish to send,2.
After the channel is activated, use xlLinSendRequest with the ID you wish to transmit,The slave task in the master node will fill in the data after the request ID header comes out, effectively transmitting data to slaves.The data can then be changed the same way it would be for any other slave task.Please let me know if this works. Hi,I am using the transmit example with some modification for CAN transmit and receive in LabVIEW 2013 using vector CAN CaseXL. I need that vi in LV 7.1 so that i have convert it to 7.1But I got some wire loose ends which is connected with call library function. I have remove and delete that loose ends. While i save that vi, i got the error message as complier error.
May i know what is the reason for that error comes,Can you please help me to resolve the error.Also i have attached the snap of that errors. The problem you're having seems to be related to the down conversion to LabVIEW 7.1.It appears to have broken at least some of the call library function nodes.The earliest version I can save back to is 8.0 and even when I fixed the broken wires it resulted in a memory corruption error.Edit The down-conversion seems to modify the array type parameter definitions in the Call Library Function Nodes. It seems to be ticking all the 'constant' checkboxes in function prototype parameters for array types. This causes the memory corruption.To get it to work after saving to LabVIEW version 8 or earlier you will need to:(A) Reconnect all the broken wires and(B) Open all the CLFNs and untick the 'constant' checkboxes set on any parameters.You will be able to see quickly if any of the parameters have been set to 'constant' by observing the function prototype definition.E.g. Int16t xlReceive@12(int32t portHandle, uint32t.pEventCount, const void.pEvents);Notice const in the function prototype, it needs to be changed.Please ask support questions in the, not here in document comments.Add vxlapi as a tag and I automatically get a notification. (This instruction is in big bold red letters above.).
Labview Programming Examples Pdf
Hi Antonino,As I stated in my document: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.That's why you're having trouble trying to do the import yourself.All these wrappers that you're trying to recreate are already in the ' file attached above. The work is done for you.
Michi1988That error code text says 'At least one parameter passed to the driver was wrong or invalid.' Do you have 3 VN1610 devices plugged in and you are trying to address the third one?You are selecting hwIndex 2. If you only have one VN1610 plugged in it is hwIndex 0.I believe the answer to your problem was already posted 18 months ago.kurtushI believe there is something else wrong than just changing to extended ID. 255 XLERROR means the driver doesn't know what went wrong. When this error appears (mostly during development) I unplug the hardware and plug it back in again to fully reinitialize the driver. I can assure you that both STD and EXT CAN settings work properly. If you have modified the code and there is something wrong with it you will have to attach it.I would appreciate it if support requests were posted to the LabVIEW Forum rather than here in the document comments section.
As I state in the document above:If you have a support request please post it in the, NOT HERE. I will get a notification and reply in the forum if you add vxlapi as a tag. TroyKThank you for your answer, i solved this problem and it works very fine.But i had a new problem.I would like to combine the receive.vi and the transmitt.vi in one single.vi.This.vi should be able to receive and transmitt can message in parallel. I dont't know how i cancombine this because the vxlapi can transmitt make a lot of problemes if i implement this in thereceive.vi.Can sombody please help me with this problem or had somebody a complete.vi with thisfeatures? I think it should be possible to receive and send in one.vi. OR not?Best regards!Mike.