The typedef could be declared using anonymous structures instead named ones= : typedef union { struct { uint32_t rgb: 24; uint32_t alpha:8; /* <=3D Alpha channel may be useful instead of a useless padding */ }; /* <=3D Notice the lack of name here */ struct { uint8_t red; uint8_t green; uint8_t blue; }; /* <=3D Notice the lack of name here */ } rgb32_t; This way you could use: rgb32_t Color1; Color1.rgb =3D 0x123456; or Color1.red =3D 0x12; Color1.green =3D 0x34; Color1.blue =3D 0x56; Anonymous structures are not supported by C89 standard, only from C99 onwards. Isaac On 18/08/2014 03:18, Ruben J=F6nsson wrote: >> 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; >> >> An array would also be fine: >> >> RGB rgb[10]; >> rgb[5].col.red=3D12; >> > Correcting myself here: > >> If you don't have the typedef you need to explicitly declare it as: >> >> union RGB rgb; > This is not correct. Just ignore it... > > > /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 .