From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
12-07-2021 03:17 PM
I was doing some system performance testing using LabVIEW and noticed that the while loop iteration counter counts up to 2147483647 and stops. I understand that that is the i32 limit, but that seems like a problem for software that needs to run forever. Depending on the speed of your loop you can run into that limit quickly, at which point the built in iteration counter is useless.
Anyone run into this? I can think of RT code that I've written in years past that likely died for this reason after a few months and started back up when I rebooted and ran fine for a few months before it did the same thing. Curious what people's thoughts are.
12-07-2021 03:41 PM
12-07-2021 06:41 PM
Gerd is correct, of course. The question is why your code even depends on [i] if it should run and thus grow forever?
12-08-2021 04:21 AM
@AMyth wrote:
Depending on the speed of your loop you can run into that limit quickly, at which point the built in iteration counter is useless.
That's why you can hide the Iteration Terminal in >LV20 😁.
@AMyth wrote:Anyone run into this?
Sure, 21 years ago.
If you program long enough you'll run into this, make a palm face, and hopefully remember it...
I'm sure everyone programming an FPGA for the first time makes this mistake at least once.
Note the huge difference between an U64 and an I32 on an FPGA. It won't run forever, but even at 25 ns iterations, it will last long enough.
12-10-2021 12:34 PM
Well now I know better :). I just assumed that "i" would roll over when ti reached a limit. But it stops! That's what was shocking.
12-10-2021 12:51 PM
@AMyth wrote:
Well now I know better :). I just assumed that "i" would roll over when ti reached a limit. But it stops! That's what was shocking.
I would be even more shocked if it would roll over and output negative values starting with -2147483648! 😄
(It really depends on the use case. For example if you just want to distinguish odd vs even iterations, a rollover would be preferable, but there are probably better alternatives. 🙂 )
12-10-2021 01:48 PM
Of course it depends on what you are doing with it. I think I assumed behavior without testing and that's my fault. I now know better and will have to go check all my long running code and ensure it's not dependent on "i".
12-10-2021 02:35 PM
This one takes about 4 seconds on my rig (And 1-2 seconds longer with debugging enabled). 😄