微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > 带字库型12864液晶的简单使用

带字库型12864液晶的简单使用

时间:08-04 来源:互联网 点击:

/*=============================================
自定义汉字函数:CGRAM自定义显示字符
地址显示编码
0x400x0000
0x500x0002
0x600x0004
0x700x0006
共可显示四个自定义字符!
显示自定义字符前,先要设定显示的位置,否则会乱码
==============================================*/
void CGRAM()
{
uchar i;
write_LCD_command(0x30);//基本指令操作
write_LCD_command(0x40);//设定CGRAM字符的位置
for(i=0;i16;i++)
{
write_LCD_data(table1[0][i*2]);
write_LCD_data(table1[0][i*2+1]);//送显示数据到CGRAM区中
}
write_LCD_command(0x50);
for(i=0;i16;i++)
{
write_LCD_data(table1[1][i*2]);
write_LCD_data(table1[1][i*2+1]);
}
write_LCD_command(0x60);
for(i=0;i16;i++)
{
write_LCD_data(table1[2][i*2]);
write_LCD_data(table1[2][i*2+1]);
}

write_LCD_command(0x70);
for(i=0;i16;i++)
{
write_LCD_data(table1[3][i*2]);
write_LCD_data(table1[3][i*2+1]);
}


}

void main()
{
//uchar num;
uchar i;
init_LCD();
write_LCD_command(0x01);

CGRAM();
write_LCD_command(0x82);
write_LCD_data(0x00);
write_LCD_data(0x00);//第一个自定义显示字符编码为:0x0000

write_LCD_command(0x83);
write_LCD_data(0x00);
write_LCD_data(0x02);//第一个自定义显示字符编码为:0x0002

write_LCD_command(0x84);
write_LCD_data(0x00);
write_LCD_data(0x04);//第一个自定义显示字符编码为:0x0004

write_LCD_command(0x85);
write_LCD_data(0x00);
write_LCD_data(0x06);//第一个自定义显示字符编码为:0x0006
delay(5000);

write_LCD_command(0x90);

//write_LCD_command(0x00);
for(i=0;i16;i++)
{
write_LCD_data(tab1[i]);
delay(5000);
}
write_LCD_command(0x88);
//write_LCD_command(0x00);
for(i=0;i16;i++)
{
write_LCD_data(tab2[i]);
delay(5000);
}
write_LCD_command(0x98);
//write_LCD_command(0x00);
for(i=0;i16;i++)
{
write_LCD_data(tab3[i]);
delay(5000);
}
while(1);

}

如果觉得我空间里面不够详细可以参看大海橡树的空间:http://hi.baidu.com/echoas(里面写的比较好)

12864图片显示我将在“12864使用方法(二)”中给出.。

感谢大家阅读指教。

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top