NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Acquire Semaphore in TestStand within LabVIEW VI

Acquire Semaphore in TestStand within LabVIEW VI

 

Hello, I would like to share my solved issue of semaphore used in TestStand within LabVIEW VI.

 

I created a simple TestStand sequence for incrementing global numeric variable. As a station model for the sequence execution is used BatchModel and number of test sockets is 8. Description of my sequence is bellow:

 

 

sequence.png

 

 

Description of the sequence steps

 

1. Global Reset - Resets the global numeric variable

 

global_reset.png

 

 

 

2. Semaphore Create - Creates a reference to new semaphore

 

semaphore_create.png

 

 

 

3. Global Increment With Semaphore - Is synchronized part of application which increments a numeric value

 

global_increment.png

 

 

 

4. SemaphoreDestroy - Releases a semaphore reference

  

semaphore_destory.png

 

 

 

5. Global Read - Reads the numeric global variable

 

global_read.png

 

 

 

6. Message Popup - Shows the output of numeric global variable

 

 message.png

 

 

Execution of sequence

 

Execution of the sequence causes Error !

 

error.png

 

 

Solution

 

I found incorrect settings in TestStand. It doesn't reserved the loaded VI's for the execution. Therefore the reference of the semaphore which I created in step SemaphoreCreate has become not valid.

 

settings.png

 

 

Something from LabVIEW Help:

 

Reserve Loaded VIs for Execution—Specifies whether LabVIEW reserves each VI to run when TestStand loads the VI. When a VI is reserved for execution, any references the VI creates during execution remain valid until the VI is unreserved. VIs LabVIEW reserves take less time to call. However, you cannot edit the VIs in LabVIEW unless you click Edit VI on the LabVIEW Module tab or Specify Module dialog box or select Edit Code from the context menu for the calling step.

 

Source code you can find in attachment

 

I hope, that this article will be helpful for somebody. I had really problem with it Smiley Happy

Message 1 of 1
(4,515 Views)