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.

[参考译文] MSP430F148:为什么 IDE 只使用"see 和 quot;函数中的一个条件? 为什么可以在调试中看到浮点值"#39;t I see float values in the debug?

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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/974675/msp430f148-why-does-ide-only-see-one-of-the-conditions-in-the-function-why-can-t-i-see-float-values-in-the-debugging

器件型号:MSP430F148
主题中讨论的其他器件:MSP432P401R
您好! 
此函数使用 ADC 12位温度值进行调用。
该值是一个字(16位)并被转换为浮点值
根据其值使用方程式。
出于某种原因、当我尝试在中设置断点时
不同的条件、只允许第一个条件。
此外、该值(1426)绝对不大于3800 -
那么、为什么会调用此行呢?
是否存在特定的浮点值处理问题
有什么好处?

感谢您的任何帮助和想法。
梅希


  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    留空-格式化有问题 
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    float GetTemperature (word pvalue)
    {
    浮点 gtemp;
    float valsq =(float)(pvalue * pvalue);
    
    如果(pvalue > 3800)
    {
    // y =-0.1553x + 592.62
    gtemp =(-0.1553 * pvalue)+ 592.62;
    
    }
    否则(pvalue > 1500)
    {
    // y =-4E-06x2 - 0.0068x + 89.927
    gtemp =-(0.000004 * valsq)-(0.0068 * pvalue)+ 89.927;
    }
    其他
    {
    // y = 4E-05x2 - 0.1244x + 175.7
    gtemp =(0.00004 * valsq)-(0.1244 * pvalue)+ 175.7;
    }
    
    返回 gtemp;
    }
    

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

    我在发帖时遇到困难-我不明白为什么文本被解释为代码...

    Hello,This function is called with the ADC 12-bit value of temperature.

    The value is a WORD(16-bit) and is converted to a floatvalue by usingthe equations according to its value.

    For some reason, when I tryto set a breakpoint within the different conditions, only the first one is allowed.

    Also the value (1426) is definitely not greater than 3800 - so why does thisrow get called?

    Is there something about dealing with floatvalues that is specific with thisMSP430?

    Thanks forany help and ideas.

    Mechi

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

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

    您是否打开了优化功能? 有时、这会消除局部变量甚至整个语句、因为它会重新组织速度和效率。 尝试暂时关闭优化以进行调试。

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

    仅使用0级-寄存器优化。  

    否则、代码将无法正常工作...

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

    您可能应该在浮点中进行平滑处理、1500 * 1500不适合16位数字。

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

    仅为记录目的、它在我的 MSP432P401R 上运行正常、我刚刚将 word 更改为 uint16_t

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

    你是对的-我想这是调试器的问题-因为即使光标始终跳到相同的行/条件、也会计算正确的值。

    谢谢!