TR803Word文档格式.docx

上传人:b****3 文档编号:16581095 上传时间:2022-11-24 格式:DOCX 页数:13 大小:24.16KB
下载 相关 举报
TR803Word文档格式.docx_第1页
第1页 / 共13页
TR803Word文档格式.docx_第2页
第2页 / 共13页
TR803Word文档格式.docx_第3页
第3页 / 共13页
TR803Word文档格式.docx_第4页
第4页 / 共13页
TR803Word文档格式.docx_第5页
第5页 / 共13页
点击查看更多>>
下载资源
资源描述

TR803Word文档格式.docx

《TR803Word文档格式.docx》由会员分享,可在线阅读,更多相关《TR803Word文档格式.docx(13页珍藏版)》请在冰豆网上搜索。

TR803Word文档格式.docx

structword_BUFFERword_buf[33];

//定义结构体数组用来存储待显示的汉字 共32个

ucharbank=0;

//设置第几行反显0表示不反显1~4表示各行的反显

ucharkey=0;

//第几个键被按下

sbitDI=P2^0;

//数据\指令选择

sbitRW=P2^1;

//读\写选择

sbitE=P2^2;

//读\写使能

sbitCS2=P0^1;

//片选1

sbitCS1=P0^0;

//片选2

sbitRST=P3^2;

//复位

//------------------汉字字模的数据结构定义------------------------//

typedefstructtypFNT_GB16//汉字字模数据结构

{

signedcharIndex[2];

//汉字内码索引

charMsk[32];

//点阵码数据

};

structtypFNT_GB16codeGB_16[]=//数据表

"

"

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,0x70,0x92,0xAC,0xA8,

0xF8,0xAC,0x8A,0x69,0x18,0x00,0x00,0x00,

0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,

0x7F,0x02,0x02,0x02,0x02,0x02,0x02,0x00,

片"

0x00,0x00,0x00,0x00,0x00,0xFE,0x20,0x20,

0x20,0xA0,0x9F,0x10,0x10,0x00,0x00,0x00,

0x00,0x00,0x20,0x10,0x0C,0x03,0x01,0x01,

0x01,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,

机"

0x00,0x00,0x20,0x20,0xFF,0x90,0x10,0x00,

0x00,0xF0,0x08,0xE8,0x18,0x00,0x00,0x00,

0x00,0x04,0x02,0x01,0x3F,0x00,0x11,0x08,

0x06,0x01,0x00,0x07,0x08,0x08,0x08,0x0E,

液"

0x00,0x00,0x20,0x64,0x0C,0x00,0x90,0x70,

0x10,0x89,0x6A,0x48,0xC8,0x00,0x00,0x00,

0x00,0x00,0x18,0x07,0x02,0x01,0x3F,0x10,

0x11,0x0A,0x05,0x0A,0x19,0x10,0x10,0x10,

晶"

0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x2A,

0x29,0x21,0xBF,0x80,0x80,0x80,0x00,0x00,

0x00,0x00,0x00,0x3F,0x15,0x11,0x3F,0x00,

0x00,0x3F,0x14,0x14,0x10,0x3F,0x00,0x00,

显"

0x00,0x00,0x00,0x00,0x0C,0x74,0xD4,0x54,

0x2A,0xAA,0x22,0x1E,0x80,0x00,0x00,0x00,

0x00,0x20,0x20,0x22,0x24,0x20,0x1F,0x10,

0x10,0x1F,0x14,0x12,0x11,0x10,0x10,0x00,

示"

0x00,0x00,0x40,0x40,0x40,0x44,0x44,0x44,

0xC4,0x24,0x22,0x22,0x20,0x20,0x20,0x00,

0x00,0x00,0x00,0x0C,0x07,0x00,0x00,0x10,

0x3F,0x00,0x00,0x01,0x02,0x06,0x00,0x00,

武"

0x00,0x00,0x00,0x40,0x50,0x50,0xC8,0x28,

0x20,0xFF,0x10,0x12,0x14,0x00,0x00,0x00,

0x00,0x00,0x20,0x20,0x1F,0x10,0x0F,0x09,

0x09,0x00,0x03,0x0C,0x10,0x20,0x40,0x78,

汉"

0x00,0x20,0x40,0x02,0x84,0x00,0x28,0x48,

0x88,0x04,0xE4,0x1C,0x00,0x00,0x00,0x00,

0x00,0x00,0x18,0x06,0x09,0x08,0x04,0x04,

0x02,0x01,0x02,0x04,0x0C,0x08,0x08,0x00,

理"

0x00,0x00,0x88,0x88,0xF8,0x44,0x00,0x1C,

0xE4,0xA4,0xFC,0x52,0x42,0x7E,0x00,0x00,

0x00,0x08,0x08,0x04,0x07,0x12,0x12,0x10,

0x12,0x12,0x0F,0x09,0x09,0x08,0x08,0x00,

工"

0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x10,

0xF0,0x08,0x08,0x08,0x00,0x00,0x00,0x00,

0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,

