void delay(int ms)
{
int ii,jj;
if (ms<1) ms=1;
for(ii=0;ii<ms;ii++)
for(jj=0;jj<500;jj++);
}
/****主函数*****/
void main(void)
{
OLED_Init();
delay(5);
while(1)
{
OLED_ShowCN(3,0,1);
OLED_ShowCN(21,0,2);
delay(500);
//delay(500);
//OLED_Fill(0xff);
//delay(1000);
}
}
/*******************************************
//OLED: x,y -- 起始点坐标(x:0~127, y:0~7); N:汉字在codetab.h中的索引 ----OK
********************************************/
void OLED_ShowCN(unsigned char x, unsigned char y, unsigned char N)
{
unsigned char wm=0;
unsigned int adder=32*N;
OLED_SetPos(x , y);
for(wm = 0;wm < 16;wm++)
{
Write_IIC_Data(F16x16[adder]);
adder += 1;
}
OLED_SetPos(x,y + 1);
for(wm = 0;wm < 16;wm++)
{
Write_IIC_Data(F16x16[adder]);
adder += 1;
}
}/***************************16*16的点阵字体取模方式:共阴——列行式——逆向输出*********/
const unsigned char F16x16[] =
{
0x7F,0x8F,0xFF,0x00,0xDF,0xEF,0xF7,0xB7,0xB7,0x00,0xB7,0xB7,0xB7,0xB7,0xF7,0xFF,
0x7F,0x9F,0xE7,0xF8,0xF7,0xCF,0xFD,0xFD,0xFD,0x00,0xFD,0xFD,0xED,0xDD,0xE1,0xFF,//"炜",0
0x80,0x70,0x00,0xFF,0x20,0x10,0x08,0x48,0x48,0xFF,0x48,0x48,0x48,0x48,0x08,0x00,
0x80,0x60,0x18,0x07,0x08,0x30,0x02,0x02,0x02,0xFF,0x02,0x02,0x12,0x22,0x1E,0x00,//"炜",0
};
引脚设置没问题,程序能成功编译
OLED_ShowCN(21,0,2);
看程序参数,第一个应该可以显示字符数组里的第二个字,第二个应该显示全0xff,或全0x00,或乱码,现在是OLED_ShowCN(3,0,1);这个能不能显示出汉字
一周热门 更多>