久久久国产精品视频袁燕,99re久久精品国产,亚洲欧美日韩国产综合v,天天躁夜夜躁狠狠久久,激情五月婷婷激情五月婷婷

  • 回復(fù)
  • 收藏
  • 點(diǎn)贊
  • 分享
  • 發(fā)新帖

問(wèn)個(gè)1602的顯示問(wèn)題(C語(yǔ)言)

我在做1602顯示的時(shí)候發(fā)現(xiàn):
定位在某一個(gè)位置上顯示字符,但是在第一行第一個(gè)字符會(huì)循環(huán)顯示屏上所有的字符.

初始化程序如下:

void lcd_init(void)
{
LCD_DATA=0;

LCD_DATA=0x38;
delays(5);
LCD_DATA=0x38;
delays(5);
LCD_DATA=0x38;
delays(5);

read_busy();
LCD_DATA=0x38;
lcd_enable();

read_busy();
LCD_DATA=0x08;
lcd_enable();

read_busy();
LCD_DATA=0x01;
lcd_enable();

read_busy();
LCD_DATA=0x06;
lcd_enable();

read_busy();
LCD_DATA=0x0e;
lcd_enable();


}

不知道有沒(méi)有人遇到過(guò)同樣的情況呢,不知道你們是如何解決的呢.
全部回復(fù)(4)
正序查看
倒序查看
2007-08-07 11:49
#include

#define uchar unsigned char

#define LCD_DATA P2
sbit LCD_RS=P0^5;
sbit LCD_RW=P0^6;
sbit LCD_EN=P0^7;

void delays(uchar a)
{
uchar j;
while(--a!=0)
{
for(j=0;j<125;j++);
}
}

void read_busy(void)
{
LCD_DATA=0xff;
LCD_RS=0;
LCD_RW=1;
LCD_EN=0;
delays(1);
LCD_EN=1;

while(LCD_DATA&0x80);

}

void lcd_enable(void)
{
LCD_RS=0;
LCD_RW=0;
LCD_EN=0;
delays(1);
LCD_EN=1;

}

void lcd_init(void)
{
LCD_DATA=0;

LCD_DATA=0x38;
delays(5);
LCD_DATA=0x38;
delays(5);
LCD_DATA=0x38;
delays(5);

read_busy();
LCD_DATA=0x38;
lcd_enable();

read_busy();
LCD_DATA=0x08;
lcd_enable();

read_busy();
LCD_DATA=0x01;
lcd_enable();

read_busy();
LCD_DATA=0x06;
lcd_enable();

read_busy();
LCD_DATA=0x0f;
lcd_enable();


}

void  dis_one_char(uchar y,uchar x,uchar char_data)
{
y&=0x01;
x&=0x0f;

if(y)
{
x|=0x40;
}

x|=0x80;
LCD_DATA=x;
lcd_enable();

read_busy();
LCD_DATA=char_data;
LCD_RS=1;
LCD_RW=0;
LCD_EN=0;
delays(1);
LCD_EN=1;


}


void main(void)
{
                uchar i;
for(i=0;i<125;i++)
{
delays(5);
}

lcd_init();
delays(5);
while(1)
{



dis_one_char(0,3,'A');
dis_one_char(1,5,'B');
dis_one_char(0,8,'C');
dis_one_char(1,12,'D');


// while(1);

}


}
0
回復(fù)
2007-08-07 20:41
問(wèn)題解決啦.
原來(lái)只在寫(xiě)數(shù)據(jù)前檢查忙,
沒(méi)有在寫(xiě)地址命令前檢查忙.
在寫(xiě)地址前加一條語(yǔ)句問(wèn)題就解決啦.
0
回復(fù)
rex53
LV.1
4
2007-10-20 17:47
還有一種情況,就是重復(fù)調(diào)用了顯示,只要你不對(duì)lcd光標(biāo)重新定位他就會(huì)按初始化的方向滾動(dòng)顯示,也就是上面提到的循環(huán)顯示.
0
回復(fù)
ahai0306
LV.4
5
2007-10-26 12:57
@water1120211
問(wèn)題解決啦.原來(lái)只在寫(xiě)數(shù)據(jù)前檢查忙,沒(méi)有在寫(xiě)地址命令前檢查忙.在寫(xiě)地址前加一條語(yǔ)句問(wèn)題就解決啦.
沒(méi)有這么麻煩的,液晶程序很簡(jiǎn)單
0
回復(fù)
發(fā)