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.

[参考译文] TM4C123GH6PM:我的 while 循环是否比我的中断运行慢?

Guru**** 2614265 points


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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/775261/tm4c123gh6pm-do-my-while-loop-is-runny-slower-than-my-interrupt

器件型号:TM4C123GH6PM

我正在使用48000Hz 的 Systic 中断、每次发生中断时、我的 x2和 x1值都会更新、 我遇到了混乱,当我使用115200波特率在控制台上打印值时,而我的 UARTprintf 语句位于 while 循环中,我的 x1值不会因此显示,但会像12跳到62跳转, 但是、当我在中断中使用 UARTprintf 时、所有的值都会相应地重复。我想知道这是 UART 的速度问题还是 while 循环花费了太多的时间?

何时使用 UARTprintf ("[%i %i]%i \n",x2,x1,out);while 循环内部

当我在中断中使用 UARTprintf 时。

我的 while 循环如下所示。

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

    根据您所说的话、我认为中断设置得太快、无法完成您想要执行的操作。 中断将持续触发、并随着 UART 通信的发生而递增。 UART 比48kHz 中断慢得多、 因此、每个 UART 事务都会发生数十个中断、这就是为什么要跳过值的原因、除非您在中断内部打印 UART、否则会减慢中断速度、因为它会等待 UART 完成发送、然后才允许触发下一个中断。