4:28 pm
February 12, 2018
I have an application where I need to countdown an operation for 23 hours. Right now I have the RTC module and have modified the RTC function that come with the standard Arduino LabVIEW functions so that that it can take an input for number of hours and will return the current date/time and the date/time for 23 hours in the future. I can then compare the two until they are equal and I know that 23 hours have elapsed. I also use a 20x4 display and show the end target date/time.
I would like to be able to instead display a countdown showing the remaining hours/minutes/sec, and I am planning on doing this by figuring it out based on the U8 values for the days/hours/min/sec in the RTC function. However I am wondering if there is functionality in the RTC module that could be accessed to make this easier or allow for other time based operations to be done.
5:46 am
March 12, 2015
You could also do this without an RTC if you only need to know relative time (say from power up or an event). There is a timer interrupt example in which you could set the interrupt time to something like 1s. Then all you need to do is keep a counter of seconds and compute your minutes and hours based off that by some simple math.
If you still need to use an RTC, I don't think there is anything built in. The DS1307 at least just returns time in Month/Day/Year/Hours/Minutes/Seconds. You would have to compute the time remaining. Maybe easiest to time to a single unit, like seconds, them convert back to HH:MM:SS before displaying.
10
1 Guest(s)