lcd12864程序在keil中出现好多重新定义,尝试了很多办法都改不了,求助大家了

2019-07-15 10:59发布

#ifndef __LCD12864_H
#define __LCD12864_H

#include<reg52.h>
#include<intrins.h>


//---重定义关键词---//
#ifndef         uchar
#define uchar unsigned char
#endif

#ifndef         uint
#define uint unsigned int
#endif

#ifndef data12864
#define  data12864  P0
#endif

sbit RS = P2^0;
sbit RW = P2^1;
sbit E = P2^2;
sbit rst_12864 = P2^3;

unsigned char read12684_data(uchar address);//12864读数据
void busychk_12864(void);//12864,忙碌检查
void write12864_comand(uchar comand);//12864写命令
void write12864_data(uchar dat);//12864写数据
void initial_12864(); //12864初始化
void clear_CGRAM12864();//清空CGRAM
void delay_12864(uint a);
void write12864_address(uchar x,uchar y);//地址设置  第x行 第y列
void ShowStringPos(uchar x, uchar y,uchar *s);//写英文字符串,一行写满自动换行
void ShowGBString(uchar x, uchar y, uchar *s);//显示多个汉字

uchar code wendu[] = {"温度:  66.6 ℃"};
uchar code shidu[] = {"湿度:  66.6 %"};
uchar code mima[] = {"请输密码"};
uchar code succeed[]={"密码输入正确"};
uchar code fail[]={"密码输入错误"};

uchar code kaiji[]={/*--  调入了一幅图像:C:UsersAdministratorPictures无标题.bmp  --*/
/*--  宽度x高度=128x64  --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,
0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,
0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,
0x00,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,
0x0F,0xCF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xF3,0xE0,
0x06,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x40,
0x01,0x86,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,
0x00,0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x21,0x00,
0x01,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x21,0x00,
0x01,0xCE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2D,0x00,
0x03,0x03,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x73,0x80,
0x00,0x04,0x00,0x00,0x00,0x18,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,};

uchar code ren[]={/*--  调入了一幅图像:C:UsersAdministratorPicturesuser9_16x16.bmp  --*/
/*--  宽度x高度=16x16  --*/
0x07,0xE0,0x0F,0xF0,0x1F,0xF8,0x18,0x38,0x18,0x38,0x1C,0x78,0x1F,0xF8,0x0F,0xF0,
0x07,0xE0,0x0F,0xF0,0x14,0x38,0x13,0xF8,0x10,0x78,0x10,0x78,0x10,0x78,0x0F,0xF0}


#endif








#include "lcd12864.h"
void busychk_12864(void)  //忙碌检测
{
        uchar busytemp = 0x80;
          E = 0;
         RW = 1;
         RS = 0;
         E = 1;
        while((busytemp & data12864));
        E = 0;
}


Build target 'Target 1'
compiling iMAIN.c...
DHT11.H(16): error C141: syntax error near 'void'
iMAIN.c(80): warning C316: unterminated conditionals
compiling LCD12864.c...
LCD12864.C(2): error C141: syntax error near 'void'
LCD12864.C(3): error C231: 'busychk_12864': redefinition
LCD12864.C(3): error C141: syntax error near '{'
LCD12864.C(5): error C231: 'E': redefinition
LCD12864.C(5): error C231: 'E': redefinition
LCD12864.C(6): error C231: 'RW': redefinition
LCD12864.C(6): error C231: 'RW': redefinition
LCD12864.C(7): error C231: 'RS': redefinition
LCD12864.C(7): error C231: 'RS': redefinition
LCD12864.C(8): error C279: 'E': multiple initialization
LCD12864.C(8): error C231: 'E': redefinition
LCD12864.C(8): error C231: 'E': redefinition
LCD12864.C(9): error C141: syntax error near 'while'
LCD12864.C(9): error C141: syntax error near '&', expected ')'
LCD12864.C(9): error C129: missing ';' before ')'
Target not created

不是所有程序,第一段是头文件,第二段是lcd12864程序的第一个子程序,在这个子程序开始就报错了




友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
2条回答
人中狼
1楼-- · 2019-07-15 21:13
while((busytemp & data12864));多了一对括号
人中狼
2楼-- · 2019-07-16 00:29
redefinition的错误是你在多个文件里定义了同样的一个名称,查查所有的程序和头文件吧

一周热门 更多>