Interfacing RTC DS1307 with atmega32
DS1307 is a Real Time Clock ( RTC ) IC that can count second,minute,hour,day,month,year and day of week precisely. You can use AVR timers to make RTC but when power supply drop from AVR , time will be reset! but DS1307 have a pin to connect a tiny battery, with a coin size battery DS1307 can count time for more than 2 years, non-stop!
DS1307 connect to microcontroller trough I2C protocol. it is so simple to use this IC in Codevision AVR because this IC has header file and library and system designer easily can use this IC in project. DS1307 is precise, cost efficient and easy to use RTC IC. For interfacing DS1307 with I2C you only need 2 Resistor and nothing else.
DS1307 widely used in Commercial, Industrial and academic projects.
Important Notice: If you want to make a precise RTC buy high quality IC and High Quality 32.768 KHz Crystal.
Project Description :
This is a Codevision AVR Project. you can download Source File + Schematic File ( Proteus ). You can run project in Proteus. For me this project run and work correctly but some people report a problem in simulation.
In this project we use DS1307 as RTC and connect this IC to AVR Atmega32 trough I2C. A 32.768 KHz Crystal connected to DS1307 pin 1 and pin 2 as clock crystal. DS1307 pin3 should be ground if you won’t use battery, if you want use battery you should connect battery + to pin3 and battery – to GND.
We use 16×2 Alphanumeric LCD as Display and show Date and Time on this LCD. 3 key placed to set date and time. this 3 keys connected trough OR gate to External Interrupt ( INT0 ) you can use diode as OR gate. to adjust date and time first should press “SET” key then selected part show in right of lcd (for example “H” means Hour ready to edit), by pressing + and – keys you can increase or decrease selected item, by press SET key again next item will be select and generally use this key to select date, time, hour, …. . to exit edit mode press SET key and hold for 1 second.
File Size: 221.0 KB
Download: Download Interfacing DS1307 Project