Hi to all,
I have the following problem that I would like to seek the community's help.
I am currently using flat sequence to run two different function blocks for my VI. Therefore there are two frames in the flat sequence.
For the first frame, I will like to store the previously calculated value so that when i come back to the first frame again, I can use that value to calculate the next value. It's like iteration. I am currently using shift register for that.
The problem that I enconter is that whenever my VI goes to the second frame, values in first frame that is stored in shift registers are gone.
I dont really have to use shift registers. I just want to store previous value so that i can still use it in the next cycle.
Here's the VI to better illustrate my problem.
Thanks a lot.
Keith Tan
已解决! 转到解答。
From the title, I go answering you questions...
I suggest you to go thro' some basic tutorials reg LV either online in NI or read some study materials reg the same.
Esp, reg the use & usage of Shift Registers (SRs), and before that, about the Loops & Strucctures in LV.
Hi Ranji , do you mind explaining how do you go about saving it to indicator? I dont quite understand that. Thanks.
Hi parthabe , I am currently using FOR loop's shift register to store my values. The purpose of the flat sequence is just to do two different functions for my VI.
Just that because of flat sequence, the values that are stored in the shift register is gone.
Yea I have been looking at the books for answers, but cant find an answer for this 😞
Thanks
Keith Tan
Hi Keith,
the values in the shiftregister are only in frame one. If you need them also in frame two, then you have to connect the wire from the shiftregister output to the second frame. If you need values from frame two in frame one, then place a loop around the sequence and use also a shiftregister.
Mike
All you need to do is remove the zero that initiaizes the shift register. An uninitialized shift register starts with zero (the default for the datatype). From then on, the uninitialized shift register will keep the last value, even between runs. (It will reset if you force a recompile, revert the VI, or completely close LabVIEW and start fron scratch).
Are you running this is "continuous run" mode? Don't!
Hi to all, I am not running in continuous mode. Instead, i am using a while loop to loop it forever until i press the stop button, will there be a problem with that?
The suggestion that MikeS81 given set me thinking again. I have draft out another VI and it works! I have attached it for further referrence to others.
Brief of what i had done : I make use of the while loop that is surrounding my flat sequence and create a shift register. The data is pass from FRAME 1, through FRAME 2 and to the shift register at the while loop.
Thanks to all for the help, if it's not for you guys, i will still be so stuck with my program....
Thanks all! Kudos for you MikeS81.
Thank to altenbach too, now i know the default for shift register is 0.
Hey hi. Yea i did place timing in my main program. Cause my actual VI is huge, so did a draft VI of the problems that I encountered.
Cheers!