|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区
您需要 登录 才可以下载或查看,没有账号?立即注册
×
/*
*函数名:LCD_write_English_string
*描述:写字符串
*输入:横纵坐标,所写字符串
*输出:无
*返回:无
*调用:外部调用
*/
void LCD_write_English_string(unsigned char X,unsigned char Y,char *s)
{
LCD_set_XY(X,Y);
while (*s)
{
LCD_write_char(*s);
s++;
}
}
/*
*函数名:LCD_draw_bmp_pixel
*描述:显示绘图
*输入:横纵坐标,位图
*输出:无
*返回:无
*调用:外部调用
*/
void LCD_draw_bmp_pixel(unsigned char X,unsigned char Y,
unsigned char Pix_x,unsigned char Pix_y)
{
unsigned int i,n;
unsigned char row;
if (Pix_y%8==0) row=Pix_y/8; //计算位图所占行数
else
row=Pix_y/8+1;
for (n=0;n<row;n++)
{
LCD_set_XY(X,Y);
for(i=0; i<ix_x; i++)
{
Nakia5110_LCD_write(Kmap[i+n*Pix_x], 1);
}
Y++; //换行
}
}
/*
*函数名:LCD_write_chinese_string
*描述:写中文字
*输入:横纵坐标,汉字点阵的宽度,显示汉字个数,汉字点阵数组中的起始行,汉字显示的间隔
*输出:无
*返回:无
*调用:外部调用
*/
void LCD_write_chinese_string(unsigned char X, unsigned char Y,
unsigned char ch_with,unsigned char num,
unsigned char line,unsigned char row)
{
unsigned char i,n;
LCD_set_XY(X,Y); //设置初始位置
for (i=0;i<num;)
{
for (n=0; n<ch_with*2; n++) //写一个汉字
{
if (n==ch_with) //写汉字的下半部分
{ if (i==0) LCD_set_XY(X,Y+1);
else
LCD_set_XY((X+(ch_with+row)*i),Y+1);
}
Nakia5110_LCD_write(china_char[line+i][n],1);
}
i++;
LCD_set_XY((X+(ch_with+row)*i),Y);
}
}
/*
*函数名:LCD_move_chinese
*描述:汉字移动
*输入:横纵坐标,延时多少us
*输出:无
*返回:无
*调用:外部调用
*/
void LCD_move_chinese(unsigned char X, unsigned char Y,unsigned char t)
{
unsigned i,n,j=0;
unsigned char buffer_h[84]={0};
unsigned char buffer_l[84]={0};
for(i=0;i<192;i++)
{
buffer_h[83]=china_char_1[i/12][j];
buffer_l[83]=china_char_1[i/12][j+12];
j++;
if(j==12)
j=0;
for(n=0;n<83;n++)
{
buffer_h[n]=buffer_h[n+1];
buffer_l[n]=buffer_l[n+1];
}
LCD_set_XY(X,Y);
for(n=0;n<83;n++)
{
Nakia5110_LCD_write(buffer_h[n],1);
}
LCD_set_XY(X,Y+1);
for(n=0;n<83;n++)
{
Nakia5110_LCD_write(buffer_l[n],1);
}
delay_nus(t);
}
}
/*
*函数名:LCD_Write_Shu_zi
*描述:写数字
*输入:横纵坐标,要写的浮点数
*输出:无
*返回:无
*调用:外部调用
*/
void LCD_Write_Shu_zi(unsigned char X, unsigned char Y,float t)
{
char s[84];
//char *s;
sprintf(s,"%f",t);
LCD_write_English_string(X,Y,s);
} |
|