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.

[参考译文] MSP430静态变量处理

Guru**** 2601915 points


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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/833776/msp430-static-variable-handling

大家好、

我已经编写了一个示例程序来打印静态变量的值、但输出没有正确打印? 根据我的代码、可变 ActiveState = 0和 state = 8的值、但在终端窗口中打印的值是相同的? 我已经看到存储器中没有任何值出现在变量 ActiveState 的相关存储器地址中。 我已附加项目的屏幕。 有人可以解释我吗?

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

    Prakash、您好!

    因此、从这个角度来看、除了您在终端窗口中看到的情况外、一切看起来都是正确的、并按预期运行。  你同意吗?   

    您是否包含 ?  我认为这是 printf 正常工作所必需的、但我想如果不包含 printf、它会产生错误。   

    如果是,我不确定终端窗口为什么不正确,但 printf()似乎无法按预期工作。  您能否通过直接输入整数而不是要测试的变量来测试它?   

    谢谢、

    JD