LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Checking the initial value of a control to see if something has changed each iteration of a loop

Hey,

I'm trying to have a program update the instrument anytime the values on the front panel change. So what I have it do is compare a cluster each time around a while loop.

I'm worried about the behavior of the program on the first iteration, as I am using a shift register that is initially undefined. I can define it using a local variable, but I was wondering if there is some clever way of doing this that doesn't require local variables.

I'll post a comment with an example of what I'm talking about.

-Dobbs
0 Kudos
Message 1 of 5
(2,877 Views)
Yes, in the situation you describe it is convenient to use local variables but what I do some times is that I wire a cluster constant with dummy values (e.g. -1 for index parameters) to the shift register as a start value. That way I know that I will always update my intruments on the first iteration since the comparison with the actual value will indicate a change in the settings. Hope this helps. /Mikael
0 Kudos
Message 2 of 5
(2,877 Views)
If you do not want to update your intruments in the first iteration, you can use a property node to set the start value in the shift register. I added a modified version of your example to show how it works. Hope this helps. /Mikael
0 Kudos
Message 4 of 5
(2,877 Views)
Here's an example, it's easier to see this way:
0 Kudos
Message 3 of 5
(2,877 Views)
You could also put a check in for the first iteration, and not count it.

See the attached modified example.

Brian
0 Kudos
Message 5 of 5
(2,877 Views)