LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Newbie: How can I store a previous value??

I am trying to figure out how to do the following:

int xcoor=0, ycoor=0, hstep, vstep;
while true do
{
update_step(hstep, vstep); // essentially have a big while loop to generate the necessary hstep/vsteps
xcoor = xcoor + hstep; // I need to add a new hstep to the xcoor
ycoor = ycoor + vstep; // I need to add a new vstep to the ycoor

updategraph(xcoor, ycoor); // and feed the updated xcoor/ycoor to an XYgraph
}

I think I should use a Master/Slave design? but how do I keep the previous value the first time in the Slave and then add the new values to the stored value??
Download All
0 Kudos
Message 1 of 3
(3,442 Views)
You probably want to use a shift register.
Right-click on the right edge of the loop. Select the "Add Shift Register" option.
It will add a widget on both the right and left sides of the loop.
An item wired to the right side will appear on the left side during the next pass through the loop. You can initialize the value by wiring an input to the left side widget.

Les.Hammer@CompleteTest.com
Message 2 of 3
(3,442 Views)
Thanks. Did a search on shift registers and found a boat load of information on it.

http://zone.ni.com/devzone/conceptd.nsf/webmain/2F266590B802FEFD8625686500609588?OpenDocument&node=dz52000_us
0 Kudos
Message 3 of 3
(3,442 Views)