lm_cloud 发表于 2017-7-11 15:04:49

STM8中断优先级不够的问题

STM8L 中,中断优先级通过下面函数设置,但此处仅 ITC_PriorityLevel_1,ITC_PriorityLevel_2,ITC_PriorityLevel_3总共才3个中断优先级可设置,若我超过3个中断,该怎么设置?



/**
* @briefSets the software priority of the specified interrupt source.
* @note   The modification of the software priority is only possible when
*         the interrupts are disabled.
* @note   The normal behavior is to disable the interrupt before calling
*         this function, and re-enable it after.
* @note   The priority level 0 cannot be set (see product specification
*         for more details).
* @paramIRQn : Specifies the peripheral interrupt source.
* @paramITC_PriorityLevel : Specifies the software priority value to set
*          This parameter can be one of the following values:
*            @arg ITC_PriorityLevel_0: Software priority level 0 (cannot be written)
*            @arg ITC_PriorityLevel_1: Software priority level 1
*            @arg ITC_PriorityLevel_2: Software priority level 2
*            @arg ITC_PriorityLevel_3: Software priority level 3   
* @retval None
*/
void ITC_SetSoftwarePriority(IRQn_TypeDef IRQn, ITC_PriorityLevel_TypeDef ITC_PriorityLevel)
{


}




lm_cloud 发表于 2017-7-11 16:50:59

分硬件优先级和软件优先级,没设置软件优先级的默认为硬件的优先级

sssdd 发表于 2017-7-24 10:37:59

实际上相同优先级的会顺序响应。不是说每个中断要有独立的优先级。理解错了啊。
所以,这么几个优先级就够了。
优先级的含义是,可以打断低优先级的中断。实际上不允许你嵌套太多的中断。非常费堆栈。
页: [1]
查看完整版本: STM8中断优先级不够的问题