LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CANCASEXL,not able to open port for vxlapi.dll

I am attaching the Project. Please check the demo.vi. The error occurs in xlActivateChannel.vi

 

Thanks

Sujith

0 Kudos
Message 11 of 13
(2,867 Views)

The reason you are getting the INVALID_ACCESS error at the ActivateChannel function is that you have not defined which hardware and channel to use at the GetChannelMask function.

Inside that VI you set them both to -1. They should be set to actual attached hardware.

If you only have one CANcaseXL attached and wish to use channel 1, set hwIndex to 0 and hwChannel to 0.

 

The API documentation describes the required inputs for these functions. I recommend reading it carefully.

 

I see from your attached project that you have decided not to use the dll wrappers and typedefs I attached in an earlier post.

 

You don't have to use them, but it will save you a lot of trouble. There are at least 2 other problems with the demo.vi you attached.

1. Your idRange in CanSetChannelAcceptance is set to an invalid value.

2. The transmit function is corrupting memory, data type or length is wrong.

 

To help with a neat and logical layout you should try to have a consistent VI terminal layout. Error cluster I/O, port handle, channel mask should all have the same location in each VI.

Also use typedefs! This is all done in the VI library I attached.

 

I'm happy to continue to help you if you use the VI library I attached. If you wish to reinvent the wheel and use your own VIs then you're on your own.

Once again, read the vxlapi.dll API documentation carefully when you come across a problem. If the problem is corrupted LabVIEW memory, check that your datatypes match the documentation.

 

This works:

workingCANdemo.png

 

 

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
Message 12 of 13
(2,851 Views)

FYI: I've uploaded my wrapper library to an NI Community document so it can be updated.

 

https://decibel.ni.com/content/docs/DOC-3018

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 13 of 13
(2,757 Views)