

This is a small example that shows how to use this library. Driver full name (with extension) is: DS1307.c.

OUT_32768Hz: output is square wave with frequency equals to 32768HzĭS1307 Library for mikroC compiler download:ĭriver source file download link is below, installation of this driver is easy, just add it to project folder. OUT_8192Hz: output is square wave with frequency equals to 8192Hz

OUT_4096Hz: output is square wave with frequency equals to 4096Hz OUT_1Hz: output is square wave with frequency equals to 1Hz OUT_ON: output is on (internally floating) OUT_OFF: output is off (internally attached to ground) Void SQWE_Set(SQWE pin_out): this function configures the SQW/OUT pin of the DS1307, where pin_out is one of the following: Void RTC_Write_Reg(uint8_t reg_address, uint8_t reg_value): writes reg_value to register of address reg_address. Uint8_t RTC_Read_Reg(uint8_t reg_address): this function returns the value stored in register of address reg_address. Void OSC_Disable(): disables the DS1307 oscillator. Void OSC_Enable(): enables the DS1307 oscillator. RTC_Time *RTC_Get(): reads time and date from the DS1307, this function returns them as a variable of type struct (same as the previous function). Where dow is day of the week (Monday, Tuesday …) and day is month day.ĭow range: 1 – 7 (1 equals Sunday, 2 equals Monday …) Seconds, minutes, hours, dow, day, month and year. Void RTC_Set(RTC_Time *time_t): this function sets time and date (writes time and date to the DS1307) where the variable time_t of type struct (structure) which collects the following unsigned 8-bit integer variables: Otherwise the driver will automatically use hardware I2C1 module and it will use hardware I2C2 module if the line below is defined in the main code: It will use the software I2C (using mikroC built-in soft I2C library) if the following line is defined in the main code: This driver supports software I2C and hardware I2C (more faster). To simplify project C code, I wrote a small library for the DS1307. DS1307 RTC library (driver) for mikroC compiler:
