我在一个头文件里这样定义: #pragma DATA_SEG MY_ZEROPAGE typedef union { byte Byte; struct { byte FLAG0 :1; byte FLAG1 :1; byte FLAG2 :1; byte FLAG3 :1; byte FLAG4 :1; byte FLAG5 :1; byte FLAG6 :1; byte FLAG7 :1; } Bits; } FLAGSTR; extern volatile FLAGSTR _FLAG;
#define FLAG _FLAG.Byte #define FLAG_FLAG0 _FLAG.Bits.FLAG0 #define FLAG_FLAG1 _FLAG.Bits.FLAG1 #define FLAG_FLAG2 _FLAG.Bits.FLAG2 #define FLAG_FLAG3 _FLAG.Bits.FLAG3 #define FLAG_FLAG4 _FLAG.Bits.FLAG4 #define FLAG_FLAG5 _FLAG.Bits.FLAG5 #define FLAG_FLAG6 _FLAG.Bits.FLAG6 #define FLAG_FLAG7 _FLAG.Bits.FLAG7 #endif
然后调用的时候,显示这个警告: L1823: External object _FLAG in E:Demodemo_DataStandardObjectCodeSci.c.o created by default |