2019-07-21 04:17发布
warship 发表于 2018-8-1 17:35 3、NVIC的寄存器管理着包括系统异常(小于0)和外部中断(0-240)的所有中断的优先级。有如下三处与优先 ...
最多设置5个标签!
好点,嗯嗯。我看了下优先级分组的函数如下:
static void MY_NVIC_PriorityGroupConfig(u32 PriorityGroup)
{
uint32_t reg_value;
uint32_t PriorityGroupTmp = (PriorityGroup & 0x07);
reg_value = SCB->AIRCR;
reg_value &= ~(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk);
reg_value = (reg_value |
(0x5FA << SCB_AIRCR_VECTKEY_Pos) |
(PriorityGroupTmp << 8));
SCB->AIRCR = reg_value;
}
优先级分组展开为:0x700,0x600,,,,,我怎么感觉该函数应该为下面这样呢?
不知理解得对不对?
static void MY_NVIC_PriorityGroupConfig(u32 PriorityGroup)
{
uint32_t reg_value;
uint32_t PriorityGroupTmp = PriorityGroup;
reg_value = SCB->AIRCR;
reg_value &= ~(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk);
reg_value = (reg_value |
(0x5FA << SCB_AIRCR_VECTKEY_Pos) |
(PriorityGroupTmp));
SCB->AIRCR = reg_value;
}
一周热门 更多>