Jump to content

event driven receiving from cancardx


merlin

Recommended Posts

Hi everyone

i am new to labview. Trying to program a vi to receive and transmit CAN-messages with vector's CANcardX [1]. I need a structure like the c++-type of WaitforsingleObject(...). How can i do this with labview and is it then possible to set a number of such WaitForSingleObjects()?? Or could someone who has allready used the cancardx with labview point me to some info in that matter (other than the sample-vi)?

Thanks in advance.

[1]: http://www.vector-cantech.com/index.html?....ndriverlib.html

Link to comment

The first thing we really need to know is how are you trying to interface to the CANcard. Are you using the DLL or are you trying to use some sort of activeX object or method?

I have experience with the CANcard.DLL, you can interface to it using the methods listed in the back of the CAN driver manual. You can only read the card when NO other CAN applications are running, including CANalyzer or CANoe.

There is a ActiveX method to interface to the CANalyzer/CANoe software, but it seemed like a slow limited method when I tried it.

I mention this because each method is completely different in what you can do for filtering

Back to your question

You can make an object or notifier that will inform you when a specific message is found, but be aware that it will not work like normal. You will usually have to poll all messages found in the CAN receive buffer, then loop thru them until you find the message you are looking for. If you set the CAN mask and filter to be extremely tight, you can filter for only that message, then poll the CAN interface until you find it.

I would suggest reading the manual that came with the CAN card.

P.S. The Vector people have a library of VI's for interfacing to Labview, but you can only get it if you buy a specific support package, otherwise you will have to write your own from scratch like my company did.

Please repost or contact me if you have more questions

Link to comment
The first thing we really need to know is how are you trying to interface to the CANcard.  Are you using the DLL or are you trying to use some sort of activeX object or method?

I have experience with the CANcard.DLL, you can interface to it using the methods listed in the back of the CAN driver manual.  You can only read the card when NO other CAN applications are running, including CANalyzer or CANoe.

There is a ActiveX method to interface to the CANalyzer/CANoe software, but it seemed like a slow limited method when I tried it.

I mention this because each method is completely different in what you can do for filtering

Back to your question

You can make an object or notifier that will inform you when a specific message is found, but be aware that it will not work like normal.  You will usually have to poll all messages found in the CAN receive buffer, then loop thru them until you find the message you are looking for.  If you set the CAN mask and filter to be extremely tight, you can filter for only that message, then poll the CAN interface until you find it.

I would suggest reading the manual that came with the CAN card.

P.S.  The Vector people have a library of VI's for interfacing to Labview, but you can only get it if you buy a specific support package, otherwise you will have to write your own from scratch like my company did.

Please repost or contact me if you have more questions

3825[/snapback]

Hi first and thnx.

i am actually using the vis that come with the CanCardX Driver Library. Actually i found an update version on the vector-site (for free):

http://www.vector-cantech.com/index.html?....ndriverlib.html

Right now, i'm having the carcardx being polled every cycle. The problem i think is known: this way i eventually miss a message or my laptop dies of cpu-ageage. I'm thinking of transfering the whole thing to visual basic, there is a sample visual basic source in the driver library, that explains how to set up events for the cancard.

Another thing: At this time i do use the cancardx with two applications: labview is polling for new events and at the same time canoe is doing a rest-bus-simulation in the background - on the same channel.

Link to comment

It looks like you could the VI's to make event notifications with Labview, the Vevent structure will notify when you have a message to read, write, or other events. You just have to be willing to do some work on correctly configuring the events via labview before you start the run tasks, the Examples.

You might also want to increase the RXqueue size for the system if you have a large amount of CAN traffic, it looks like it could be increased up to 1024 messages. This would allow you to poll at a slower rate with less worry about losing messages. I typically run with CAN receive queues defined for anywhere between 100 to 300 elements, mainly due to the fact that the Windows based timing can show problems.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.