Pages: 1 [2]   Go Down
Author Topic: Triggering Interrupts with Real Time Clock  (Read 6649 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Sr. Member
****
Karma: 1
Posts: 322
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Nick,
I read your page on interrupts and I look forward to using you code to calculate frequency by checking the period in a project of mine in the future.

For this project, can the 1 Hz signal be feed to T1 (D5) and the counter continue to count even when the processor is a sleep?  If the value 3600 (or 3599) where placed in the CTC register.  Could an interrupt be generated to wake the processor?

Because of the synchronization process, the processor clock could not be stopped.  So as noted in http://www.gammon.com.au/forum/?id=11497 the SLEEP_MODE_STANDBY "...similar to power-down mode, except that the oscillator is kept running."  If that is the case then will counter 1 continue to accumulate until it reaches 3600, raise the interrupt, and wake the processor in one hours time?

As I see it, the greatest advantage to this is that a DS1307 and a crystal is less than a dollar (US or Australian).  The only question would be, is it saving enough power to make it worth it?  I would think that if you are putting your processor to sleep, there is a good change you will want to know the time when you wake up, but maybe not.
Logged

Global Moderator
Online Online
Brattain Member
*****
Karma: 497
Posts: 19053
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't believe the timer is running except in IDLE sleep mode (which doesn't save a heap of power).

I think you are better off going into a deep sleep mode with the watchdog timer, and then finding out the time when you wake up (via the DS1307).
Logged


Offline Offline
Sr. Member
****
Karma: 1
Posts: 322
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have come to the conclusion that the DS1307 will not work.

However, the PCF8563 will.  This is a very similar chip and rather inexpensive (10 for $8.12 on ebay).  It only needs a  32.768 kHz crystal to work.  The crystals are on ebay 10 for $2.50 or 50 for $7.  So for about a dollar (US) each you have an RTC with interrupt output.

There are two types of interrupts, Alarm and Timer.  The timer is a count down timer of an 8-bit register.  It can count down at 4 different clock rates but the most useful would be the one second and one minute rates.  So in one second resolution you can sleep for 255 seconds (4 minutes 15 seconds).  Or with one minute resolution you can sleep for 255 minutes (4 hours 15 minutes).

This a both cheap and versatile.
Logged

Pages: 1 [2]   Go Up
Jump to: