请问我的proteus仿真时,电路图和程序如下,为何LCD只亮却没有内容? 30
请问我的proteus仿真时,电路图和程序如下,为何LCD只亮却没有内容?ucharcodetab1[]={"20--"};ucharcodetab2[]={"::"};...
请问我的proteus仿真时,电路图和程序如下,为何LCD只亮却没有内容?uchar code tab1[]={"20 - - "};
uchar code tab2[]={" : : "};
void delay(uint xms)
{
uint x,y;
for(x=xms;x>0;x--)
for(y=120;y>0;y--);
}
void write_1602com(uchar com)
{
rs=0;
rw=0;
P0=com;
delay(1);
en=1;
delay(1);
en=0;
}
void write_1602dat(uchar dat)
{
rs=1;
rw=0;
P0=dat;
delay(1);
en=1;
delay(1);
en=0;
}
void lcd_init()
{
write_1602com(0x38);
write_1602com(0x0c);
write_1602com(0x06);
write_1602com(0x01);
write_1602com(yh+1);
for(a=0;a<14;a++)
{
write_1602dat(tab1[a]);
//delay(3);
}
write_1602com(er+2);
for(a=0;a<8;a++)
{
write_1602dat(tab2[a]);
//delay(3);
}
}
void write_byte(uchar dat)
{
ACC=dat;
RST=1;
for(a=8;a>0;a--)
{
IO=ACC0;
SCLK=0;
SCLK=1;
ACC=ACC>>1;
}
}
uchar read_byte()
{
RST=1;
for(a=8;a>0;a--)
{
ACC7=IO;
SCLK=1;
SCLK=0;
ACC=ACC>>1;
}
return (ACC);
} 展开
uchar code tab2[]={" : : "};
void delay(uint xms)
{
uint x,y;
for(x=xms;x>0;x--)
for(y=120;y>0;y--);
}
void write_1602com(uchar com)
{
rs=0;
rw=0;
P0=com;
delay(1);
en=1;
delay(1);
en=0;
}
void write_1602dat(uchar dat)
{
rs=1;
rw=0;
P0=dat;
delay(1);
en=1;
delay(1);
en=0;
}
void lcd_init()
{
write_1602com(0x38);
write_1602com(0x0c);
write_1602com(0x06);
write_1602com(0x01);
write_1602com(yh+1);
for(a=0;a<14;a++)
{
write_1602dat(tab1[a]);
//delay(3);
}
write_1602com(er+2);
for(a=0;a<8;a++)
{
write_1602dat(tab2[a]);
//delay(3);
}
}
void write_byte(uchar dat)
{
ACC=dat;
RST=1;
for(a=8;a>0;a--)
{
IO=ACC0;
SCLK=0;
SCLK=1;
ACC=ACC>>1;
}
}
uchar read_byte()
{
RST=1;
for(a=8;a>0;a--)
{
ACC7=IO;
SCLK=1;
SCLK=0;
ACC=ACC>>1;
}
return (ACC);
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询