0x07,0x04,0x04,0x04,0x04,0x04,0x04,0x00,

大"

0x00,0x00,0x00,0x40,0x40,0x40,0x40,0xFF,

0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,

0x00,0x00,0x20,0x10,0x08,0x04,0x03,0x00,

0x01,0x02,0x04,0x08,0x10,0x30,0x20,0x20,

学"

0x00,0x00,0xC0,0x70,0x22,0x24,0xA0,0x52,

0x54,0xD0,0x58,0x17,0x10,0x30,0x10,0x00,

0x00,0x00,0x04,0x04,0x04,0x04,0x04,0x24,

0x43,0x3E,0x02,0x02,0x02,0x02,0x00,0x00,

余"

0x00,0x00,0x80,0x40,0x20,0x50,0x4C,0xC3,

0x24,0x28,0x10,0x20,0x60,0x40,0x40,0x40,

0x00,0x01,0x00,0x22,0x1A,0x02,0x22,0x7F,

0x01,0x01,0x05,0x09,0x10,0x00,0x00,0x00,

区"

0x00,0x00,0x00,0x04,0xFC,0x04,0x04,0x24,

0x44,0x82,0x42,0x3A,0x02,0x02,0x00,0x00,

0x00,0x00,0x00,0x00,0x3F,0x20,0x14,0x12,

0x11,0x10,0x11,0x12,0x14,0x10,0x00,0x00,

熊"

0x00,0x00,0x00,0x10,0xD8,0xB4,0x2B,0xEC,

0x00,0x0F,0xD4,0x14,0x92,0x18,0x00,0x00,

0x00,0x00,0x20,0x30,0x07,0x02,0x14,0x27,

0x00,0x10,0x23,0x05,0x04,0x14,0x23,0x00,

涛"

0x00,0x10,0x20,0x82,0x0C,0x40,0x40,0xD4,

0x74,0x5F,0x2A,0xAA,0x22,0x20,0x00,0x00,

0x00,0x08,0x0C,0x23,0x10,0x08,0x06,0x03,

0x06,0x2A,0x42,0x3F,0x01,0x01,0x01,0x00,

制"

0x00,0x00,0x80,0xA0,0x98,0x90,0xFE,0x48,

0x48,0x40,0x00,0xF0,0x00,0xFE,0x00,0x00,

0x00,0x00,0x00,0x0E,0x02,0x02,0x3F,0x09,

0x0F,0x00,0x00,0x03,0x10,0x3F,0x00,0x00,

作"

0x00,0x80,0x40,0x20,0xF0,0x0E,0x80,0x40,

0x30,0x1C,0xF3,0x90,0x88,0x88,0x08,0x00,

0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x00,

0x00,0x00,0x7F,0x04,0x04,0x04,0x00,0x00,

悠"

0x00,0x80,0x40,0x20,0xF8,0x06,0xF0,0x10,

0x88,0x57,0x24,0x5C,0x84,0x84,0x80,0x00,

0x00,0x00,0x10,0x0C,0x01,0x04,0x08,0x11,

0x22,0x24,0x20,0x28,0x30,0x22,0x04,0x00,

苍"

0x00,0x00,0x08,0x08,0x08,0x85,0x4F,0x34,

0x14,0x24,0x4F,0x84,0x84,0x04,0x00,0x00,

0x00,0x04,0x04,0x02,0x01,0x00,0x3E,0x41,

0x41,0x49,0x47,0x40,0x39,0x01,0x01,0x01,

天"

0x00,0x00,0x00,0x40,0x44,0x44,0x44,0xFC,

0x22,0x22,0x22,0x20,0x00,0x00,0x00,0x00,

0x00,0x20,0x20,0x10,0x08,0x04,0x03,0x00,

/*"

奈"

0x00,0x00,0x00,0x08,0x88,0x48,0xB8,0x8F,

0x48,0x54,0x24,0x44,0x84,0x80,0x00,0x00,

0x00,0x02,0x02,0x21,0x1A,0x02,0x02,0x22,

0x7E,0x01,0x09,0x11,0x00,0x01,0x01,0x01,

//"

何"

0x00,0x80,0x40,0x20,0xF8,0x06,0x10,0xD0,

0x50,0x50,0xC8,0x08,0xF8,0x08,0x08,0x08,

0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x03,

0x02,0x01,0x01,0x20,0x3F,0x00,0x00,0x00,*/

独"

0x00,0x00,0x44,0x28,0x90,0xE8,0x06,0x60,

0xA0,0x20,0xFE,0x90,0x90,0xF0,0x00,0x00,

0x00,0x04,0x02,0x09,0x10,0x0F,0x00,0x10,

0x11,0x11,0x0F,0x08,0x08,0x0C,0x18,0x00,

立"

0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x22,

0x24,0x20,0xA0,0x20,0x00,0x00,0x00,0x00,

0x00,0x10,0x10,0x10,0x10,0x11,0x16,0x10,

0x08,0x0E,0x09,0x08,0x08,0x08,0x08,0x00,

茫"

