LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

While loop running too fast

I have a while loop that is writing globals into shift registers. When the loop finishes i write these shift registers to a 2d Global array. Everything works great, my problem is that i am writing about 14000 readings/sec into the shift registers with a wait of 0 in wait until next multiple. File is way too big. If i change wait to 1, i get 500 readings/sec, too small. I need a way to slow this loop down, or put a delay in that is less than 1ms. Any help is Greatly Appreciated.
 
Thanks
Mike
0 Kudos
Message 1 of 3
(2,324 Views)
It's not clear if you need a precise frequency or not. If not, write readings only one every N loops (say 7 if you want about 2k data/s).
To do so, wire the loop index to a Quotient & Remainder Numeric function. Write only when the remainder is null.
Another possibility: replace the wait function with a dummy for loop (eventually with some dummy code within); in this case you can tune the number of loops in order to approximate a specific frequency.
None of this methods is precise, of course

Paolo
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 2 of 3
(2,317 Views)
Pincpanter has some good ideas and is probably what you will need to do. 

Keep in mind that tuning this way is very system dependant.  Changes in processor, processor speed, memory access speed, OS processes running, etc. will all affect the amount of time that LabVIEW takes and therfore takes a lot of tuning for each system.

I just wish I had an even better answer, but I don't.

Bob Young

0 Kudos
Message 3 of 3
(2,312 Views)