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.

CODECOMPOSER: Converting ADC measurements into float32_t

Part Number: CODECOMPOSER

Hi,

I am trying to use the HRPWM module on my F2837xD. I use the CLA to compute a new control output and pass this back to the CPU to modulate the HRPWM register.

In all the examples for HRPWM, the float32_t type is used for fine case control. The issue is, that my input to the CLA is a set of three ADC measurements. Therefore, they are of int32_t type. 

What is the methodology for converting a int32_t variable into a float32_t? Should I do this in the CPU, or in the CLA? 

Regards,
Joel

  • Hi Joel,

    You can do it either by typecasting to float or using IQMath (since long is int32_t, you can use the _IQNtoF() function). 

    Yes, you can do it in the CLA. Let me know if you face any issues.

    -Shantanu