/*-----初始化LCD------*/
void LCD_Init(void)
{ uchar i=250; //延时
while(i--);
Select_Screen(0);
Set_OnOff(0); //关显示
LCD_Clr(0); //清屏
Select_Screen(0);
Set_OnOff(1); //开显示
Select_Screen(0);
Set_StartLine(0); //开始行:0
}
// 在指定位置显示字符:x=0-120(字母、数字)/0-112(汉字),y=0-6
void Out_Char(uchar x, uchar y, bit mode, char *fmt) //mode: 1 正常显示,0 反白显示
{
int c1,c2,cData;
uchar i=0,j,uLen;
uchar k;
uLen=strlen(fmt);
while(i<uLen)
{
c1 = fmt[i];
c2 = fmt[i+1];
if(c1>=0 && c1<128 )// ASCII
{
if(c1 < 0x20)
{
swi本文来自辣.文,论-文·网原文请找腾讯32491.14tch(c1)
{
case 13:
case 10: // 回车或换行
i++;
//if(y < (LCD_Y_MAX - (2 * HZ_CHR_毕业论文http://www.751com.cn/ HEIGHT)))
if (y<7)
{x=0; y+=2;}
continue;
case 8: // 退格
i++;
if(y>ASC_CHR_WIDTH) y-=ASC_CHR_WIDTH;
cData = 0x00;
break;
}
}
for(j=0;j<sizeof(ASC_16)/sizeof(ASC_16[0]);j++) //sizeof(ASC_16[0]
{
if(fmt[i] == ASC_16[j].Index_Char[0])
break;
}
for(k=0;k<2*ASC_CHR_WIDTH;k++)
{
if(j < sizeof(ASC_16)/sizeof(ASC_16[0]))
{
if (mode == 1)
cData=ASC_16[j].Msk_Char[k]; //正常
else
cData=~ASC_16[j].Msk_Char[k]; //反白
}
else
cData=0;
if (k<ASC_CHR_WIDTH) //字符上半部
{ if ((x+k)<64)
{ Select_Screen(1); //选择左半屏
Set_Column(x+k);
}
else
{ Select_Screen(2); //选择右半屏
Set_Column(x+k-64);
}
Set_Line(y);