On Sun, Aug 17, 2014 at 4:57 AM, Jan-Erik Soderholm wrote: > And, if it wasn't clear from Rubens text :-), this is > much faster since there will not be any multiplications > or shifts at all. Just simple assignments: > > rgb.col.red =3D red; > rgb.col.green =3D green; > rgb.col.blue =3D blue; Yep, I dig it! I will probably leave the actual assignments to a function that I've written, that way it can be swapped out in the future. Plus changing the color of an LED is a single line in my main code. > B.t.w, I'd define a dummy byte also, just so it is > clear at what end the "zero byte" is... Would that change the definition to: union { uint32_t rgb_32; struct { uint8_t red:8; uint8_t green:8; uint8_t blue:8; uint8_t dummy:8; }col; }rgb; ? > Hasn't some C compilers also 24 bit integers? I can't remember where, but I thought I read something about 24 bit ints not being a standard, so they weren't recommended for portability. I haven't looked into XC16 or XC32 to see if they support it though. Josh --=20 A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. -Douglas Adams --=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 .