keil的报错 error c141:syntax error near')'
#include"reg51.h"#defineDATA_BUS(P0)#defineRS(P2_bit.P2_0)#defineRW(P2_bit.P2_1)#defi...
#include "reg51.h"
#define DATA_BUS (P0)
#define RS (P2_bit.P2_0)
#define RW (P2_bit.P2_1)
#define E (P2_bit.P2_2)
typedef unsigned char uchar;
typedef unsigned int uint;
void check_busy(void);
void write_command(uchar com);
void write_data(uchar data); <<<<<<<<报错所在的行
void LCD_init(void);
void string(uchar ad ,uchar *s);
void lcd_test(void);
void delay(uint);
void main(void)
{ LCD_init();
while(1)
{ string(0x80,"Have a nice day!");
string(0xC0," Proteus VSM");
delay(100);
write_command(0x01);
delay(100);
}
}
void delay(uint j)
{ uchar i = 60;
for(; j>0; j--)
{ while(--i);
i = 59;
while(--i);
i = 60;
}
}
void check_busy(void)
{ do
{ DATA_BUS = 0xff;
E = 0;
RS = 0;
RW = 1;
E = 1;
__no_operation();
} while(DATA_BUS & 0x80);
E = 0;
}
void write_command(uchar com)
{ check_busy();
E = 0;
RS = 0;
RW = 0;
DATA_BUS = com;
E = 1;
__no_operation();
E = 0;
delay(1);
}
void write_data(uchar data)
{ check_busy();
E = 0;
RS = 1;
RW = 0;
DATA_BUS = data;
E = 1;
__no_operation();
E = 0;
delay(1);
}
void LCD_init(void)
{ write_command(0x38); // 8-bits, 2 lines, 7x5 dots
write_command(0x0C); // no cursor, no blink, enable display
write_command(0x06); // auto-increment on
write_command(0x01); // clear screen
delay(1);
}
void string(uchar ad, uchar *s)
{ write_command(ad);
while(*s>0)
{ write_data(*s++);
delay(100);
}
} 展开
#define DATA_BUS (P0)
#define RS (P2_bit.P2_0)
#define RW (P2_bit.P2_1)
#define E (P2_bit.P2_2)
typedef unsigned char uchar;
typedef unsigned int uint;
void check_busy(void);
void write_command(uchar com);
void write_data(uchar data); <<<<<<<<报错所在的行
void LCD_init(void);
void string(uchar ad ,uchar *s);
void lcd_test(void);
void delay(uint);
void main(void)
{ LCD_init();
while(1)
{ string(0x80,"Have a nice day!");
string(0xC0," Proteus VSM");
delay(100);
write_command(0x01);
delay(100);
}
}
void delay(uint j)
{ uchar i = 60;
for(; j>0; j--)
{ while(--i);
i = 59;
while(--i);
i = 60;
}
}
void check_busy(void)
{ do
{ DATA_BUS = 0xff;
E = 0;
RS = 0;
RW = 1;
E = 1;
__no_operation();
} while(DATA_BUS & 0x80);
E = 0;
}
void write_command(uchar com)
{ check_busy();
E = 0;
RS = 0;
RW = 0;
DATA_BUS = com;
E = 1;
__no_operation();
E = 0;
delay(1);
}
void write_data(uchar data)
{ check_busy();
E = 0;
RS = 1;
RW = 0;
DATA_BUS = data;
E = 1;
__no_operation();
E = 0;
delay(1);
}
void LCD_init(void)
{ write_command(0x38); // 8-bits, 2 lines, 7x5 dots
write_command(0x0C); // no cursor, no blink, enable display
write_command(0x06); // auto-increment on
write_command(0x01); // clear screen
delay(1);
}
void string(uchar ad, uchar *s)
{ write_command(ad);
while(*s>0)
{ write_data(*s++);
delay(100);
}
} 展开
2个回答
展开全部
data 是系统保留字, 不能做为自定义的变量名。 你把它换个名字就可以了。
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |