I need to write an IEEE single-precision floating point number to a 32-bit hardware register at a particular address. To do that, I need to convert a variable of type float
You could creat a union type that contains a float and an unsigned int, store a value into the float member, then read it out of the int, like so:
union
union reg_val { float f_val; unsigned int i_val; } myRegister; myRegister.f_val = 2.39; printf("target = %08X", myRegister.i_val);