0x00,0x00,0x80,0x08,0x28,0x48,0x1E,0x08,

0x04,0x24,0x5F,0x84,0x84,0x84,0x04,0x00,

0x00,0x00,0x00,0x31,0x18,0x06,0x00,0x01,

0x3F,0x21,0x21,0x10,0x10,0x10,0x00,0x00

keych(void)//检测是否有键按下子程序//

{uintn;

if(P2==0xf0)return(0);

elsewhile(P2&

0xf0!

=0xf0)for(n=0;

n<

60000;

n++);

return

(1);

}

keyscan()//检测是哪个键按下子程序//

{ucharm,n;

ucharcodek[4]={0xfe,0xfd,0xfb,0xf7};

for(m=0;

m<

4;

m++)

{P2=k[m];

n=P2+(m*m+5)*m/6;

//此处要注意m为整型

switch(n)

{case0x7e:

key=0+m*4;

break;

case0xbe:

key=1+m*4;

case0xde:

key=2+m*4;

case0xee:

key=3+m*4;

}}

/**********************************************\

|*写命令子程序*|

|*入口参数:

cmd控制命令数据*|

|*出口参数:

null*|

|*调用函数:

null*|

\**********************************************/

voidwrite_cmd(ucharcmd)//写命令子程序

{RW=0;

DI=0;

//DI=0写命令

E=1;

P1=cmd;

E=0;

//RW="

L"

E="

H->

DB7~DB0的数据被写到IR或DR

}

|*写数据子程序*|

dat显示字符的数据*|

|*oppo标志位1:

显示阳文*|

|*0:

显示阴文*|

voidwrite_dat(uchardat,bitoppo)//写数据子程序

DI=1;

//DI=1写数据

if(oppo==0)P1=~dat;

//按位取反得阴文

if(oppo==1)P1=dat;

oppo=1;

|*设置显示起始行X地址和Y地址*|

st_line显示起始行0~63*|

|*x_add页地址8行为一页0~7*|

|*y_addY地址0~128*|

write_cmd()*|

voidset_dis(ucharst_line,ucharx_add,uchary_add)//设置显示起始行X地址和Y地址

write_cmd(st_line+0xc0);

//+0xc0是参照设置起始行的格式

write_cmd(x_add+0xb8);

//+0xb8是参照设置页地址的格式

if(y_add<

64){CS1=0;

CS2=1;

write_cmd(y_add+0x40);

}//Y_add地址实际上只有0~63采用CS1和CS2选左右半屏

else{CS1=1;

CS2=0;

write_cmd(y_add);

 

/***********************************************\

|*写汉字子程序1可以在任意位置写入*|

|*Index[2]字符串数组用来存储汉字*|

write_cmd()set_dis()*|

|*strcmp()write_dat()*|

\***********************************************/

voidwrite_word_all(ucharst_line,ucharx_add,uchary_add,ucharIndex[2])//写入汉字

{uchari,j;

bitoppo=1;

set_dis(st_line,x_add,y_add);

if(bank%5==0)oppo=1;

if(bank%5==1&

&

(x_add==0||x_add==1))oppo=0;

if(bank%5==2&

(x_add==2||x_add==3))oppo=0;

if(bank%5==3&

(x_add==4||x_add==5))oppo=0;

if(bank%5==4&

(x_add==6||x_add==7))oppo=0;

for(i=0;

i<

255;

i++)

{if(GB_16[i].Index[0]==Index[0]&

GB_16[i].Index[1]==Index[1])//汉字作为双字节字符串处理采用顺序检索方式查找结构体名

{for(j=0;

j<

16;

j++)write_dat(GB_16[i].Msk[j],oppo);

//逐字节写入

set_dis(st_line,x_add+1,y_add);

//下一页写字的下半部分

for(j=16;

32;

}//此处用break是为了能跳出for循环

}

|*写汉字子程序2只能在指定位置写入*|

n指定地址0~31全屏32字(16*16)*|

write_word_all()*|

|**|

voidwrite_word(ucharn,ucharIndex[2])//写入汉字

{ucharst_line=0,x_add=n%32/8*2,y_add=n%32%8*16;

write_word_all(st_line,x_add,y_add,Index);

}

|*写句子子程序*|

sentence[]待写入汉字组成字符串*|

|*按照0~31的顺序写入*|

strlen()write_word()*|

voidwrite_sentence(ucharsentence[255])

{

uchari,j=0;

if(keych()==1)

{keyscan();

if(key==0)bank++;

if(key==1)bank--;

strlen(sentence)/2;

{word_buf[i].word[0]=sentence[i*2];

word_buf[i].word[1]=sentence[i*2+1];

//从sentence中两个两个的取字符串即汉字注意不要弄半角的字符或标点符号,否则后面的汉字将找不到

write_word(j++,word_buf[i].word);

/*voidScrolling(ucharsentence[255])//滚动显示子程序

{uchari,j=0;

intk=2000;

=i;

j++)

write_word(i,word_buf[i].word);

;

}}}*/

|*初始化子

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 小学教育 > 其它课程

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1