本帖最后由 laibour 于 2012-1-19 14:55 编辑
BYTE_VAL Side[16];
i = decade*10 + unit; // i 为一个整形变量
m = i/8;
n = i%8;
Side[m].bits.bn = 1;
上面第五行报错,MCC18编译;换成这样写:Side[m].bits.b[n] = 1,也同样报错;下面是BYTE_VAL类型的定义:
typedef union _BYTE_VAL
{
BYTE Val;
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;
} BYTE_VAL, BYTE_BITS; |