RTC_ReadDate(&sysTime); printf("%02X-%02X-%02X %02X:%02X:%02X 星期\r\n", \ sysTime.year, sysTime.month, sysTime.day, sysTime.hour,\ sysTime.minute, sysTime.second, sysTime.week); delay_ms(500); OLED_ShowStr(0,3,“sysTime.year”,10); //-------------------------------------------------------------- // Prototype : void OLED_ShowChar(unsigned char x, unsigned char y, unsigned char ch[], unsigned char TextSize) // Calls : // Parameters : x,y -- 起始点坐标(x:0~127, y:0~7); ch[] -- 要显示的字符串; TextSize -- 字符大小1:6*8 ; 2:8*16) // Description : 显示codetab.h中的ASCII字符,有6*8和8*16可选择 //-------------------------------------------------------------- void OLED_ShowStr(unsigned char x, unsigned char y, unsigned char ch[], unsigned char TextSize) { unsigned char c = 0,i = 0,j = 0; switch(TextSize) { case 1: { while(ch[j] != '\0') { c = ch[j] - 32; if(x > 126) { x = 0; y++; } OLED_SetPos(x,y); for(i=0;i<6;i++) WriteDat(F6x8[c]); x += 6; j++; } }break; case 2: { while(ch[j] != '\0') { c = ch[j] - 32; if(x > 120) { x = 0; y++; } OLED_SetPos(x,y); for(i=0;i<8;i++) WriteDat(F8X16[c*16+i]); OLED_SetPos(x,y+1); for(i=0;i<8;i++) WriteDat(F8X16[c*16+i+8]); x += 8; j++; } }break; } } |
sysTime.year, sysTime.month, sysTime.day, sysTime.hour,\
sysTime.minute, sysTime.second, sysTime.week);
OLED_ShowStr(0,3,str,strlen(str));
评分
查看全部评分
总之,先把要显示的内容想办法,凑或转换成一个字符串,然后用OLED_ShowStr函数显示字符串到屏
评分
查看全部评分
评分
查看全部评分
谢谢,感激不尽!