RTC_GetTime 读出来的时间都是0 怎么回事?
热门产品 :
CH397: 高集成度、低功耗USB网卡芯片
RTC_GetTime 读出来的时间都是0 怎么回事?
指针变量需要指向实际变量的地址,否则请传入真实的变量地址:
你可以这样:
//PUINT16 year,month,day,hour,m,sec; uint16_t year,month,day,hour,m,sec; RTC_GetTime(&year,&month,&day,&hour,&m,&sec); PRINT("========%04d-%02d-%02d %02d:%02d:%02d=========\r\n",year,month,day,hour,m,sec);
或者这样:
uint16_t year1,month1,day1,hour1,m1,sec1; PUINT16 year,month,day,hour,m,sec; year = &year1; month = &month1; day = &day1; hour = &hour1; m = &m1; sec = &sec1; //uint16_t year,month,day,hour,m,sec; RTC_GetTime(year,month,day,hour,m,sec); PRINT("========%04d-%02d-%02d %02d:%02d:%02d=========\r\n",*year,*month,*day,*hour,*m,*sec);