直接在单片机的P2 口上给一个数据然后让其在LCD1602上显示,却没有反映。可能的问题?

来源:百度知道 编辑:UC知道 时间:2024/05/28 17:11:15
程序为 #include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit LCDRS=P3^1;
sbit LCBE=P3^3;
sbit ALE=P1^3;
sbit USBxz=P1^1;
// uchar table1[]="TX-1B MCU";
// uchar table2[]="www.TXMCU.COM";
void delay(uint x)
{
uint a,b;
for(a=x;a>0;a--)
for(b=10;b>0;b--);
}

//void delay1(uint x)
//{
// uint a,b;
// for(a=x;a>0;a--)
// for(b=100;b>0;b--);
//}

void write_com(uchar com)
{
P2=com;
LCDRS=0;
LCBE=0;
delay(10);
LCBE=1;
delay(10);
LCBE=0;

}

void write_date(uchar date)
{
P2=date;
LCDRS=1;
LCBE=0;
delay(10);
LCBE=1;
delay(10);
LCBE=0;

}

void init()
{

write_com(0x38);
delay(50);

加我邮箱,sunzem@163.com
我已经做出来了

哈哈,,,,,一看就知道你用 天祥的板,,你液晶背光亮了吗??????

RW端你接地了吗?????那试一试 加长延时delay(20);