Use RTC module as a timer | Arduino Compatible Compiler for LabVIEW Discussions | Forum

Avatar
Please consider registering
guest
sp_LogInOut Log In sp_Registration Register
Register | Lost password?
Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Feed Topic RSS sp_TopicIcon
Use RTC module as a timer
February 12, 2018
4:28 pm
Avatar
tpetruk
Member
Members
Forum Posts: 6
Member Since:
February 12, 2018
sp_UserOfflineSmall Offline

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.

February 13, 2018
5:46 am
Avatar
Steffan
Admin
Forum Posts: 408
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

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.

Forum Timezone: UTC 0
Most Users Ever Online: 100
Currently Online:
1
Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
miche91: 33
scottj: 28
scadao: 23
Member Stats:
Guest Posters: 5
Members: 202
Moderators: 0
Admins: 3
Forum Stats:
Groups: 1
Forums: 2
Topics: 266
Posts: 1222
Newest Members:
pujacontrol
Administrators: geadmin: 22, filipealtoe: 96, Steffan: 356