Tool/software: Code Composer Studio
Hello Sir,
I Have Problem regarding RTC Code.
In My Code, Hour, Minute, Second, Month and Year Working Properly. Only Problem in Setting or Reading in RTC DATE.
1 to 7 and 16 to 23 Date Read writes correctly. But Problem is that when i am trying to set 8 to 15 or 24 to 31 Date in RTC, then it display = Enter Date – 8.
For Example, if I try to set 9 then it display = 9- 8 = 1.
Same way, if I try to set 26 then it display = 26- 8 = 18. And So on.
Software: Code Composer Studio 5.4.0
Controller: TM4C129 – ENCPDT13.
1.) RTC Initialize Function. Only 1 timed Called.
void Initialize_RTC(void)
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);
HibernateEnableExpClk(g_ui32SysClock);
HibernateRTCEnable();
HibernateCounterMode(HIBERNATE_COUNTER_24HR);
}
2.) RTC SET Function. This function is called when RTC Time Set.
- Note : I have Always set all parameters (Set_Min, Set_Hour, Set_Sec , Set_Day, Set_Month, Set_Year) of RTC when need to Set RTC Time.
void Set_Rtc_Data(void)
{
struct tm RTC_Temp;
RTC_Temp.tm_hour= Set_Min;
RTC_Temp.tm_min = Set_Hour;
RTC_Temp.tm_sec = Set_Sec;
RTC_Temp.tm_mday= Set_Day;
RTC_Temp.tm_mon = Set_Month;
RTC_Temp.tm_year = Set_Year;
HibernateCalendarSet(&RTC_Temp);
}
3.) RTC Read Function. Every second this function Called
void Get_RTC_Data(void)
{
struct tm RTC_Temp;
HibernateCalendarGet(&RTC_Temp);
RTC_Sec = RTC_Temp.tm_sec;
RTC_Min = RTC_Temp.tm_min;
RTC_Hour = RTC_Temp.tm_hour;
RTC_Day = RTC_Temp.tm_mday;
RTC_Month = RTC_Temp.tm_mon;
RTC_Year = RTC_Temp.tm_year;
}