NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How set number of loops for step?

Hello everyone.
 
One of the options of TestStand is setting number of loops for specific step:
Sequence--> Step Properties--> Loop options--> Fixed number of loops-->  Number of loops.
 
Can i perform this settings programmly in my application?( I use LabWindow CVI 8.0)
If yes, how can i do this and which  TestStand functions is usefull?
 
Sincerely,
Olga
0 Kudos
Message 1 of 2
(3,513 Views)

Hello Olga,

do not select fixed number of loops in the loop options tab of the step properties, but select custom. You will find a set of expressions which can be defined and employed to dynamically define the number of loops to run.

Tab should look like the following:

1. Loop Initialization Expression
RunState.LoopIndex = 0 (If you want to start from 0)

2. Loop Increment Expression
RunState.LoopIndex += 1 (If you do always increment by 1)

3. Loop While Expression
RunState.LoopIndex < 10

Now define a local variable of type numeric with the name 'LoopCount' and use this through the expression browser to replace the value of 10. Should finally look like:

RunState.LoopIndex < Locals.LoopCount

Now you are almost finished and simply need to write a step in CVI which uses the lookupstring 'Locals.LoopCount' to transfer a loop count value from CVI to TS by calling the function 'TS Property Set Val Number'.

Hope this helps,

Regards,

C.L. - National Instruments Application Engineering

PS: Out of office for one week

Message 2 of 2
(3,511 Views)