LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to prevent a DLL from hanging up labview?

The short version of my question is this: I have a DLL that I must call as part of a driver package of a digitizer. The DLL runs in a loop waiting for the digitizer to be triggered. If no trigger is recieved, the DLL stays in an infinite loop.  I am looking for some way to be able to hit a top button on the front panel of the VI to tell it to continue on from the DLL.  There are two options I have considered, but it seems that there could be a simpler solution that I haven't found. The options I have considred are:

1) Add a time-out to the DLL itself. This is my LAST option, because there will be times when I want it to wait for an extended period of time for a trigger.

2) Use a shared variable and have the "stop" button in a different VI - then feed that variable into the DLL and have the loop end if either a trigger is found, or if the "stop" boolean is set to true.  The problem with option 2 is that it requires another VI to be open and running. Again, it seems that there should be a better solution, but I am having difficulty finding one.

0 Kudos
Message 1 of 3
(2,250 Views)

LabVIEW cannot execute any code that is dependent on the output of the DLL until the call to the DLL completes. This means that if the DLL is in a subVI and you call the subVI, then the subVI will not complete until the DLL call is completed. If it has an infinite loop (which is a bad design choice, by the way), then you have to have a parallel process running in LabVIEW. Even if it has a timeout the situation with LabVIEW waiting will be the same - LabVIEW will sit there until the DLL call has completed. Whether you choose that to be a parellel loop or another VI running in parallel is a bit dependent on the architecture and complexity of your code.

0 Kudos
Message 2 of 3
(2,246 Views)

I agree it is a bad design choice. The other option I was considering is simply having the loop within labview.  It calls the DLL to see if there is a trigger over and over, then if it is triggered reads the data. However, I have had trouble finding out if there is going to be a performance decrease by doing this.

0 Kudos
Message 3 of 3
(2,242 Views)