Saturday, November 16, 2002, 10:25:37 PM, you wrote: > Sorry for this general C question. > I need to transmitt 2 & 4 byte integers as a sequence of 2 or 4 bytes > out the serial port. Is there a simple way to do this? Basically I want > to treat the integers as an array of bytes.
union {
uint23_t u32;
uint8_t u8[4];
} x;
x.u32 = a;
b1 = x.u8[0];
b2 = x.u8[1];
b3 = x.u8[2];
b4 = x.u8[3];
HTH,
Andreas
--
WWW: http://andreas-s.net
ICQ: 83580609
