DS1307, a 64 x 8, Serial, I2C Real-Time Clock, is a low-power, full binary-coded decimal (BCD) clock/calendar plus 56 bytes of NV SRAM. Address and data are transferred serially through an I2C, bidirectional bus. The clock/calendar provides seconds, minutes, hours, day, date, month, and year information. It a product of Maxim/Dallas Semiconductor, see the product page. This is an example how to interface DS1307 with 8051. I use SDCC as C Compiler. My schematic is shown below.
Schematic: 8051 interface to DS1307
Datasheet- DS1307 [pdf]
Source Code
- ds1307.h
- test_ds1307.c
Note: require lcd.h and i2c.h