LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

shift regester

I want to use a shift register to incremnt a value by 0.5 every time through a for loop.  However, I do not want the value on the shift regester to start at 0 I want it to start at a user defined value.  How do I get it to start at a user defined value and then increment by 0.5 from there?  I can do the incrementing part, just not the addition at the start.  If there is a better way to do this than shift registers, I would be up for that as well.

thanks

0 Kudos
Message 1 of 4
(2,891 Views)
Hi Musser,
 
You can wire a constant or a control to the shift register from out side the loop to give it a predefined start value.
Infact, you should always wire at least a constant otherwise the shift register may contain undesired value in the beginning.
For example, if you run the loop for a second time, the previous end value will be still present at the shift register. If you do not clear it, that becomes the first value for the second loop and so on.
 
Hope it helps,
Deepu.
 
0 Kudos
Message 2 of 4
(2,887 Views)
Hi,
 
Alternatively, you may consider to use while-loop, which allows loop termination during increment.
 
Note : Changing the User Define Value will restart the INCrement
 
Regards
ian
 
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 Kudos
Message 3 of 4
(2,878 Views)
Hello Musser &Deepu,

you better don't use a simple add with a shift register: due to inaccuracy of floating point numbers you easily get into trouble (try to add 0.1 a hundred times and see what you will get...).
Better use a multiply and add to perform an operation like y=a*i+b with a=increment, b=offset and i=loop iteration terminal!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 4
(2,835 Views)