LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Progress bar not update until DLL fn completes

Solved!
Go to solution

I have a DLL that I am integrating into a wrapper subvi using LabVIEW 2011 SP1.

The exported DLL function updates program memory on a PIC microcontroller by interfacing with bootloader using its own protocol over CAN interface.

The function takes approx 20 seconds to write, read back and verify operation completed successfully, and I am trying to add some progress indication.

 

I have a LabVIEW test application vi that calls the dll subvi and has a progress bar to provide feedback. Unfortunately I can only get the progress bar to update when the DLL completes, but not while it is running, so it just jumps from 0% straight to 100%

 

I have speculated that the DLL is hogging the cpu and not allowing other labview indicators to update or loops to execute.

The DLL includes some calls to Sleep briefly (3ms), and I have increased these to half a second to see if this made any difference

There doesn't seem to be a way of getting other LabVIEW objects to grab a slice of CPU.

I have tried lowering priority of subvi to see if other code threads will preempt.

I have tried starting the subvi as an asynchronous call and collect return status (with a wait on asynchronous call) while a seperate loop polls trys to update progress bar by calling an accessor function exported in same DLL to get value of status property 

I have tried passing in a slide refnum and updating value property directly from the DLL function by passing in pointer to value by function parameter.

I have tried several combinations and variations.

 

Is there some fundamental issue that prevents me from actively updating the progress bar while the DLL function executes, or am I missing some straightforward mechanism to achieve my objective.

 

I look forward to any suggestions for solutions or further reading from the forum

 

Thanks

0 Kudos
Message 1 of 3
(2,383 Views)
Solution
Accepted by topic author Silver Surfer

DLL called in UI thread? If so, try to switch to Thread Safe call (if DLL allow this, of course)

Message 2 of 3
(2,376 Views)

Brilliant!

 

It was such a straightforward solution in the end.

The DLL in actual fact is not strictly reentrant at present... but will be shortly!

 

Thank you for the putting me on the correct course to fix it.

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