LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

calling vi continues execution before the call library function returns

In my app one of the VI makes a function call using a "Call library function" node. Then the VI goes on to execute the next frame in my sequence diagram even before the "library function" returned.
 
The Call library function is configured as "Reentrant" with "C" calling convention. The VI executes in "Standard" priority.
 
The library function controls a GPIB instrument and returns when the control process reaches "stability". I can visually see the control process working fine but my return value from the function is a NULL. whereas the library function returns always values greater than NULL if it succeeds in sending at least one command to the instrument.
 
I help any help/pointers on how to make the library function execute in the context of the calling thread (basically block the VI to wait for the function return).
0 Kudos
Message 1 of 2
(2,527 Views)

Hi Murty,

      If the CLF node returned a value, then the function terminated.  If it didn't return the value expected then look for errors!  Are you checking for errors? Smiley Wink  It's easy to forget to wire/supply a sufficient timeout for GPIB reads...

It sounds - from your post - as though the CLF is in one frame of a sequence-structure or state-machine, and must be terminating before "the next frame" executes.  If, instead, the CLF is running in parallel to some other section of code, then you may need to use "data-dependency" to control the execution-order of your diagram - to make sure other code waits for the CLF node to terminate.

Cheers!

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 2 of 2
(2,515 Views)