uchar Key_Board(void) { uchar a,key=0;
P1=0X1F; P3=0XFF; if(P3==0XFF) return 0; else{ Value_Flag=1; Delay(); for(a=0;a<3;a++){ P1=_crol_(0XDF,a); if(P32==0) break; if(P33==0) break; if(P34==0) break; if(P35==0) break;
.......
头文件为 #ifndef _KEYBOARD_H #define _KEYBOARD_H #include<reg52.h> #include<intrins.h> #include<stdio.h> #define uchar unsigned char void Delay(void); uchar Key_Board(void); uchar Key_Value(void); sbit P32=P3^2; sbit P33=P3^3; sbit P34=P3^4; sbit P35=P3^5;
bit Value_Flag=0;
#endif
编译器出现:
Build target 'Target 1' compiling keyboard.c... compiling ceshi2.c... linking... *** ERROR L104: MULTIPLE PUBLIC DEFINITIONS SYMBOL: VALUE_FLAG MODULE: ceshi2.obj (CESHI2) Program Size: data=10.2 xdata=0 code=272 Target not created 主程序测试按键标志(Value_Flag),删除这个标志之后就可以编译 |