Is there a clever way to sync with an RTC chip?

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Folks,

I've got a clock which uses an ATtiny84 to drive the display, and a RTC chip to keep time (it's battery-backup feature is the main reason for using a separate chip).

Is there a clever way to keep the AVR synced with the RTC?

I don't have enough pins on the ATtiny84 to use the square wave output from the RTC as an interrupt. The clock doesn't display seconds. So I just keep a timer which interrupts at 1 Hz (approximate because I'm using the internal oscillator). Whenever it reaches 30 seconds I pull the minutes and hours from the RTC, and resync the seconds. Does this sound like a reasonable method?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You should keep the seconds accurate enough with the internal RC for a minute or so. (1.7%)
You keep the minutes accurate enough for an hour or so.
So you can read the RTC every hour. Even though you do not display seconds, the risk of the minute 'changing' at the wrong time would be annoying.

Your current strategy sounds good enough.

An ATtiny84 has quite a lot of pins. An I2C RTC uses 2 pins, an SPI RTC uses 4 pins.

What is your total pin budget?
You can get some pretty good tips on pin sharing.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've already designed, received, and populated the board so it's too late for different choices. I've got two buttons (one shares with an ISP line), three to drive an LED driver, four transistors for row drivers, and the two for I2C.

https://github.com/szczys/Binary...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can't think of anything wrong with your strategy.

The largest known prime number: 282589933-1

It's easy to stop breaking the 10th commandment! Break the 8th instead.