LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does one while loop stop after 3-4 weeks?

OK, I think I have figured it out myself. The instrument-reading vi will read until the end-of-message character is received or until the timeout period has elapsed. The timeout test, though, uses simple subraction of millisecond timer values. The timer will wrap around to zero 49.7 days after Windows is booted. If the end-of-message character fails to arrive during a read that spans this wraparound event (extremely unlikely, but possible), the timeout would be 49.7 days and the loop would appear to hang.

Rich
0 Kudos
Message 11 of 14
(806 Views)
Thank you for the update Rich!

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 12 of 14
(806 Views)
Hi Everyone,

I just had an idea which never occurred to me before.

Instead of using the ms timer, why not use the function Get date/time in seconds. This returns a DBL which (according to my calculations) should only wrap after many many years. This function also offers sub-second timing.

Does anyone have experience with this? Does this access the hardware clock on the motherboard? If so, will a battery failure on the motherboard influence the functionality of this (I remember in several old computers, being greeted with "set the time and date" upon booting because the clock battery was empty....)?

Bit late, but I thought I'd see if anyone has tried this....

Greets

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 13 of 14
(806 Views)
I've used Get Date/Time in Seconds extensively for timing things. In my experience at least (mainly LV5.1 on Windows 98), it returns the time the OS currently thinks it is, e.g. in Windows the time currently set in the Date/Time control panel. This means that if you change the system time while your VI is running, it will mess up your timings. This is an important point because changes you make in the Date/Time control panel are instantly applied to the system time even though you haven't clicked OK yet!

I don't think there's a problem with the motherboard battery failing though - the PC will start up with the wrong date and time setting but once started it should count up correctly, so relative timings will still be OK.
0 Kudos
Message 14 of 14
(806 Views)