5.3 Persistent Local Storage

   

We want our component to keep ahold of its own state after it has been active. This data should be considered private, hidden from outside of the component and only accessible by the commands sent to the component.

There is only one efficient private method of storing data within a VI in LabVIEW and this is by using shift registers on a For Loop or While Loop structure. Figure 5.9 illustrates their use.

Figure 5.9. Shift registers.

graphics/05fig09.gif

Shift registers are local variables that are primarily used for transferring values from one iteration of the loop to another. They have an important characteristic that we use, and that is persistence. By persistence we mean that the data held within the shift register is kept even after a VI has been run. This gives our components independence, which is essential for loose coupling, and data privacy, which is essential for information hiding.

Let's put it all together and make a dummy component structure.


   
Top


A Software Engineering Approach to LabVIEW
A Software Engineering Approach to LabVIEW
ISBN: 0130093653
EAN: 2147483647
Year: 2003
Pages: 66

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net