为什么这个程序老报错 求大家指教下
时间:10-02
整理:3721RD
点击:
#include<reg52.h>
#define uchar unsigned char
uchar code table[]="fuck you";
uchar code table1[]= "hello every one";
sbit E=P2^5;
sbit RW=P2^6;
sbit RS=P2^7;
uchar num;
void delay(int x)
{
int i,j;
for(i=x;i--;i>0)
for(j=110;j>0;j--);
}
void write_com(uchar com)
{
RS=0;
P0=com;
delay(5);
E=1;
delay(5);
E=0;
}
void write_shuju(uchar date)
{
RS=1;
P0=date;
delay(5)
E=1;
delay(5);
E=0;
}
void init()
{
RW=0;
write_com(0x38);
write_com(0x0c);
write_com(0x06);
write_com(0x01);
}
void main()
{
init();
write_com(0x80);
for(num=0;num<8;num++)
{ write_shuju(table[num])
delay(5);
}
write_com=(0x80+0x40)
for(num=0;num<15;num++)
{
write_shuju(table1[num]);
delay(5);
}
for(num=0;num++;num<16)
{
write_com(0x18);
delay(200);
}
while(1);
}
compiling 1602滚动显1.c...
1602滚动显1.C(33): error C141: syntax error near 'E'
1602滚动显1.C(54): error C141: syntax error near 'delay'
1602滚动显1.C(57): error C183: unmodifiable lvalue
1602滚动显1.C(57): error C141: syntax error near 'for'
1602滚动显1.c - 4 Error(s), 0 Warning(s).
#define uchar unsigned char
uchar code table[]="fuck you";
uchar code table1[]= "hello every one";
sbit E=P2^5;
sbit RW=P2^6;
sbit RS=P2^7;
uchar num;
void delay(int x)
{
int i,j;
for(i=x;i--;i>0)
for(j=110;j>0;j--);
}
void write_com(uchar com)
{
RS=0;
P0=com;
delay(5);
E=1;
delay(5);
E=0;
}
void write_shuju(uchar date)
{
RS=1;
P0=date;
delay(5)
E=1;
delay(5);
E=0;
}
void init()
{
RW=0;
write_com(0x38);
write_com(0x0c);
write_com(0x06);
write_com(0x01);
}
void main()
{
init();
write_com(0x80);
for(num=0;num<8;num++)
{ write_shuju(table[num])
delay(5);
}
write_com=(0x80+0x40)
for(num=0;num<15;num++)
{
write_shuju(table1[num]);
delay(5);
}
for(num=0;num++;num<16)
{
write_com(0x18);
delay(200);
}
while(1);
}
compiling 1602滚动显1.c...
1602滚动显1.C(33): error C141: syntax error near 'E'
1602滚动显1.C(54): error C141: syntax error near 'delay'
1602滚动显1.C(57): error C183: unmodifiable lvalue
1602滚动显1.C(57): error C141: syntax error near 'for'
1602滚动显1.c - 4 Error(s), 0 Warning(s).
语句结束请加分号