> On Sun, Aug 17, 2014 at 3:28 PM, Ruben J=F6nsson wr= ote: > > Well actually it could be something like this instead: > > > > typedef union { > > uint32_t rgb_32; > > struct { > > uint8_t red:8; > > uint8_t green:8; > > uint8_t blue:8; > > uint8_t pad:8; > > }col; > > }RGB; > > > > Then you can do: > > > > RGB rgb; > > rgb.col.red=3D12; >=20 > And would I then do "rgb.col =3D 0x12345678" to dump a color in all at on= ce? >=20 No, that is what the rgb_32 member is for: rgb.rgb_32=3D0x12345678; A uinon means that all the members in it shares the same memory. So the address of rgb.rgb_32 is the same as the address for rgb.col. The union only has two members, rgb_32 and the col struct. You can also do: typedef struct { uint8_t red:8; uint8_t green:8; uint8_t blue:8; uint8_t pad:8; }COL; typedef union { uint32_t rgb_32; COL col; }RGB; Which more clearly shows that the union has two members. /Ruben --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .