LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CANCard dll call

Greetings to all,

I'm having troubles getting one function of a dll written in C to work for me. I'm sure it's something in my setup, but I can't figure it out because I'm not a C programmer, and none of the C programmers here know how to set things up in LabView. So I was wondering if anyone out there could help me translate the info from C to G.

I have the functional description of the dll, and the source code of a test C program in which the function is called successfully, so I do know the function itself is ok. I also have screen shots of the block diagram and the setup dialog for the call library function.

I have written a simple program to read and write with a Softing CANCard2. It's running on a Toshiba Tecra 8100 with Win2k and LV6
.0.2 The program runs fine as long as I do not run this particular function. If I run the function, LabView immediately crashes. I can restart LabView with no problem and run the program again with no problem.

The files are attached in the zip file.

Thanks
Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 1 of 4
(2,204 Views)
Ed,

Lets start with this example. You had a few mistakes in the stuff you sent along. If you want, send along the dll, and I'll try to make a working interface for you. In the meanwhile, see if the attached vi file works for you.

Kindest regards,
Warren Crossfield
0 Kudos
Message 2 of 4
(2,204 Views)
Warren,

That setup helped. It no longer crashes LabView, but it now produces a timeout error and returns all zeros.

I've attached the dll for you to look at. This is my first attempt at using dll's so it's new to me.

Thanks
Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 3 of 4
(2,204 Views)
Ed,

Actually, I think we are all set. I don't have the operational manual to this device so I don't know exactly what needs to be done. BUT..if you look at the C example file that comes with the product (that you origianlly sent along). Main{} has a series of initialization steps that happen to the board before you can query it. If you look at line 518 of the example C file you will see you have to select the DPRM operational mode first. If you don't do this, you will get a -4 timeout on the get_version function we just worked on.

So go thru the main{} function and see what they do to initialize the card, THEN do your operations on it.

Does that help?

Kindest,
Warren
0 Kudos
Message 4 of 4
(2,204 Views)