这是我的1602的原理图。下面是我的程序。
unsigned char table[]="I Love MCU!";
unsigned char table1[]="I Love Renesas too!";
void delay(unsigned int x)
{
unsigned int i,j;
for(i=x;i>0;i--)
for(j=320;j>0;j--);
}
void write_com(unsigned char com)
{
P2=com;
delay(100);
P7_bit.no0= 0;
delay(100);
P7_bit.no1= 0;
delay(100);
P7_bit.no2=1;
delay(100);
P7_bit.no2=0;
delay(100);
}
void write_data(unsigned char data)
{
P2=data;
delay(100);
P7_bit.no0= 0;
delay(100);
P7_bit.no1= 0;
delay(100);
P7_bit.no2=1;
delay(100);
P7_bit.no2=0;
delay(100);
}
void init()
{
write_com(0x38);
write_com(0x0c);
write_com(0x06);
write_com(0x01);
delay(100);
}
void main(void)
{
/* Start user code. Do not edit comment generated here */
init();
while (1U)
{
unsigned char num;
write_com(0x80+0x10);
for(num=0;num<11;num++)
{
write_data(table[num]);
delay(100);
}
write_com(0x80+0x50);
for(num=0;num<19;num++)
{
write_data(table1[num]);
delay(100);
}
for(num=0;num<16;num++)
{
write_com(0x18);
delay(2000);
}
}
/* End user code. Do not edit comment generated here */
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
大家帮我看看为什么液晶老是不显示类?