標題: lcd1602不顯示?(已解決:vee接地才顯示) [打印本頁]

作者: zhy123654    時間: 2019-11-6 10:45
標題: lcd1602不顯示?(已解決:vee接地才顯示)
為什么這個程序在proteus中可以顯示,下載到單片機后就不能顯示,大家看下怎么回事


#include<stc52.h>
# define uchar unsigned char
sbit RS=P3^5;
sbit RW=P3^6;
sbit E=P3^7;
void Delay5ms();
void write_com(uchar com);
void write_dat(uchar dat);
void init_lcd(void);
uchar x;

uchar code st1[]="   stady-hard";
uchar code st2[]="  ************";
void main()
{
        init_lcd();        
        while(1)
        {
                for(x=0;x<13;x++)
                {                 
                 write_dat(st1[x]);
                }
                write_com(0xc0);
                for(x=0;x<14;x++)
                {                 
                 write_dat(st2[x]);
                }
                while(1);
        }
}

void init_lcd(void)
{
                write_com(0x38);                //éèÖÃÏÔê¾μãÕó
                write_com(0x08);        
                write_com(0x01);
                write_com(0x06);                //1a±ê1éλ
                write_com(0x0f);                //¿aÏÔê¾1a±êéᣬ0x0c,ÎT1a±ê
}

void write_com(uchar com)
{
                RS=0;
                RW=0;
                E=0;
                P2=com;        
                E=1;
                Delay5ms();
                E=0;
}

void write_dat(uchar dat)
{
                RS=1;
                RW=0;
                E=0;
                P2=dat;        
                E=1;
                Delay5ms();
                E=0;
}
void Delay5ms()                //@11.0592MHz
{
        unsigned char i, j;

        i = 9;
        j = 244;
        do
        {
                while (--j);
        } while (--i);
}








作者: 麗山小旋風    時間: 2019-11-6 11:11
檢查單片機電路有沒有問題
作者: zhy123654    時間: 2019-11-6 12:02
找到了,不知道什么鬼,VEE接地才顯示
作者: wj_yuq    時間: 2019-11-6 12:16
proteus仿真必定不是真
作者: 47okey    時間: 2019-11-6 21:01
zhy123654 發(fā)表于 2019-11-6 12:02
找到了,不知道什么鬼,VEE接地才顯示

不是鬼,本來就是。接地對比度最高。一般這里接一電位器。
另外,還是不要太相鄰和依賴proteus了
作者: hhdsdy    時間: 2019-11-6 22:01
zhy123654 發(fā)表于 2019-11-6 12:02
找到了,不知道什么鬼,VEE接地才顯示

你那是對比度調節(jié)腳,大家都是接一個微調電阻進行調節(jié)的,你自己搞錯了還抱怨什么。
作者: zhy123654    時間: 2019-11-8 07:48
47okey 發(fā)表于 2019-11-6 21:01
不是鬼,本來就是。接地對比度最高。一般這里接一電位器。
另外,還是不要太相鄰和依賴proteus了

資料上不是說用一個10k的滑動變阻器接到Vcc上嗎?
作者: 李東輝    時間: 2023-5-11 20:13
兄弟,你的vee電壓和vdd電壓幾乎一樣大,沒有對比所以顯示不出來,你那個1k的電阻的作用是限流,不是降壓,它沒有分壓......




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1