union UNION
{
unsigned char state;
struct
{
unsigned char b0 : 1;
unsigned char b1 : 1;
unsigned char b2 : 1;
unsigned char b3 : 1;
unsigned char b4 : 1;
unsigned char b5 : 1;
unsigned char b6 : 1;
unsigned char b7 : 1;
}bits;
};
union UNION byte;
while(1)
{
byte.state = 0x00 ;
byte.bits.b0 = 1;
byte.bits.b1 = 1;
byte.bits.b2 = 1;
byte.bits.b3 = 1;
byte.bits.b4 = 1;
byte.bits.b5 = 1;
byte.bits.b6 = 1;
byte.bits.b7 = 0;
}
嗯,懂?!