kingman 发表于 2009-4-18 17:57:13

如何在PICC中进行位定义?

union {
struct {
unsigned b0: 1;
unsigned b1: 1;
unsigned b2: 1;
unsigned b3: 1;
unsigned b4: 1;
unsigned b5: 1;
unsigned : 2; //最高两位保留
} oneBit;
unsigned char allBits;
} myFlag;
需要存取其中某一位时可以
myFlag.oneBit.b3=1; //b3 位置1
一次性将全部位清零时可以
myFlag.allBits=0; //全部位变量清0
页: [1]
查看完整版本: 如何在PICC中进行位定义?