12864汉字显示和图片显示
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
#include
const unsigned char pic2[]=
{
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,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x03,0xFF,0xFF,0xFA,0xD6,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,
0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xC0,0x00,
0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,
0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,
0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,
0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00,
0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFC,0x00,0x00,
0x00,0x01,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,
0x00,0x00,0x1F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,
0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x03,0xFF,0x80,0x00,0x00,0x20,0x00,0x00,0x00,
0x00,0x00,0x00,0x08,0x1F,0xFF,0xFF,0xFE,0x00,0x7F,0x00,0x00,0x20,0x00,0x00,0x00,
0x00,0x00,0x00,0x0B,0xF0,0x00,0x00,0x00,0x00,0x00,0xFF,0xF8,0x20,0x00,0x00,0x00,
0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xF8,0x00,0x00,0x00,
0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x08,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x08,0x00,0x33,0x80,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x08,0x00,0x20,0x80,0x00,0x00,0x00,0x7E,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x08,0x00,0x40,0xC0,0x00,0x00,0x00,0xC3,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x08,0x00,0x40,0x40,0x00,0x00,0x00,0x81,0x80,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x10,0x00,0x40,0x80,0x00,0x00,0x00,0x80,0x80,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x10,0x00,0x61,0x80,0x00,0x00,0x00,0x81,0x80,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x30,0x00,0x3B,0x00,0x00,0x00,0x00,0xFF,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x20,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x
00,
0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x40,0x00,0x00,0x00,0xC0,0xE0,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x40,0x00,0x00,0x00,0xFF,0xA0,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x60,0x00,0x00,0x00,0xFF,0xE0,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,
0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,
0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,
0x00,0x00,0x00,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xF8,0x00,0x06,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x00,0x07,0xFF,0xFC,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x07,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x03,0xF8,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
unsigned char IC_DAT[]={
"人定胜天我们很好"
"一点襯阆蜃笠贫 "
"一点襴点向左移动"
"一点ou点向左移动"
};
void initinal(void) //LCD字库初始化程序
{write_data(0x01,0); //Display Clear
delay_us(10);
//write_data(0x30,0); //Extended Function Set :8BIT设置,RE=0: basic instruction set, G=0 :graphic display OFF
//delay_us(100); //大于100uS的延时程序
write_data(0x30,0); //Function Set
delay_us(37); ////大于37uS的延时程序
write_data(0x
08,0); //Display on Control
delay_us(100); //大于100uS的延时程序
write_data(0x10,0); //Cursor Display Control光标设置
delay_us(100); //大于100uS的延时程序
write_data(0x0C,0); //Display Control,D=1,显示开
delay_us(100); //大于100uS的延时程序
//大于10mS的延时程序
write_data(0x06,0); //Enry Mode Set,光标从右向左加1位移动
delay_us(100); //大于100uS的延时程序
}
/* 液晶初始化-图形 */
/******************************************************************/
void initina2(void) //LCD显示图片(扩展)初始化程序
{
write_data(0x01,0); //Display Clear
delay_us(10);
write_data(0x36,0); //Extended Function Set RE=1: extended instruction
delay_us(100); //大于100uS的延时程序
write_data(0x36,0); //Extended Function Set RE=1: extended instruction
delay_us(100); //大于100uS的延时程序
write_data(0x3e,0); //EXFUNCTION(DL=8BITS,RE=1,G=1)
delay_us(100); //大于100uS的延时程序
write_data(0x01,0); //CLEAR SCREEN
delay_us(100); //大于100uS的延时程序
}
///////////图画显示函数/////////////
void DisplayGraphic(void)
{
unsigned char adder=0;
int i,j;
//*******显示上半屏内容设置
for(i=0;i<32;i++) //
{
write_data((0x80 + i),0); //SET 垂直地址 VERTICAL ADD
write_data(0x80,0); //SET 水平地址 HORIZONTAL ADD
for(j=0;j<16;j++)
{
write_data(pic2[adder],1);
adder++;
}
}
//*******显示下半屏内容设置
for(i=0;i<32;i++) //
{
write_data((0x80 + i),0); //SET 垂直地址 VERTICAL ADD
write_data(0x88,0); //SET 水平地址 HORIZONTAL ADD
for(j=0;j<16;j++)
{
write_data(pic2[adder],1);
adder++;
}
}
}
/////////汉字显示函数/////////////
void lcd_mesg(unsigned char *adder1)
{
unsigned char i;
write_data(0x80,0); //Set Graphic Display RAM Address
delay_us(100);
for(i=0;i<32;i++)
{
write_data(*adder1,1);
adder1++;
}
write_data(0x90,0); //Set Graphic Display RAM Address
delay_us(100);
for(i=0;i<32;i++)
{
write_data(*adder1,1);
adder1++;
}
}
void main(void)
{ unsigned char b,m,q;
delay_ms(500);
init_lcd();//液晶初始化
initinal();
write_data(0x01,0); //Display Clear
delay_us(10); //调用LCD字库初始化程序
delay_us(100); //大于100uS的延时程序
lcd_mesg(IC_DAT); //显示
中文汉字1
delay_ms(2000);
initina2(); //调用LCD显示图片(扩展)初始化程序
DisplayGraphic(); //显示图片2
delay_ms(200);
while(1);
}