Hi... I have a ds1307 working fine with my arduino...
I'm having difficult however trying to have it count down...
I want the ability to set times for triggering things to turn on/off.
Can anyone help?
Hi... I have a ds1307 working fine with my arduino...
I'm having difficult however trying to have it count down...
I want the ability to set times for triggering things to turn on/off.
Can anyone help?
Can't you set an alarm with that RTC?
I tought this was possible.
Hummm... I just quickly reviewed the datasheet for the 1307 and don't see any switches that makes it count backwards... Perhaps there is a trick I have overlooked...
Can you explain more what you had in mind?
It can't count backwards.
What was being suggested is that you wanted to count down to a certain time. Instead of doing this you set an alarm forwards in time when you want the count down to finish. So when the alarm is triggered your count down will have finished.
The only way to get a count down is to subtract the count you have from the time when it will finish and display that. You do that with software.
From the datasheet, it doesn't seem to have a countdown capability, or an alarm facility.
http://datasheets.maxim-ic.com/en/ds/DS1307.pdf
You'd have to implement these in the Arduino.
[edit]Mike beat me to it. Again. ;D [/edit]
ok... I considered that option as well... So say I want to have something triggered in 5 minutes... I set my forward time as 01:10:00 (hh:mm:ss)... Which is fine...
Is there an easy way to subtract the forward time from the current changing time?
(I'm very familiar with this using oracle/sqlserver which have many date diff functions - I'm just not as fluent on the chip side)...
Any example would help...
The code should be fairly simple, assuming you're getting frequent updates from the RTC.
The only thing to watch out for is the BCD format of the data.
You know... I think I got it... It was much simpler than I thought... It's now working just fine...
The DS1337 which is similar to the DS1307 has two alarms that you can
set. My alarm examples are in the application hints at
http://tinyurl.com/y8exe7k
(* jcl *)
www: http://www.wiblocks.com
twitter: http://twitter.com/wiblocks
blog: http://luciani.org