RTC时间在LCD上显示需注意的问题

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/euxnijuoh/article/details/53458359
unsigned char displayTime[2];
rtc->day = ReadRtc();//从RTC寄存器读取时间
displayTime[0] = 0x30+(rtc->day / 16);
displayTime[1] = 0x30+(rtc->day % 16);
DisPlayTime(1,0,displayTime);//LCD显示时间函数
BCD码转十进制:(rtc->day / 16);
              (rtc->day % 16);
十进制转ASCII码:0x30+(rtc->day / 16);
                0x30+(rtc->day % 16);
也可这样写:
unsigned char displayTime[2];
rtc->day = ReadRtc();//从RTC寄存器读取时间
displayTime[0] = 0x30+(rtc->day >> 4);
displayTime[1] = 0x30+(rtc->day & 0x0f);
DisPlayTime(1,0,displayTime);//LCD显示时间函数

展开阅读全文

没有更多推荐了,返回首页