带字库型12864液晶的简单使用
/*=============================================
自定义汉字函数: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使用方法(二)”中给出.。
感谢大家阅读指教。
- PIC单片机驱动LCD12864液晶显示闪动字体程序(12-02)
- 51单片机+lcd12864液晶屏菜单程序(11-30)
- 单片机+lcd12864液晶万年历C程序(11-30)
- 51单片机驱动ds1302程序(12864液晶显示)(11-30)
- 51单片机控制LCD12864液晶屏显示图形菜单(11-30)
- 12864液晶显示串行程序(英飞凌xc824)(11-30)