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.

[参考译文] CCS/MSP430G2553:如何在 MSP430G2553中生成1秒的延迟?

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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/939826/ccs-msp430g2553-how-to-generate-delay-for-1-sec-in-msp430g2553

器件型号:MSP430G2553

工具/软件:Code Composer Studio

我使用过 MSP430G2553 LaunchPad 开发套件。

我希望在不使用计时器的情况下每隔1秒延迟闪烁一次 LED。 是否有用于生成1-2秒延迟的 API?

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

    您可以尝试:

    # define Hz 1000000UL // 1MHz
    __delay_cycles (2*Hz); //旋转2秒
    

    _delay_cycles 需要一个 uint32_t (无符号长整型)、因此您可以这样旋转大约4000秒。

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

    感谢 Bruce 的支持

    它工作正常。