您的位置 首页 系统

单片机GUI编程显现汉字

单片机GUI编程显示汉字int8GetGB12_Address(int8*ptr){int8addr;for(addr=0;addrsizeof(gb16Dot)sizeof(gb12Dot[0]);

单片机GUI编程显现汉

int8GetGB12_Address( int8 *ptr )

{

int8 addr;

for (addr=0;addr//查找定位

{

if (( *ptr == gb12Dot[addr].Index[0]) && ( *(ptr+1) == gb12Dot[addr].Index[1]))

{break;}

}

returnaddr;

}

GUI_PutHZ(x1,y1,(uint8*)gb12Dot[GetGB12_Address(ptr)].Msk,12, 12);

const typFNT_GB12gb12Dot[] = {

“ ”, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

“:”, 0x00,0x00,0x00,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,

0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

“敏”, 0x41,0x00,0x7F,0x00,0x81,0xE0,0x7F,0x40,0x55,0x40,0xFF,0x40,0x55,0x40,0x54,0x80,

0x7E,0x80,0x05,0x40,0x1A,0x20,0x00,0x00,

“感”, 0x01,0x40,0x7F,0xE0,0x41,0x00,0x7F,0x40,0x5D,0x40,0x54,0xA0,0x9D,0x60,0x82,0x20,

0x54,0x40,0x52,0xA0,0x9F,0x80,0x00,0x00,

“度”, 0x02,0x00,0x7F,0xE0,0x48,0x80,0x7F,0xE0,0x48,0x80,0x4F,0x80,0x40,0x00,0x5F,0x80,

0x45,0x00,0x87,0x00,0xB8,0xE0,0x00,0x00

}

typedef struct//汉字字模数据结构

{

int8 Index[2];//汉字内码索引

int8 Msk[24];//点阵码数据

}typFNT_GB12;

voidGUI_PutHZ(uint32 x, uint32 y, uint8 *dat, uint8 hno, uint8 lno)

{uint8i;

for(i=0; i

{GUI_LoadLine(x, y, dat, hno);//输出一行数据

y++;//显现下一行

dat += (hno>>3);//核算下一行的数据

if( (hno&0x07)!=0 ) dat++;

}

}

uint8GUI_LoadLine(uint32 x, uint32 y, uint8 *dat, uint32 no)

{

uint8bit_dat;

uint8i;

TCOLORbakc;

if(x>=GUI_LCM_XMAX)

return(0);

if(y>=GUI_LCM_YMAX)

return(0);

for(i=0; i

{

if( (i%8)==0 ) bit_dat = *dat++;

if( (bit_dat&DCB2HEX_TAB[i&0x07])==0 )

GUI_CopyColor(&bakc, back_color);

else

GUI_CopyColor(&bakc, disp_color);

GUI_Point(x, y, bakc);

if( (++x)>=GUI_LCM_XMAX )

return(0);

}

return(1);

}

uint8GUI_Point(uint8 x, uint8 y, TCOLOR color)

{

if(x>=GUI_LCM_XMAX)

return(0);

if(y>=GUI_LCM_YMAX)

return(0);

if( (color&0x01) != 0 )

gui_disp_buf[y][x>>3] |=DCB_HEX_TAB[x&0x07];

else

gui_disp_buf[y][x>>3] &= (~DCB_HEX_TAB[x&0x07]);

LCD_UpdatePoint(x, y);

return(1);

}

uint8 constDCB_HEX_TAB[8] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};

TCOLORgui_disp_buf[GUI_LCM_YMAX][GUI_LCM_XMAX/8];

voidLCD_UpdatePoint(uint32 x, uint32 y)

{ // uint32addr;

uint32addr11;

uint32addr22;

//addr = y*(GUI_LCM_XMAX>>3) + (x>>3);

addr11 = y*32%6 + (x>>3);

addr22 =y*32/256;

//WriteCmd3(addr&0xFF, addr>>8,AddrSet);//置地址指针

WriteCmd3(addr11, addr22,AddrSet);//置地址指针

delay(10);

WriteCmd2(gui_disp_buf[y][x>>3],DataWAddrI);

delay(10);

}

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/qianrushi/xitong/258763.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部