[求助] 求助 请高手帮我看看哪里错了

fb2231   2016-4-27 20:16 楼主
#include
#include
#define    DATAPORT P1
#define RS = P2^5
#define RW = P2^6
#define E = P2^7
unsigned char Busy_Check()
{
    unsigned char LCD_Status;
    RS = 0;
    RW = 1;
    E = 1;
    delayMS(1);
    LCD_Status = P1;
    E = 0;
    return LCD_status;
        
}
void Write_LCD_Command(unsigned char cmd)
{
    while(Busy_Check()&0x80);
    RS = 0;
    RW = 0;
    E = 0;
    P1 = cmd;
    E = 1;
    delayMS(1);
    E = 0;

}
viod Write_LCD_Data(unsigned char dat)
{
    while(Busy_Check()&0x80 == 0x80);
    RS = 1;
    RW = 0;
    E = 0;
    P1 = dat;
    E = 1;
    delayMS(1);
    E = 0;

}
viod Initialize_LCD()
{
    Write_LCD_Command(0x38);
    delayMS(1);
    Write_LCD_Command(0x01);
    delayMS(1)
    Write_LCD_Command(0x06);
    delayMS(1);
    Write_LCD_Command(0x0c);
    delayMS(1);

}
viod ShowString(unsigned char x, unsigned char y, unsigned char *str)
{
    unsigned char i = 0;
    if(y == 0)
    Write_LCD_Command(0x80|x);
    if(y == 1)
    Write_LCD_Command(0xc0|x);
    for(i = 0; i < 16; i++)
    {
        Write_LCD_Data(str);
    }

}
main(viod)
{
    unsigned char code Promt[]="HELLO WORLD! 2016-04-25";
    Initalize_lcd();
    ShowString(0,0,Prompt);
    ShowString(0,1,Prompt+16);
    while(1)
}
编译时keil4提示错误错误代码
compiling lesson1.c...
LESSON1.C(10): error C141: syntax error near '='
LESSON1.C(10): error C141: syntax error near '='
LESSON1.C(11): error C141: syntax error near '='
LESSON1.C(11): error C141: syntax error near '='
LESSON1.C(12): error C141: syntax error near '='
LESSON1.C(12): error C141: syntax error near '='
lesson1.c - 6 Error(s), 0 Warning(s).
请高手帮忙看是哪里错了   会不会是我keil软件有问题


回复评论 (5)

#define RS = P2^5
这种定义是错误的,C51里要用sbit来定义
点赞  2016-4-27 20:29
谢谢
点赞  2016-4-27 20:54
我看楼主您可能还是没搞明白,#define 的作用,然后51的话,如果将某个管脚定义要使用是sbit的哦
点赞  2016-4-28 12:11
楼主没搞明白,define 不能用 “=”,要将51单片机某个管脚定义要使用是sbit.
点赞  2016-5-27 08:57
1   define
2   main(viod)      viod是什么意思;
3  while(1) 少了分号,


点赞  2016-5-27 09:16
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复