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:将变量传递给 DEVICE_DELAY_US()

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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1114528/tms320f280025c-passing-a-variable-to-device_delay_us

器件型号:TMS320F280025C
主题中讨论的其他器件:C2000WARE

当我写入 DEVICE_DELAY_US (100)时、时序正确。

当我定义任一类型的变量 uint16_t、float、long double 并调用 device_delay_US (变量)时、时序错误。

看看它

#define DEVICE_DELAY_US (x) SYSCTL_DELAY (((( 长双精度)(x)/(1000000.0L / \
                             (长双精度型) DEVICE_SYSCLK_FREQ)- 9.0L)/5.0L)

那么、我输入的任何数据类型都不应该转换为 long double 吗?

当我键入以使用任何数据类型作为输入时、计时始终为~2.4x 100。

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

    Carl、

    您是正确的、任何输入都应转换为长双精度型。  如果您使用的是 C2000Ware 示例并对其进行修改、或者将 delay 宏添加到您自己的代码/pjt、您能做些评论吗?

    最棒的

    Matthew