LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems clearing a local variable/shift register

Solved!
Go to solution

I have an indicator set up as a local variable (Test Window) that I clear before running a new test in the flat sequence box below but when it gets to the state engine, all the data from previous tests (contained in the shift register) is then dumped back into the indicator. 

 

Are the local variable (Test Window) and the shift register two different memory locations of data?

 

 

local variable indicator.JPG

 


How can I clear the contents of the local variable (Test Window) at the beginning of a new cycle of the state engine and change this so that the shift register only holds the data of one complete cycle of the state engine?

 

Thanks

 

0 Kudos
Message 1 of 4
(2,869 Views)
Solution
Accepted by topic author robojeff

@robojeff wrote:

Are the local variable (Test Window) and the shift register two different memory locations of data?


Yes. The local variable "points" to the control/indicator. Local variables are not supposed to be used for data storage, regardless of the fact that they are called "local variables". In your loop you write the contents of the shift register to the local variable. Thus, you're dealing with two different "memories". Your shift register is uninitialized, so it "remembers" the data on each run. You have to initialize the shift register with an empty string. Please read the LabVIEW Help on shift registers.

Message 2 of 4
(2,868 Views)

Where is the terminal of the "test window" indicator? you should wire it in the place of the second local variable, delete both locals, delete the sequence frame, and initialize you shift register with an empty string.

 

Ahhh...much better!

 

(Also note that you have coercions on your state ring. Make sure all are the same.)

Message 3 of 4
(2,855 Views)

Thanks for the tip...

 

Surprising, what you suggested what I ended up doing after reading smercurio_fc's reply so I must be learning..

 

thanks everybody

0 Kudos
Message 4 of 4
(2,846 Views)