道可道的世界 https://bbs.21ic.com/?702076 [收藏] [复制] [RSS]

日志

Tiva改变中断优先级的办法和解析

已有 229 次阅读2016-8-26 18:17 |个人分类:TM4C|系统分类:单片机| 优先级

使用void IntPrioritySet(uint32_t ui32Interrupt, uint8_t ui8Priority)函数来设置。

This function is used to set the priority of an interrupt. The ui32Interrupt parameter must be
one of the valid INT_ values listed in Peripheral Driver Library User’s Guide and defined in the
inc/hw_ints.h header file. The ui8Priority parameter specifies the interrupts hardware priority
level of the interrupt in the interrupt controller. When multiple interrupts are asserted simultaneously,
the ones with the highest priority are processed before the lower priority interrupts.
Smaller numbers correspond to higher interrupt priorities; priority 0 is the highest interrupt
priority.

//
// Set the UART 0 interrupt priority to the lowest priority.
//
IntPrioritySet(INT_UART0, 0xE0);
//
// Set the USB 0 interrupt priority to the highest priority.
//
IntPrioritySet(INT_USB0, 0);

注意第二个参数,TM4C的中断优先级有7种,分别是0-7,是由最高三位决定的。优先级数字越大则其优先级越低,也就是说0代表最高优先级。所以最高优先级是0x00,最低优先级是0xE0,1110 0000。


路过

鸡蛋

鲜花

握手

雷人

评论 (0 个评论)