struct tm tm2;
struct tm tm1 = {50,59,23,29,3,2008,0,0,0};
void main()
{
g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN |
SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_480), 120000000);
// Enable the Hibernation module.
SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);
// Wait for the Hibernate module to be ready.
while(!SysCtlPeripheralReady(SYSCTL_PERIPH_HIBERNATE))
{
}
HibernateEnableExpClk(g_ui32SysClock);
//
// Wait an amount of time for the module to power up.
//
// Configure the clock source for Hibernation module and enable the
// RTC feature.
HibernateClockConfig(HIBERNATE_OSC_HIGHDRIVE);
ROM_HibernateCounterMode(HIBERNATE_COUNTER_24HR);
ROM_HibernateCalendarMatchSet(0, &tm1);
HibernateRTCMatchSet(0, HibernateRTCGet() + 1);
HibernateIntEnable(HIBERNATE_INT_RTC_MATCH_0);
HibernateCalendarSet(&tm1);
HibernateRTCEnable();
while(1)
{
HibernateCalendarGet(&tm2);
}
}
使用上面的程序能够读出月 日 时 分 秒的数据,但是年的数据一直是错误的数据,不知是什么问题,日的数据每个月都是31天,是不是要后期处理日的数据?