LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Shift register initial value

Solved!
Go to solution

I wrote a simple program with a while loop that contains a shift register that save the previous iteration value.  When I stop the program and restart the program again, I thougth the shift register's value will get reset to 0 (for a I32 data type)?  Apparenetly, the shift register retains the value from the previous run before I stop the program.  Why is that?  Why won't the shift register reset?

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
Message 1 of 22
(8,646 Views)

Because that's by design. It's also documented in the LabVIEW Help. Did you look in there?

 

An Uninitialized shift register is actually quite useful in creating a LabVIEW 2-style global variable, AKA functional global, AKA Action Engines.

Message 2 of 22
(8,640 Views)

If you would like to reset the SR without moving a wire or other trivial change, just force a recompile by pressing ctrl while hitting the run button.

Message 3 of 22
(8,627 Views)

Just wire a constant with a value 0 to the SR before entering the while loop.  Problem solved 😉

Kind regards,

- Bjorn -

Have fun using LabVIEW... and if you like my answer, please pay me back in Kudo's 😉
LabVIEW 5.1 - LabVIEW 2012
Message 4 of 22
(8,611 Views)

See the picture (not a snippet)

 

ResetSR.JPG

 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 5 of 22
(8,592 Views)

Darin,

 

That's exactly what I am looking for.  Can you point me the reference that talks about ctrl+run and recompiling?

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 6 of 22
(8,577 Views)

This and many other fine keyboard shortcuts is available here:

 

http://www.ni.com/pdf/manuals/373353d.pdf

 

 

 

Message 7 of 22
(8,558 Views)

 


@jyang72211 wrote:

Darin,

 

That's exactly what I am looking for.  Can you point me the reference that talks about ctrl+run and recompiling?


Of course, that won't solve the issue when you're running the VI normally. Unless you explicitly want the shift register to be uninitialized?

 

0 Kudos
Message 8 of 22
(8,556 Views)

stig.jpg

 

 

That mask will not prevent us from finding the person who offered that extra length of rope.

 

Ben

 

Jyang,

 

Please see the link in my signature about "Race Conditions" to learn more about SR and how to exploit them.

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 9 of 22
(8,544 Views)

 


Ben wrote: 

That mask will not prevent us from finding the person who offered that extra length of rope.

 


Telling someone there IS a bucket of Truth is not the same a pushing (or nudging) them in.

 

Message 10 of 22
(8,527 Views)