This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F280025C: Convert bytes to a float value

Part Number: TMS320F280025C


Hi experts,

I've an issue, I want to convert CAN data receive to a float value. I think I don't understand correctly the IEE754 representation in C. I understand well the decomposition of a float on 32 bits, but I do not see how to obtain a float number from my bytes ? 

Can you help me please ?

Thanks,

Damien

int32_t data;
void update_param_corrector(struct corrector_parameters * param)
{
    data = (int32_t)can_rx_buffer[4];
    data |= ((int32_t)can_rx_buffer[5] << 8);
    data |= ((int32_t)can_rx_buffer[6] << 16);
    data |= ((int32_t)can_rx_buffer[7] << 24);
    param->KP = (float32_t)data;
}