LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reinitialize shift register after execution

I am having difficulty reinitializing shift register after completion of my labview code. I have to close the entire file and reopen to remove the "data" stored in the shift register. For a plot, I have x-axis value given through shift register outside For loop. When I rerun my code, the x-axis value starts from the point where the code was completed initally. (For example, if the x-axis value was from 0-100, the second time it starts from 101 rather than back from 0).
0 Kudos
Message 1 of 6
(3,143 Views)

You can wire a value into the outside of a left shift register to initialize it when your VI starts.  As for your chart, are you using a Waveform Chart?  If so, it will maintain history between VI runs.  To clear the history, create a property node for the chart and wire an empty array to the "History" property of the chart.

If you need more information, please attach a VI along with a more detailed description of the problem you are having.

Good luck,

-D

0 Kudos
Message 2 of 6
(3,131 Views)
To initialize a shift register before it runs, wire the initialization value to the left terminal of the shift register from outside the loop.

To re-initialize within a loop while it is running, use a case structure with the initializatation value in the re-initiailize case and pass the shift register value through the other case.

Lynn
0 Kudos
Message 3 of 6
(3,129 Views)
Hi
 
Instead use Case Structure you can also use function called Select as I show you on picture.
It think it is also a good sollution.
 
bogdani
0 Kudos
Message 4 of 6
(3,121 Views)
I am attaching my vi. If I just initialize outside the For loop, I would actually have a problem with the way I wrote my VI, as I actually need info from the VI outside of the register too.
0 Kudos
Message 5 of 6
(3,107 Views)

The way you have your code written right now, only the last set of data from the inner For Loop will be written to the waveform graph outside the main For Loop.  Is this the behavior you want?  If so, then you could add code inside the inner For Loop to use the "First Call?" function and the Select function to initialize the array from within the loop.  I have attached a screenshot showing how I would do this.

Hope this helps,

-D

Message Edited by Darren on 02-06-2006 04:01 PM

0 Kudos
Message 6 of 6
(3,096 Views)