07-28-2011 02:53 PM
Hi, I try to run a program on a RT target that do simple task, take a sample every 10 minutes, calculate the average value each hour and write it in a file and send the file every 24h. For testing purpose, I divide the time by 600, so 10 min becomes 1 second and 24h 2,4 minutes. It was working well. But when I set the time to their real value, it didn't work. At first I used wait function so the loop of 24h in ms was 86400000ms. I though that it might be a too big number to handle, so I replace the wait by a time delay vi, with a time of 86400s, but it did not work either. Is there a maximum delay ? If yes, is there a turn around ?
Thank you
Matt
07-28-2011 03:04 PM
Hi Matt,
what about a loop that waits 600 times for 1 second (to wait for 10min in total) or a loop that waits 864 times for 100s (to wait for a full day)?
Or use a different approach:
Instead of waiting for long times you could check the timestamp/DateTimeRecord and start your actions at certain values of minute or when the day number changes...
07-28-2011 03:05 PM
Hi Matt,
Time delay in LabVIEW is a U32 data type, so I am not sure why "86400" is not working as it can be accomodated in 32 bits.
What you can try is to have continuous time delays with the value that you know works.
07-28-2011 04:09 PM
A few points.
What are you doing using an express vi in a RT target?- this one only calls the wait primitive after multiplying seconds (as DBL by 1000.000) and coercing it to a U32. All time consuming! use the wait primitave (but read the detailed help- wait acts differently on a RTOS.)
Second: you don't want the RTOS real time clock to roll-over while you wait. Especially dangerous if you have long waits- I bet that every 18 days you have a crash if you wait all day. befor you wait check the ms timer value and coerce your wait so the timer does not exceed 2,147,483,647 when you exit.
Now, its moe\re likely that the exact instant you wake up is less critical that the rest of the timing. you can safely avoid the ms timer rollovers with a wait for next ms multiple and check the time of day. Go back to sleep or get up and take your readings.
07-28-2011 04:45 PM
You can use this or something similar. This is part of a larger project, but you can get the idea.
07-28-2011 09:43 PM
Thank you all for the ideas, I will try some of them next week and let you know.
Matt