当前位置:网站首页>Stm32 NVIC interrupt priority management
Stm32 NVIC interrupt priority management
2022-07-03 09:56:00 【Yiao】
stm32 share 92 A break , Include 10 Kernel interrupts and 82 Maskable interrupts , In the Chinese Reference Manual 10.2 Search for .
1. Interrupt management method
First , Group interrupts , Group 0~4, secondly , Set a preemption priority and response priority for each interrupt , The packet configuration is in the register SCB->AIRCR Middle configuration .
| Group | AIRCR(10:8) | IP bit (7:4) Distribution | Distribution results |
| 0 | 111 | 0:4 | 0 Bit preemption priority ,4 Bit response priority |
| 1 | 110 | 1:3 | 1 Bit preemption priority ,3 Bit response priority |
| 2 | 101 | 2:2 | 2 Bit preemption priority ,2 Bit response priority |
| 4 | 100 | 3:1 | 3 Bit preemption priority ,1 Bit response priority |
| 4 | 011 | 4:0 | 4 Bit preemption priority ,0 Bit response priority |
2. Interrupt priority grouping
Call function void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup)
void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup)
{
assert_param(IS_NVIC_PRIORITY_GROUP(NVIC_PriorityGroup));
SCB->AIRCR = AIRCR_VECTKEY_MASK | NVIC_PriorityGroup;
}NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);3. Set each interrupt priority
Call function
void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);
//NVIC_InitTypeDef* It includes //
NVIC_IRQChannel;// passageway
NVIC_IRQChannelPreemptionPriority;// preemption
NVIC_IRQChannelSubPriority;// Response priority
NVIC_IRQChannelCmd;// Can make
NVIC_InitTypeDef NVIC_InitStructure;// Defining structure
NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;// A serial port 1 interrupt
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=1 ;// Preemption priority is 1
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;// Sub priority bit 2
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;//IRQ Channel enable
NVIC_Init(&NVIC_InitStructure); // Initialize... According to the parameters specified above NVIC register
边栏推荐
- byte alignment
- Matlab reads hexadecimal numbers and converts them into signed short
- It is difficult to quantify the extent to which a single-chip computer can find a job
- UCI and data multiplexing are transmitted on Pusch - placement of data and UCI positions (Part III)
- Emballage automatique et déballage compris? Quel est le principe?
- Development of fire evacuation system
- Not many people can finally bring their interests to college graduation
- [CSDN]C1训练题解析_第二部分_Web基础
- numpy. Reshape() and resize() functions
- el-table X轴方向(横向)滚动条默认滑到右边
猜你喜欢
![【順利畢業】[1]-遊覽 [學生管理信息系統]](/img/91/72cdea3eb3f61315595330d2c9016d.png)
【順利畢業】[1]-遊覽 [學生管理信息系統]

Seven sorting of ten thousand words by hand (code + dynamic diagram demonstration)

Development of electrical fire system

How does the memory database give full play to the advantages of memory?

Of course, the most widely used 8-bit single chip microcomputer is also the single chip microcomputer that beginners are most easy to learn

在三线城市、在县城,很难毕业就拿到10K

03 FastJson 解决循环引用

Convert IP address to int

开学实验里要用到mysql,忘记基本的select语句怎么玩啦?补救来啦~

el-table X轴方向(横向)滚动条默认滑到右边
随机推荐
【顺利毕业】[1]-游览 [学生管理信息系统]
顺利毕业[3]-博客系统 更新中。。。
IDEA远程断点调试jar包项目
2020-08-23
开学实验里要用到mysql,忘记基本的select语句怎么玩啦?补救来啦~
Project cost management__ Cost management technology__ Article 6 prediction
Of course, the most widely used 8-bit single chip microcomputer is also the single chip microcomputer that beginners are most easy to learn
(2)接口中新增的方法
万字手撕七大排序(代码+动图演示)
Stm32f407 key interrupt
Code word in NR
STM32 external interrupt experiment
顺利毕业[2]-学生健康管理系统 功能开发中。。。
Project scope management__ Scope management plan and scope specification
Not many people can finally bring their interests to college graduation
[male nanny style] teach you to open the first wechat applet
MYSQL数据库底层基础专栏
UCI and data multiplexing are transmitted on Pusch - placement of data and UCI positions (Part III)
Process communication - semaphore
There is no shortcut to learning and development, and there is almost no situation that you can learn faster by leading the way