Forum Discussion
Altera_Forum
Honored Contributor
15 years agoCombine 4 bytes in float
Hi all! i'm receiving a float (32bit) from the serial port... i receive the correct sequence but now i'm trying to recombine the number with this code: unsigned char b1,b2,b3,b4; b1=GetUa...
Altera_Forum
Honored Contributor
15 years agoYou need to cast the pointer, not the value try:
union { unsigned char b[4]; float f; } x; x.b[0] = GetUart(); ... coeff = x.f;