LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabView 7.1 DLL in C# (VS2010) Hangs

Solved!
Go to solution

Hello,

 

This is my first time posting here, hopefully i can find some help.

 

I created a DLL in Labview 7.1 to validate a button lock system for a Clamp. I tried to call the

DLL using C# but everytime the DLL funcion is called C# just hangs.

I added some messages accross de DLL function, but none show up when called from C#.

It seems that it hangs before being able to start the function.

 

I tried using the DLL in VB.net it worked fine on the first try.

 

I've tried compiling the DLL on both stdcall and C calling conventions.

Using DLL import on C#

.NET Framewok used is 4.0

PC is 32bit system.

 

Any ideas what might be happening here?

0 Kudos
Message 1 of 4
(2,780 Views)

Hi Javier-T,

 

The problem seems to be inside the DLL or in the way parameters are sent to or received by the DLL. Do you have the source code for the DLL?? could you share it with us so we can take a look at it?? 

Also if you could give us a general description of what the DLL does it would be great. 

 

Best Regards,

Juan Arguello Director Support Services @NI
0 Kudos
Message 2 of 4
(2,739 Views)

Hello Juan,

 

I am attaching the VI file that im building into a DLL.

 

Basically the function will be called a 0 (indicate that it will Open the clamp) or a 1 (that it will Close the clamp)

there are some time conditions between the button press time that must be met.

Less than 0.25s between each button press (BN and BNI) in order for the Clamp to be able to close.

Im reading the button status using a DAQ PCI-6515, with DAQmx 8.8.

The function will return three values depending:

0: No button press detected

1: Operation Completed

2: Timeout

 

 

I've tried both stdcall and c standard calling conventions. Are LV7.1 DLL compatible with VS2010?

 

0 Kudos
Message 3 of 4
(2,716 Views)
Solution
Accepted by Javier-T

Hi Javier-T,

 

Reviewing the Code there are several things that we could do to minimize the error source in this application. First I would recommend a "State Machine" Architecture because of the nature of the application and what you are trying to achieve. You can find more information in the next Link

 

You are opening in two places in the code references to the same DAQmx tasks without stoping them the first time you use them. This could be causing an error.

 

Secondly there is nothing timing your acquisition loops, I suggest using a timing function to give the While Loops a Loop Rate.

 

To test your communication between C# and LabVIEW I would recommend creating a DLL that only performs a sum and call it from C# to check communication between programs.

 

We're setting up a PC to check any compatibility issue but that shouldn't be a problem if it already worked for you once.

 

We'll be waiting fot the test results.

Juan Arguello Director Support Services @NI
0 Kudos
Message 4 of 4
(2,613 Views)