LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

loop problem

I am trying to write a vi for a compression expansion loop. I have include a sketch of it in the attachment. The instrument compresses when a count is less than 76000 (an absolute position) and expands when the above statement is false.

The problem is(since everything is constantly updated) that at count = 76000 it moves backwards, but in the next iteration the count is at 75900 and the statement is true again. So I get stuck bouncing back and forth. What I need is a way to make the statement permanently false after a count of 76000. I realize this is probably basic and I am new at this so I apologize for the inconvenience. Thanks
0 Kudos
Message 1 of 3
(2,314 Views)
One thing is missing though ... for how long do you want to keep it false ? What is the other limit (because I assume that sometime after, you'll need to switch compression/expansion again). Wouldn't be easier with 2 for loops (or while), one for compression, the other for expansion?

Hope I understood the problem
0 Kudos
Message 2 of 3
(2,314 Views)
To make the statement permanently true or false, start by creating a shift register on the loop by right clicking on the boarder. This shift register will then pass a boolean value into the next iteration of the loop, and when used with some logic functions, will act like a one way switch. For instance, you can initialize the shift register to false and use the logical operation OR to OR it with a control that initially produces false. The output of the OR will then be sent to the shift register on the right side of the loop. When the control produces a true, the shift register will become true and will always make the output of the OR operator true. Thus you have a one-way switch. There are a number of ways you can do the logic so choose a way that make
s sense for your program.

Jeremy
0 Kudos
Message 3 of 3
(2,314 Views)