Spread the love

 Untitled

X1 & X2 – Used to connect crystal oscillator of 32.768 KHz, accuracy of RTC purely depends upon crystal oscillator. In modern devices crystal oscillator is not used directly because heat can cause drift in oscillation, to avoid this DS32KHz IC is used which is automatically adjustable with temperature.

Vbat –Used to connect external power source in case of main power failure which is generally a 3 V lithium battery with 48 mAhr (up tp 10 years back up).

GND – common ground

Vcc – main power supply

SCL & SDA – I2C lines to connect chip with master

SQW/OUT – this is output pin which provides 1KHz, 4KHz, 8KHz or 32KHz square wave if enabled. It needs external pull up cause open drain.

About DS1307 – it has total of 64 bytes of RAM space with address 00 to 3F. out of which 00 to 06 is set aside to RTC value like time and date, 07 is for control register and rest 08 to 3F is for general purpose data storage.

Control register of RTC

control register

OUT –  1 mean SQW/OUT pin low, 0 mean SQW/OUT pin high

SQWE – square wave enable, 1 mean oscillator output is enable, 0 mean disable

RS1

RS0

Output frequency for selecting oscillator output frequency

0

0

1 KHz

0

1

4.096 KHz

1

0

8.192 KHz

1

1

32.768 KHz