Contents
RTC
RTC_Init
Defination | void RTC_Init() |
Input Arguments | none |
Return Value | none |
Description | This function is used to Initialize the Ds1307 RTC. |
Usage | RTC_Init(); |
RTC_SetTime
Defination | void RTC_SetTime(uint8_t var_hour_u8, uint8_t var_min_u8, uint8_t var_sec_u8) |
Input Arguments | uint8_t: Hour (0x00-0x23) BCD format uint8_t: Minute (0x00-0x59) BCD format uint8_t: Second (0x00-0x59) BCD format |
Return Value | none |
Description | This function is used to update the Time(hh,mm,ss) of Ds1307 RTC. The new time is updated into the non volatile memory of Ds1307. Note: The I/P arguments should of BCD, |
Usage | RTC_SetTime(0x10,0x40,0x20); //All the arguments should be in BCD format |
RTC_SetDate
Defination | void RTC_SetDate(uint8_t var_day_u8, uint8_t var_month_u8, uint8_t var_year_u8) |
Input Arguments | uint8_t: Day(0x01-0x31) BCD format uint8_t: Month(0x01-12) BCD format uint8_t: Year(0x00-0x99) BCD format |
Return Value | none |
Description | This function is used to set Date(dd,mm,yy) into the Ds1307 RTC. The new Date is updated into the non volatile memory of Ds1307. Note: The I/P arguments should of BCD. |
Usage | RTC_SetDate(0x15,0x08,0x47); //All arguments should be in BCD format. |
RTC_GetTime
Defination | void RTC_GetTime(uint8_t *ptr_hour_u8,uint8_t *ptr_min_u8,uint8_t *ptr_sec_u8) |
Input Arguments | uint8_t *: Address to copy Hour. uint8_t *: Address to copy Minute. uint8_t *: Address to copy Second. |
Return Value | none |
Description | This function is used to get the Time(hh,mm,ss) from Ds1307 RTC. Note: The time read from Ds1307 will be of BCD format, |
Usage | uint8_t hour,min,sec; RTC_GetTime(&hour,&min&sec); //Now the hour,min,sec will have the time in BCD format. |
RTC_GetDate
Defination | void RTC_GetDate(uint8_t *ptr_day_u8,uint8_t *ptr_month_u8,uint8_t *ptr_year_u8) |
Input Arguments | uint8_t * : Address to copy Day. uint8_t * : Address to copy Month. uint8_t * : Address to copy Year. |
Return Value | none |
Description | This function is used to get the Date(d,m,y) from Ds1307 RTC. Note: The date read from Ds1307 will be of BCD format, |
Usage | uint8_t hour,min,year; RTC_GetDate(&hour,&min&year); //Now the hour,min,year will have the Date in BCD format. |