07-06-2014 07:41 PM
Hi guys,
Forgive the question, but I'm completely new to Labview and have recently inherited a rather large codebase that I will be working on over the next few months. The code is quite complex, so I'm sure I'll be referencing the documents available to their fullest extent while trying to figure it out.
My question is this. The previous grad student, who built out the code originally, couldn't figure out something that seems to be very simple. We have several discrete variables that we're using, and at each time step, the two previous values are held. In a kind of functional assignment form, it might look something like this:
x(t-2) = x(t-1);
x(t-1) = x(t);
x(t) = sensor(t); the value is read off from an external sensor.
Currently, all current and previous values must be recorded to be fed into the dataflow at each time step. Ideally, this would be done automatically, but I haven't the slightest clue how to do it. Any help here?
I'm proficient in VHDL, C, Javascript, and Mathematica, if that helps at all.
Solved! Go to Solution.
07-06-2014 07:45 PM
Shift Registers. You can expand the terminals on the left side of the loop downwards to get older values of the shift register besides just the previous iteration.
I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours
07-06-2014 07:49 PM
Use a shift register. Drag down the left side to expand to get the two previous values.
I recommend that you work through the on-line tutorials for Getting Started with LabVIEW. You will save far more time than it takes you to do that.
Lynn
07-06-2014 07:56 PM
I think you are describing a Shift Register, which hold values between iterations of For or While loops. If you open LabVIEW Help and do a Index search for "Shift", you can see the "official" description of this very useful LabVIEW construct. You can also type "Whte Paper shift register" in a Web search to get a nice tutorial from NI on this topic.
BS