大学生
最后登录1970-1-1
在线时间 小时
注册时间2016-9-5
|
想把字符改大点,可是总是出现乱码,有朋友做过吗、??求解惑。- /**
- * @brief OLED_ShowStr,显示codetab.h中的ASCII字符,有6*8和8*16可选择
- * @param x,y : 起始点坐标(x:0~127, y:0~7);
- * ch[] :- 要显示的字符串;
- * TextSize : 字符大小(1:6*8 ; 2:8*16)
- * @retval 无
- */
- 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][i]);
- x += 6;
- j++;
- }
- }break;
- case 2:
- {
- while(ch[j] != '\0')
- {
- c = ch[j] - 32;
- if(x > 126)
- {
- 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;
- /*·····································修改显示12*24部分···········································*/
- case 3:
- {
- while(ch[j] != '\0')
- {
- c = ch[j] - 48;
- if(x > 120)
- {
- x = 0;
- y++;
- }
- OLED_SetPos(x,y);
- for(i=0;i<12;i++)
- WriteDat(F12X24[c*24+i]);
- OLED_SetPos(x,y+1);
- for(i=0;i<12;i++)
- WriteDat(F12X24[c*24+i+12]);
- OLED_SetPos(x,y+2);
- for(i=0;i<12;i++)
- WriteDat(F12X24[c*24+i+24]);
- x += 12;
- j++;
- }
- }break;
- }
- }
复制代码
|
|