我这个程序有什么问题吗?为什么下载后显示不正常啊,求大神解答
#include<reg51.h>
#define GPIO_LCD P0
sbit RS=P2^6;
sbit RW=P2^5;
sbit LCDE=P2^7;
void delay10ms(void);
void lcdwritecmd(unsigned char com);
void lcdwritedat(unsigned char dat);
void lcdinit();
unsigned char code data8[16]="hello world";
void main()
{
unsigned char i;
lcdinit();
while(1)
{
lcdwritecmd(0x80);
for(i=0;i<16;i++)
{
lcdwritedat(data8[i]);
}
}
}
void lcdwritecmd(unsigned char com)
{
LCDE=0;
RS=0;
RW=0;
GPIO_LCD=com;
delay10ms();
LCDE=1;
delay10ms();
LCDE=0;
}
void lcdwritedat(unsigned char dat)
{
LCDE=0;
RS=1;
RW=0;
GPIO_LCD=dat;
delay10ms();
LCDE=1;
delay10ms();
LCDE=0;
}
void lcdinit(void)
{
lcdwritecmd(0x38);
lcdwritecmd(0x0c);
lcdwritecmd(0x06);
lcdwritecmd(0x01);
lcdwritecmd(0x80);
}
void delay10ms(void)
{
int i,j,k;
for(i=1;i>0;i--)
for(j=10;j>0;j--)
for(k=100;k>0;k--);
}I
#include<reg51.h>
#define GPIO_LCD P0
sbit RS=P2^6;
sbit RW=P2^5;
sbit LCDE=P2^7;
void delay10ms(void);
void lcdwritecmd(unsigned char com);
void lcdwritedat(unsigned char dat);
void lcdinit();
unsigned char code data8[16]="hello world";
void main()
{
unsigned char i;
lcdinit();
while(1)
{
lcdwritecmd(0x80);
for(i=0;i<16;i++)
{
lcdwritedat(data8[i]);
}
}
}
void lcdwritecmd(unsigned char com)
{
LCDE=0;
RS=0;
RW=0;
GPIO_LCD=com;
delay10ms();
LCDE=1;
delay10ms();
LCDE=0;
}
void lcdwritedat(unsigned char dat)
{
LCDE=0;
RS=1;
RW=0;
GPIO_LCD=dat;
delay10ms();
LCDE=1;
delay10ms();
LCDE=0;
}
void lcdinit(void)
{
lcdwritecmd(0x38);
lcdwritecmd(0x0c);
lcdwritecmd(0x06);
lcdwritecmd(0x01);
lcdwritecmd(0x80);
}
void delay10ms(void)
{
int i,j,k;
for(i=1;i>0;i--)
for(j=10;j>0;j--)
for(k=100;k>0;k--);
}I