//--------------------------------------------联合体(共用体) 定义
typedef union
{
//使用位域
struct
{
bool b0 : 1;
bool b1 : 1;
bool b2 : 1;
bool b3 : 1;
bool b4 : 1;
bool b5 : 1;
bool b6 : 1;
bool b7 : 1;
}bit_t;
unsigned char byte;
}GetBit;//结构变量声明
//--------------------------------------------结构类型变量位域宏定义
#define flag_0 GetBit.bit_t.b0
#define flag_1 GetBit.bit_t.b1
#define flag_2 GetBit.bit_t.b2
#define flag_3 GetBit.bit_t.b3
#define flag_4 GetBit.bit_t.b4
#define flag_5 GetBit.bit_t.b5
#define flag_6 GetBit.bit_t.b6
#define flag_7 GetBit.bit_t.b7