RTC_GetTime 讀出來的時間都是0 怎么回事?
熱門產(chǎn)品 :
CH32X035: 32位USB+USB PD單片機
RTC_GetTime 讀出來的時間都是0 怎么回事?
指針變量需要指向?qū)嶋H變量的地址,否則請傳入真實的變量地址:
你可以這樣:
????????//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);