Tag Archives: soft i2c

DS1307 I2C RTCC Interface using SoftI2C lib

In the last tutorial, I explained you how to use our SoftI2C library to read and write a 24CXX series I2C EEPROM. Now I will continue our exploration and write a register access layer for the DS1307 chip. The DS1307 chip is a real time clock and calendar IC. The register access layer that we will develop provides the application programmer with function that reads and write the registers of DS1307. Remember that any piece of hardware appears to the CPU as a set of registers only. DS1307 has :- Seven Registers (from 0x00 to 0x06) that are used for timekeeping functions. One CONTROL register(0x07) for square wave generation setting (we don’t use this for simplicity). 56 bytes of battery backup RAM (from 0x08 to 0x3F) Fig. : A Simple DS1307 RTC Module.   Once the application programmer has access to functions that reads and writes to any register (specified by its address) inside DS1307 ic, he/she can easily get and set the time infos like sec,min,hour, am/pm, date,month,year etc. The register access layer is built over the core Soft I2C layer. The register access layer consists of the following three functions. void DS1307Init(void) { SoftI2CInit(); } /*************************************************** Function To Read Internal Registers of DS1307 ——————————————— address : Address of the register data: value of register is copied to this. […]