当前位置:网站首页>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
边栏推荐
- 对于新入行的同学,如果你完全没有接触单片机,建议51单片机入门
- Oracle数据库 SQL语句执行计划、语句跟踪与优化实例
- STM32 port multiplexing and remapping
- PIP references domestic sources
- GPIO port details, Hal library operation keys
- MYSQL数据库底层基础专栏
- SSB Introduction (PbCH and DMRs need to be supplemented)
- UCI and data multiplexing are transmitted on Pusch - Part I
- Raspberry pie installation SciPy
- Code word in NR
猜你喜欢

Schematic diagram and connection method of six pin self-locking switch

Happy Dragon Boat Festival—— Zongzi written by canvas~~~~~
![顺利毕业[3]-博客系统 更新中。。。](/img/91/72cdea3eb3f61315595330d2c9016d.png)
顺利毕业[3]-博客系统 更新中。。。
![[combinatorics] Introduction to Combinatorics (combinatorial thought 2: mathematical induction | mathematical induction promotion | multiple induction thought)](/img/0e/dff6d3c6b7bf388bf71b0965533c25.jpg)
[combinatorics] Introduction to Combinatorics (combinatorial thought 2: mathematical induction | mathematical induction promotion | multiple induction thought)

PRACH --- originator

Development of electrical fire system

There is no shortcut to learning and development, and there is almost no situation that you can learn faster by leading the way

编程思想比任何都重要,不是比谁多会用几个函数而是比程序的理解

Runtime.getRuntime().gc() 和 Runtime.getRuntime().runFinalization() 的区别

The third paper of information system project manager in soft examination
随机推荐
Embedded systems are inherently flawed. Compared with the Internet, there are so many holes that it is simply difficult to walk away from
Comment la base de données mémoire joue - t - elle l'avantage de la mémoire?
[combinatorics] Introduction to Combinatorics (combinatorial thought 2: mathematical induction | mathematical induction promotion | multiple induction thought)
[male nanny style] teach you to open the first wechat applet
顺利毕业[2]-学生健康管理系统 功能开发中。。。
Quelle langue choisir pour programmer un micro - ordinateur à puce unique
el-table X轴方向(横向)滚动条默认滑到右边
Oracle database SQL statement execution plan, statement tracking and optimization instance
[CSDN] C1 training problem analysis_ Part IV_ Advanced web
QT qcombobox QSS style settings
Gpiof6, 7, 8 configuration
当你需要使用STM32某些功能,而51实现不了时, 那32自然不需要学
Introduction to chromium embedded framework (CEF)
Fundamentals of Electronic Technology (III)__ Chapter 6 combinational logic circuit
Intelligent home design and development
CEF download, compile project
Eight working modes of stm32gpio and chip naming rules
自动装箱与拆箱了解吗?原理是什么?
STM32 general timer 1s delay to realize LED flashing
For new students, if you have no contact with single-chip microcomputer, it is recommended to get started with 51 single-chip microcomputer