Paulo
Paulo

Reputation: 125

How to make a labview loop stall once?

I am kinda new to LabView and the problem is the following: I want to stall just when values are different and not stalling after the update. The wrong way would be:

wrong way: new value different from old

wrong way: new value equals old

I highlighted it is the wrong way because the loop still stalls even in case false, that does not contain a stall structure.

Edit: link to code: download here

Upvotes: 2

Views: 360

Answers (3)

In Labview 2018 you could also use the "Is Value Changed" function. The SubVI is just syntax suger, which is realized by the polymorphism of malleable VIs. The functionality is the same as Salome suggests.

Is Value Changed

Upvotes: 2

Achuthaperumal RK
Achuthaperumal RK

Reputation: 79

As Salome pointed out, I have recreated your requirement with Feedback nodes.

Using Feedback Nodes

Let me know if you need any more assistance with it!

Upvotes: 2

Salome
Salome

Reputation: 221

Testing:

I implemented the code in my LabVIEW and it seems to work just fine! If the values b_in and b_out are different, it waits the preset time, if they are the same, it doesn't wait. You could use the "Highlight Execution" button to test it in your code.

Solution:

If you let it run in a loop, maybe there is a race condition. Local variables are predestined for that problem. I would use them as rarely as possible. If you run the case-structure in a loop, you should use shift-registers instead.

There are some unclear points in the question, that can't be answered without further information, so please provide an edit for these:

  • Is this just a part of a bigger vi?
  • Can you provide the code of the whole vi?
  • Does the code snippet of your question run in a loop?

(I will edit the answer if new information is provided)

Hope, I could help you :)

Upvotes: 2

Related Questions