显示汉字,有点问题,只有白框
//*在指定位置显示一个16x16汉字
//x:0~234
//y:0~308
//num:要显示的字符:在CodeChn中的编号 */
void LCD_ShowChn(uint8_t x,uint16_t y,uint8_t num)
{
#define MAX_CHAR_POSX 234
#define MAX_CHAR_POSY 308
uint16_t temp;
uint8_t pos,t;
if(x>MAX_CHAR_POSX||y>MAX_CHAR_POSY)
return;
//设定一个字符所占的大小
//开辟空间
// LCD_WR_CMD(0,0x2,x);//
// LCD_WR_CMD(1,0x3,y);
// LCD_WR_CMD(0,0x04,x+5); //结束列数(0~239)
// LCD_WR_CMD(1,0x05,y+11);//结束行数(0~319)
// LCD_WR_REG(0x0E);
LCD_WR_COM_DATA(0x0020,x);//设置X坐标位置
LCD_WR_COM_DATA(0x0021,y);//设置Y坐标位置
LCD_WR_COM_DATA(0x0050, x); // Horizontal GRAM Start Address
LCD_WR_COM_DATA(0x0052, y); // Vertical GRAM Start Address
LCD_WR_COM_DATA(0x0051, x+15); // Horizontal GRAM End Address
LCD_WR_COM_DATA(0x0053, y+15); // Vertical GRAM end Address
LCD_WR_COM(0x0022); //指向RAM寄存器,准备写数据到RAM
//num = num-' '; //得到偏移后的值
for(pos=0;pos<16;pos++)
{
for(t=0;t<16;t++)
{
temp = (CodeChn[num][pos*2]<<8)+CodeChn[num][pos*2+1];
if(temp&0x01)
LCD_WR_DATA(POINT_COLOR);
else
LCD_WR_DATA(0xffff);//白色
temp >>= 1;
}
}
LCD_WR_COM_DATA(0x0050, 0x0000); // Horizontal GRAM Start Address
LCD_WR_COM_DATA(0x0051, 0x00EF); // Horizontal GRAM End Address
LCD_WR_COM_DATA(0x0052, 0x0000); // Vertical GRAM Start Address
LCD_WR_COM_DATA(0x0053, 0x013F); // Vertical GRAM Start Address
} |