电路用原子的,应该没问题。如下
程序用的原子的,在main中调用发送到串口屏。
sprintf(HMIbuffer,"t5.txt="%d"",calendar.w_year); //year
HMISends(HMIbuffer);
HMISendb(0xff);
sprintf(HMIbuffer,"t6.txt="%d"",calendar.w_month); //month
HMISends(HMIbuffer);
HMISendb(0xff);
sprintf(HMIbuffer,"t7.txt="%d"",calendar.w_date); //day
HMISends(HMIbuffer);
HMISendb(0xff);
sprintf(HMIbuffer,"t14.txt="%d"",calendar.hour); //hour
HMISends(HMIbuffer);
HMISendb(0xff);
sprintf(HMIbuffer,"t15.txt="%d"",calendar.min); //min
HMISends(HMIbuffer);
HMISendb(0xff);
通电运行正常,断电后再用又从设置的时间开始了
if (BKP_ReadBackupRegister(BKP_DR1) != 0x5850)
RTC_Set(2017,01,10,16,10,20);
BKP_WriteBackupRegister(BKP_DR1, 0X5050);
}
一周热门 更多>