高手请帮忙 我以前用NIOSII做过一块不带字库的OCM12864的液晶显示正常,现在换了一块JDL12864带字库的液晶模块,显示不出字来了,不知道写数据的时候发什么东西才能把字库里的字调到RAM里来显示,请高手指点一下。现在编译没有错误就是不显示东西,我的程序如下帮看看那里不对?谢谢 LCD12864 驱动程序 #ifndef _LCD12864_H_ #define _LCD12864_H_ #endif //_LCD12864_H_ #define LcdEN *(unsigned int *)PIO_LCD_EN_BASE #define LcdRS *(unsigned int *)PIO_LCD_RS_BASE #define LcdRW *(unsigned int *)PIO_LCD_RW_BASE #define LcdFSB *(unsigned int *)PIO_LCD_FSB_BASE #define DatBus *(unsigned int *)PIO_LCD_DATA_BASE unsigned char yb=0x80; unsigned char hanzi00[]={"回眸一笑百媚生。"}; unsigned char hanzi01[]={"桃花依旧笑春风,"}; unsigned char hanzi02[]={"葡萄美酒夜光杯,"}; unsigned char hanzi03[]={"老槐树茶馆好茶。"}; unsigned char hanzi20[]={"love family "}; unsigned char hanzi21[]={"display program,"}; unsigned char hanzi22[]={"welcome to china"}; unsigned char hanzi23[]={"come on with me "}; //延时子程序 void delay(unsigned int t) { unsigned int i,j; for(i=0;i<t;i++) { for(j=0;j<100;j++); {;} } } //写命令到LCD void write_com(unsigned char cmdcode) { LcdFSB=1; //选择并行 LcdRS=0; LcdRW=0; LcdEN=1; DatBus=cmdcode; LcdEN=0; delay(5); } //写数据到LCD void write_data(unsigned char Dispdata) { LcdFSB=1; LcdRS=1; LcdRW=0; LcdEN=1; DatBus=Dispdata; LcdEN=0; delay(5); } //初始化LCD屏 void lcdinit() { delay(2000); write_com(0x30); //选择基本指令集 delay(10); write_com(0x30); //选择8bit数据流 delay(5); write_com(0x0c); //开显示(无游标,不反白) delay(10); write_com(0x01); //清显示并设地址指针为00H delay(500); write_com(0x06); //指定在资料的读取及写入时设定游标的 //移动方向及指定显示的位移 } void outChinese(unsigned char place,unsigned char unit,unsigned char charcode[] ) { unsigned char i; write_com(place); for(i=0;i<unit*2;i++)//一个汉字为两个字符 {write_data(charcode);} } void outchar(unsigned char place,unsigned char unit,unsigned char charcode[] ) { unsigned char i; write_com(place); for(i=0;i<unit;i++) {write_data(charcode);} } void ydgb(void) { write_com(yb);//显示光标位置 delay(10); yb=yb+0x01; if(yb==0x88){yb=0x90;} if(yb==0x98){yb=0x88;} if(yb==0x90){yb=0x98;} if(yb==0xa0){yb=0x80;} } void display1(void) { ydgb(); outChinese(0x80,8,hanzi00);//第一行:80-87H outChinese(0x90,8,hanzi01);//第二行:90-97H outChinese(0x88,8,hanzi02);//第三行:88-8FH outChinese(0x98,8,hanzi03);//第四行:98-9FH //outchar(0x9f,2,name4); } void display3(void) { ydgb(); outchar(0x80,16,hanzi20); outchar(0x90,16,hanzi21); outchar(0x88,16,hanzi22); outchar(0x98,16,hanzi23); } MAIN主函数 #include "system.h" #include "LCD12864.h" void main() { lcdinit(); //初始化LCD屏 delay(10); while(1) { ydgb(); display1(); //显示文本 delay(50000); write_com(0x01); //清屏 delay(10); ydgb(); display3(); //显示文本 delay(50000); write_com(0x01); //清屏 delay(10); } }
我就想先显示出个汉字来,哪位有这方面的调试过的程序不知道能不能提供一下做个参考,谢谢!! |