Quote:
Originally Posted by simpsonboy77
I'm not certain about labview's implementation but in C++ you can request the system clock for its time since it powered up. This has a resolution of 1ms.
|
If the resolution of the "system clock" is truly 1
millisecond (as you said), then if you're running a control loop at 10ms, you could have an error up to 20%.
There's a much more accurate system timer that is available:
Timer::GetPPCTimestamp() has low overhead and returns time in seconds in double precision with
1/3 microsecond
resolution. According to the WPILibC++Source20120204rev3111 source code date February 4 2012, it uses a 64-bit
counter incrementing at 33MHz, which if true wouldn't overflow in your lifetime. Warning: I'm told that earlier versions
of GetPPCTimestamp() used a 32-bit counter instead of 64, and would rollover every 130 seconds. Check the source
code on your machine to make sure.