|
很久以前買了兩片市面上通用的LCD1620(80*36),寫的程序仿真和上機(jī)都能正常顯示。前幾天發(fā)現(xiàn)有大號(hào)的1620B(122*44)特價(jià)處理,淘了5片回來,焊插針試了兩片都沒顯示,只是亮背光。
看了賣家說明,原來的和新買的除了尺寸不同,引腳定義和排列都一模一樣。沒辦法問了賣家要資料看,是不是時(shí)序不同,但也沒發(fā)現(xiàn)什么問題。
哪位高手幫看看說明書哪里有不同,程序要怎么寫。
附件上仿真和單片機(jī)C文件以及說明書- #include<reg52.h>//滾動(dòng)顯示
- typedef unsigned char uint8;
- typedef unsigned int uint16;
- sbit rs=P2^6;
- sbit rw=P2^5;
- sbit e=P2^7;
- uint8 a[16]="perchin designed";
- uint8 b[27]="welcome to the world of mcu";
- void delay(uint16 i) //1us
- {
- while(i--);
- }
- void wrc(uint8 c)
- {
- rs=0;
- rw=0;
- P0=c;
- e=1;
- delay(10);
- e=0;
- }
- void wrd(uint8 dat)
- {
- rs=1;
- rw=0;
- P0=dat;
- e=1;
- delay(10);
- e=0;
- }
- void init()
- {
- wrc(0x38);
- wrc(0x38);
- wrc(0x38);
- wrc(0x0c);
- wrc(0x01);
- }
- void display()
- {
- uint8 i;
- wrc(0x00+0x80);
- for(i=0;i<16;i++)
- {
- wrd(a[i]);
- }
- wrc(0x40+0x80);
- for(i=0;i<27;i++)
- {
- wrd(b[i]);
- }
- wrc(0x07); //每寫一個(gè)數(shù)據(jù)屏幕就要右移一位,就相對(duì)于數(shù)據(jù)來說就是左移了;
- while(1)
- {
- wrc(0x00+0x80);
- for(i=0;i<16;i++)
- {
- wrd(a[i]);
- delay(30000); //如果不加這條延時(shí)語句的話滾動(dòng)會(huì)非常快。
- }
- }
- }
- void main()
- {
- init();
- while(1)
- {
- display();
- }
- }
復(fù)制代碼
|
|