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.

想在一个程序中使用timer和systick 的中断,想让systick优先于timer中断,如何设计?

Other Parts Discussed in Thread: EK-TM4C123GXL

另外systick中断时,想避免timer也中断应该如何做。想让程序主要运行在timer中,主程序仅循环处理一些量,如果timer执行时,systick中断,执行systick中断,timer再中断呢,总觉着这样会乱套,有什么写法可以避免这种情况。如果在timer中断时停timer定时器中断,systick中断后再停systick定时器中断,systick结束后打开systick定时器中断,回到timer中断,timer中断完成前打开timer定时器中断,这样做是否可以???

  • 两个设定中断优先级即可。只要两个中断函数中不要乱操作和修改全局变量即可。systick中断用来干嘛呢,一般只用这个做OS的时间用的。

  • Systick想用来用延时,优先级设置用什么函数哈?

  • 你好,

    你可以参考C:\ti\TivaWare_C_Series-2.1.0.12573\docs 里面的SW-EK-TM4C123GXL-UG-2.1.0.12573.pdf文档。

    所有的API函数说明里面都有。

    你需要调整优先级可以参考TIVAWARE 里面的C:\ti\TivaWare_C_Series-2.1.0.12573\examples\boards\ek-tm4c123gxl\interrupts

    这个例程:

    说了这么多,具体的函数是:

    //
    // Set the interrupt priorities so they are all equal.
    //
    ROM_IntPrioritySet(INT_GPIOA, 0x00);
    ROM_IntPrioritySet(INT_GPIOB, 0x00);
    ROM_IntPrioritySet(INT_GPIOC, 0x00);

    对,就是IntPrioritySet(xx, xx);