LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

There seems to be an offset on my "tick" that I cant fix

Hi guys,

 

In the "data acquisition loop" (bottom right), Ive applied a tick differential to measure time during the run. However, there appears to be about a half second delay and the first few values returned look like this:

 

0
480
483
483
484
485
485
486
486
487
487
488
489
490
490
491
495

 

What can I do to fix this delay? Or will this always be an offset?

0 Kudos
Message 1 of 5
(2,240 Views)

The execution rate of your code is directly dependently on how long it takes the code inside the loop to run.  Your first iteration is going to be zero because the tick count before the loop and the one inside the loop will run at almost the same time.  After that, the time it takes for then tick count will depend on how long it takes for LVCanlvdt.vi to execute (it is missing so I can't see what it does) and the write to spreadsheet file.

 

Writing to a file can be notoriously slow and unpredictable on how long it takes.  It is dependent on the Windows OS.  If something else like a virus scan happens, it may put a low priority on file writes.  If it needs to find another block on the hard drive to write data to, it can take longer.  Plus you are constantly opening and closing the file which takes time.

Message 2 of 5
(2,237 Views)

I altered my write to file to look like this, and it does seem to help quite a bit!

 

0 Kudos
Message 3 of 5
(2,224 Views)

Hi Benny,

 

please attach your pics directly here in the forum. And no scaled-down versions please…

Best regards,
GerdW


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

That's good to see that it helps.

 

The next step to take if your loop still doesn't run as fast as you need it to would be to use the Producer/Consumer Architecture which uses queues to pass the data to a separate file writing loop.  That decouples any delays in file writing from the execution rate of your data acquisition producer loop.

0 Kudos
Message 5 of 5
(2,218 Views)