LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Retain Last Value of Output (Indicator)

Dear Sir,
 
I want to Retain the Last Value of my Output (Indicaotor) when i re-run the program. But now if  last value was true when i closed the VI it is changing to False if  i open and Run the VI.
 
e,g If last Value of OUTPUT is True when i closed the VI, it should be TRUE when i re-open and Run the VI
      If last value of OUTPUT is Flase when i closed the VI, It should be FALSE when i re-open and RUN the VI
0 Kudos
Message 1 of 2
(2,795 Views)
M1 is an indicator, and its value is fully determined by the code.
 
The value of the shift register will be retained as long as the VI remains in memory, even if you close the front panel. So, why do you close the VI??
 
Basically, you need a sure way to programmatically determine the current pump status (on or off) and initialize the shift register with it. That depends on your hardware.
 
Another possibility would be to write the last value of the shift register to a configuration file when the VI stops, and read it out and initialize the shift register with it when the code starts again. (This is less reliable, because the pump could turn off for other reasons).
 
In any case, your code is a "head scratcher" What's up with all the hidden wires and unecessary boolean operations? (e.g. the innermost case structure just returns the input wired to the selector, i.e. the same as if you would leave it out and just wire across. What is the point of the inner loop?
 
The current functionality can be fully done e.g. as follows:
You also need a small delay in your loop. Place an indicator to [i] to see why. 🙂

Message Edited by altenbach on 03-01-2007 12:05 AM

0 Kudos
Message 2 of 2
(2,789 Views)