麻烦大家帮忙看下!前面就简洁些
程序问题
LCD1602.C(26): error C141: syntax error near ')'
LCD1602.C(29): error C141: syntax error near 'data'
#include<reg52.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
sbit RS=P2^6;
sbit RW=P2^5;
sbit EP=P2^7;
uchar num;
uchar code table[]="123456";
uchar code table123[]="abcdef";
/*LCD写入命令*/
void LcdWriteCom(uchar com)
{
RS=0;
P0=com;
_nop_();
_nop_();
EP=1;
_nop_();
_nop_();
EP=0;
}
/*LCD写入数据*/
void LcdWriteData(uchar data)
{
RS=1;
P0=data;
_nop_();
_nop_();
EP=1;
_nop_();
_nop_();
EP=0;
}
/*初始化*/
void init()
{
RS=0;
RW=0;
EP=0;
LcdWriteCom(0x38);
LcdWriteCom(0x0c);
LcdWriteCom(0x06);
LcdWriteCom(0x01);
LcdWriteCom(0x80);
}
void main()
{
init();
for(num=0;num<7;num++)
{
LcdWriteData(table[num]);
_nop_();
_nop_();
}
LcdWriteCom(0x80+0x40);
for(num=0;num<7;num++)
{
LcdWriteData(table123[num]);
_nop_();
_nop_();
}
while(1);
}
|