NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How control a VI (Asynch Mode)

Solved!
Go to solution

Hi all,

I'm moving the first steps with TS and I'm trying to send command and read response from a VI running in background.

If I correct understood, to do that is necessary run the VI in TS in asynch mode.

So I've implemented a sequence which set and get the state of a led in VI.

The VI (also attached) is a simple while loop to drive the led state and the while-loop stop via TS.

To interface VI with TS I've used TS parameters and mapping with VI In/Out.

Obviously doesn't work, I can not set the right input in VI, and also I'm not able to stop it via TS sequence.

I've used LV2018 and TS 2017 SP1 both in 32 bit

Thanks for any support

Download All
0 Kudos
Message 1 of 5
(1,515 Views)

Honestly never tried using the "Run VI Asynchronously" step, but you are not passing in your sequence context in, when you are calling your VI, unless there is some mechanism I'm not aware of. That step seems to only run your VI without the ability to pass in values.

 

You seem to have confused the parameters that are meant for you sequence file with the inputs to the VI you are calling. It doesn't work like that.

 

I have attached one of many ways you can run a VI in the background. It uses the ability to call a sequence file in a new thread and then the "wait" step waiting for that tread to finish executing for a clean exit. The example calls a VI to run in the background, where it increments the value stored in the "Numeric FGV.vi" every 0.5s. Everytime the loop executes in the sequence file, your are shown the value of that FGV and given options on what you can do. The background VI is stopped using the "Stop FGV.vi".

0 Kudos
Message 2 of 5
(1,464 Views)

You can use LabVIEW queues or notifiers to talk to your async run VI. Just place a loop waiting for new queue element. Then you can create a simple VI using the same queue ("name" has to be the same) and run this VI from TestStand to send messages.

0 Kudos
Message 3 of 5
(1,459 Views)

Thanks, unfortunately I can not read your files because I've LV2018 and TS2017SP1 and both in 32bit.

Can you save they in a compatible version?

 

0 Kudos
Message 4 of 5
(1,454 Views)
Solution
Accepted by zundap1970

Here you go.

 

In addition to queues and notifiers you can also use network shared variables, globals, TCP even and probably a few more mechanism. But essentially it's best to communicate through LV VIs.

 

The thing to be careful of, when using named queues, is that LV seems to create a new reference for each instance of a named queue "obtian" call. So if you don't close those references, you might end up with memory growth after a few thousand calls. Pretty sure, I had an issue with that on one of my projects, as I assumed a named queue would just re-use the queue reference that's in memory.

0 Kudos
Message 5 of 5
(1,451 Views)