Part Number: TM4C1294KCPDT
Tool/software: TI-RTOS
Hi Everyone,
I am developing an embedded application on TM4C1294KCPDT using TI-RTOS V2.16. Compiler CCS v6.2.
I am trying to get the current time from the system clock. I am using as RTC(Real time clock) to get and set the clock variables.
I am using Below code ::
ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN |
SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000);
SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);
HibernateEnableExpClk(ui32SysClock);
HibernateClockConfig(HIBERNATE_OSC_LOWDRIVE);
HibernateRTCDisable();
HibernateRTCMatchSet(0,HibernateRTCGet()+1);
HibernateIntEnable(HIBERNATE_INT_RTC_MATCH_0);
HibernateCounterMode(HIBERNATE_COUNTER_24HR);
HibernateRTCSet(0); // this code is for time stamps
HibernateRTCEnable();
now = HibernateRTCGet(); //get the current value in seconds
System_printf("now = %ld \r HibernateRTCGet() %d\n", now, HibernateRTCGet());
System_flush();
SYSTEMTIME lt = {0};
GetLocalTime(<); // This is for windows to get the local time But it is not working ccs
time_t t = (ntohl(receive_timestamp[0]) - DIFF_SEC_1900_1970); // Here How to set the current time variable if we set the time here we can able to set the calendar and we may get the current time
memcpy(&TimerStruct, localtime(&t), sizeof (struct tm));
HibernateCalendarSet(&TimerStruct);
HibernateCalendarGet(&TimerStruct);
System_printf("Date :: %d Day \t %d Month \t %d Year\n", TimerStruct.tm_mday, TimerStruct.tm_mon, TimerStruct.tm_year);
System_flush();
System_printf("TIME :: %d Hour \t %d Minute \t %d Sec\n", TimerStruct.tm_hour, TimerStruct.tm_min, TimerStruct.tm_sec);
System_flush();
I Mentioned the comments for the code please check that comments and give the solution. Right now i am getting Compilation errors.