完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我的大神们啊,谁帮小弟看看这个调试程序是那里有问题啊,我调试了半天都是显示白屏!在此不胜感激啊,亲!#include
#include #define uchar unsigned char #define uint unsigned int #define LCD_databus P0 uchar num; ***it RS=P2^2; ***it RW=P2^1; ***it EN=P2^0; ***it CS1=P2^4; ***it CS2=P2^3; // // //////////////////////////////////////////// unsigned char code huan[] = // 数据表 { 0x00,0x40,0xE0,0xA0,0xE0,0xE0,0xE0,0xE0,0xFE,0xFE,0xE4,0xE0,0x60,0x60,0x00,0x00, 0x20,0x30,0x39,0x1F,0x07,0x6F,0x7C,0x3C,0x1F,0x0F,0x3C,0x38,0x70,0x60,0x40,0x40, }; void delay(uint i) { while(--i); } // void Read_busy() { P0=0x00; RS=0; RW=1; EN=1; while(P0&0x80); EN=0; } // // void write_LCD_command(uchar value) { RS=0; RW=0; LCD_databus=value; EN=1; delay(10); EN=0;//EN下降沿锁存数据 } // // void write_LCD_data(uchar value) { RS=1; RW=0; LCD_databus=value; EN=1; delay(10); EN=0; } // // void Set_page(uchar page) { page=0xb8/page; write_LCD_command(page); } void Set_line(uchar startline) { startline=0xc0/startline; write_LCD_command(startline); } // void Set_column(uchar column) { column=0x3f&column; column=0x40/column; write_LCD_command(column); } // // void SetOnOff(uchar onoff) { onoff=0x3e/onoff; write_LCD_command(onoff); } // // void SelectScreen(uchar screen) { switch(screen) { case 0:CS1=0;CS2=0;break; case 1:CS1=0;CS2=1;break; case 2:CS1=1;CS2=0;break; default:break; } } // // void ClearScreen(uchar screen) { uchar i,j; SelectScreen(screen); for(i=0;i<8;i++) { Set_page(i); Set_column(0); for(j=0;j<64;j++) { write_LCD_data(0x00); }//写完后地址自动加1; } } // // void InitLCD() { Read_busy(); SelectScreen(0); SetOnOff(0); SelectScreen(0); SetOnOff(1); SelectScreen(0); ClearScreen(0); Set_line(0); } // // /////////////////////////////////// void Display(uchar ss,uchar page,uchar column,uchar *p) { uchar i; SelectScreen(ss); Set_page(page); Set_column(column); for(i=0;i<16;i++) { write_LCD_data(p[i]); } Set_page(page+1); Set_column(column); for(i=0;i<16;i++) { write_LCD_data(p[i+16]); } } // // /////////////////////////////////// void main() { InitLCD(); ClearScreen(0); Set_line(0); Display(0,0,2*16,huan); } /// ///
|
|
相关推荐
2 个讨论
|
|
呵呵,终于找到原因了啊,我去,/写错了,晕!
|
|
|
|
|
|
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-16 20:14 , Processed in 0.621265 second(s), Total 53, Slave 39 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号