02-15-2013 12:07 AM
I am attaching the Project. Please check the demo.vi. The error occurs in xlActivateChannel.vi
Thanks
Sujith
02-17-2013 05:03 PM - edited 02-17-2013 05:14 PM
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:
07-03-2013 07:43 PM
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