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.

[参考译文] TMS320F2808:转换'ConfigCpuTimer()'混杂 ME

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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1343421/tms320f2808-cast-in-configcputimer-confuses-me

器件型号:TMS320F2808

在'SP280x_CpuTimers.c'中、下面的函数将两个'float'相乘、然后将结果转换为'long'、然后让赋值执行最终转换为'unsigned long'...并与之混淆。 这是一个符号扩展习语吗? (我几乎永远不会进行浮点计算;因此、问题就在这里。)

    void ConfigCpuTimer(struct CPUTIMER_VARS *Timer, float Freq, float Period) {
    Uint32  temp;
    ...
    temp = (long) (Freq * Period);
   
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    我同意、它应该已经  

    (Uint32) (Freq * Period);

    我将为此提交一张 TT

    此致、

    维纳