|
這是我最近寫的tft顯示一些簡(jiǎn)單漢字的源程序,是通過(guò)取摸軟件取出你想要的漢字,不需要全字庫(kù),簡(jiǎn)單明了。- void HZ(unsigned short x, unsigned short y, unsigned char c[2], unsigned int dcolor,unsigned int bgcolor){
- unsigned int i,j,k;
-
- //TFT_SetWindow(x,y,x+32-1, y+32-1); //選擇坐標(biāo)位置
- LCD_Set_Window(x,y,32,32);
- LCD_SetCursor(x,y);
- LCD_WriteRAM_Prepare();
- for (k=0;k<40;k++) { //15標(biāo)示自建漢字庫(kù)中的個(gè)數(shù),循環(huán)查詢內(nèi)碼
- if ((codeHZ_32[k].Index[0]==c[0])&&(codeHZ_32[k].Index[1]==c[1])){
- for(i=0;i<128;i++) {
- unsigned short m=codeHZ_32[k].Msk[i];
- for(j=0;j<8;j++) {
- if((m&0x80)==0x80) {
- LCD_WR_DATA(dcolor);
- }
- else {
- LCD_WR_DATA(bgcolor);
- }
- m<<=1;
- }
- }
- }
- }
- }
-
- void HZ32(unsigned int x1,unsigned int y1,unsigned char *str,unsigned int dcolor,unsigned int bgcolor)
- { unsigned char l=0;
- while(*str)
- {
- HZ(x1+l*16,y1,(unsigned char*)str,dcolor, bgcolor);
- str+=2;l+=2;
- }
- }
-
復(fù)制代碼 定義好了就可以在主函數(shù)調(diào)用了。
|
-
取摸軟件
-
設(shè)置
-
設(shè)置
-
紅色部分要?jiǎng)h掉
-
定義結(jié)構(gòu)體
-
-
TFT顯示漢字.7z
2019-7-19 17:13 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
223.23 KB, 下載次數(shù): 150, 下載積分: 黑幣 -5
評(píng)分
-
查看全部評(píng)分
|