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:将 ADC 测量转换为 float32_t

Guru**** 2188815 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/999180/codecomposer-converting-adc-measurements-into-float32_t

器件型号:CODECOMPOSER

您好!

我正在尝试使用 F2837xD 上的 HRPWM 模块。 我使用 CLA 计算新的控制输出、并将其传递回 CPU 以调制 HRPWM 寄存器。

在 HRPWM 的所有示例中、float32_t 类型用于精细情况控制。 问题是、我对 CLA 的输入是一组三个 ADC 测量值。 因此、它们是 int32_t 类型。  

将 int32_t 变量转换为 float32_t 的方法是什么? 我应该在 CPU 中还是在 CLA 中执行此操作?  

此致、
Joel

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Joel、

    您可以通过键入 float 或使用 IQMath 来实现它(由于 long 是 int32_t、因此您可以使用_IQNtoF()函数)。  

    是的、您可以在 CLA 中执行它。 如果您遇到任何问题、请告诉我。

    -Shantanu