当前位置:网站首页>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
边栏推荐
- Not many people can finally bring their interests to college graduation
- 2021-01-03
- The third paper of information system project manager in soft examination
- Getting started with shell programming
- SCM career development: those who can continue to do it have become great people. If they can't endure it, they will resign or change their careers
- 万字手撕七大排序(代码+动图演示)
- STM32 port multiplexing and remapping
- Notes on C language learning of migrant workers majoring in electronic information engineering
- Project cost management__ Cost management technology__ Article 6 prediction
- [keil5 debugging] warning:enumerated type mixed with other type
猜你喜欢
STM32 interrupt priority management
Gpiof6, 7, 8 configuration
Happy Dragon Boat Festival—— Zongzi written by canvas~~~~~
[CSDN]C1训练题解析_第二部分_Web基础
学历是一张通行证,门票,你有了它,可以踏入更高层次的环境里
【男保姆式】教你打开第一个微信小程序
JMX、MBean、MXBean、MBeanServer 入门
内存数据库究竟是如何发挥内存优势的?
Fundamentals of Electronic Technology (III)_ Chapter 2 principle of amplification circuit__ Crystal triode and field effect triode
开学实验里要用到mysql,忘记基本的select语句怎么玩啦?补救来啦~
随机推荐
要選擇那種語言為單片機編寫程序呢
For new students, if you have no contact with single-chip microcomputer, it is recommended to get started with 51 single-chip microcomputer
2021-09-26
UCI and data multiplexing are transmitted on Pusch (Part V) -- polar coding
內存數據庫究竟是如何發揮內存優勢的?
【男保姆式】教你打开第一个微信小程序
[successful graduation] [1] - visit [student management information system]
顺利毕业[2]-学生健康管理系统 功能开发中。。。
How does the nr-prach receiver detect the relationship between prembleid and Ta
Successful graduation [2] - student health management system function development...
Idea remote breakpoint debugging jar package project
STM32 external interrupt experiment
端午节快乐!—— canvas写的粽子~~~~~
[untitled] proteus simulation of traffic lights based on 89C51 Single Chip Microcomputer
Nr-prach: access scenario and access process
NR technology -- MIMO
Nr-prach:prach format and time-frequency domain
[male nanny style] teach you to open the first wechat applet
Project cost management__ Plan value_ Earned value_ Relationship among actual cost and Countermeasures
一个可执行的二进制文件包含的不仅仅是机器指令