[程序源码] keil的报错 error c141:syntax error near')'

[复制链接]
4512|5
 楼主| jing880311 发表于 2013-11-4 12:03 | 显示全部楼层 |阅读模式
#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);
    }
}
wape271 发表于 2013-11-4 13:12 | 显示全部楼层
楼主啊
data是什么你不知道吗
ayb_ice 发表于 2013-11-4 13:36 | 显示全部楼层
data上C51的关键字。。。
ballack_linux 发表于 2013-11-4 14:22 | 显示全部楼层
data是关键字  关键字不能做标识符,你改成其他名字即可

评分

参与人数 1威望 +1 收起 理由
jing880311 + 1 赞一个!

查看全部评分

戈卫东 发表于 2013-11-4 16:32 | 显示全部楼层
...............
dirtwillfly 发表于 2013-11-4 19:38 | 显示全部楼层
额,估计楼主晕了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

39

主题

73

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部