LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Alternative way to get accurate timing?

Hi,

 

From what I understand, Wait ms function will have accumulative error overtime when running many task.

Wait until next ms multiple function may be a better choice because of its consistency in execution.

 

Link

 

Instead of using these 2 function,

Any way to go directly to the crystal oscillator in windows os to get the real time clock?

Is this feasible?

 

Thanks.

0 Kudos
Message 1 of 6
(3,206 Views)

Hi Adriano,

 

go directly to the crystal oscillator in windows os to get the real time clock?

Wait and WaitForMultiple are using the internal windows clock…

And that clock isn't "crystal" at all: you have a lot of jitter on that clock!

 

When you want more accurate timing: either use hardware (like DAQmx cards usually provide) or use a RealTime OS (like provided by cRIO targets)!

Best regards,
GerdW


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

Hi GerdW,

 

So other than using hardware to give a real time clock, any other method to implement a

real time from windows os? e,g extract bios clock or something to use within a loop...?

 

Thanks.

 

 

0 Kudos
Message 3 of 6
(3,179 Views)

You could have a look at something like Tenasys InTime or IntervalZero RTX. I use the former (albeit not as a programmer, just an end user) for motion control and haven't had any problems with it.

 

If I were doing something mission critical, like writing my own motion controller, I'd go for an embedded RTOS and FPGA system.

---
CLA
0 Kudos
Message 4 of 6
(3,174 Views)

The short answer is that Windows is NOT a OS that can give any real accuracy when it comes to timing.  If you need accurage timing, you need a Real-Time OS or an FPGA.  So what exactly are you trying to do?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 6
(3,157 Views)

The OP did not ask about loop determinism, they asked about long term execution, so i guess the cumulative error is the problem, not the loop jitter.  They asked "Any way to go directly to the crystal oscillator in windows os to get the real time clock?"  Yes, there is.  The Get Date/Time function returns the value of the OS clock wiich is based on a crystal oscillator.  It is not an atomic clock, but has very good long term stability.  Of course, if jitter is the problem then go to RT or DAQ clocks, but if it is long term timing and loop jitter is less of a problem then use the Get Date/Time function to give you a Tzero time, then check it periodically and acton the timer when you need to run your process.  Yes, you will suffer some jitter, but the long term timing will be far better than any other method including timed loops on windows, and the wait mS multiple.  Be careful about changing the OS time while your application is running, results may be unpradictable.

Does this help at all? or have i confused the issue?

Michael.

0 Kudos
Message 6 of 6
(3,146 Views)