当前位置:网站首页>STM32 --- NVIC interrupt
STM32 --- NVIC interrupt
2022-07-05 08:15:00 【chen_ bx】
STM32---NVIC interrupt
brief introduction
CM3 The kernel support 256 A break , Which includes 16 Kernel interrupts and 240 External interrupts , And have 256 The programmable interrupt settings of the .STM32 Not used CM3 Everything about the kernel , It's just a part of it .STM32 Yes 84 A break , Include 16 Kernel interrupts and 68 Maskable interrupts , have 16 Level programmable interrupt priority .
STM32F103 Above the series , It's just 60 Maskable interrupts ( stay 107 The series has 68 individual )


preemption & Response priority difference :
High priority preemption priority can interrupt the ongoing low preemption priority interrupt .
Preempt interrupts of the same priority , A high response priority cannot interrupt a low response priority interrupt .
Preempt interrupts of the same priority , When two interrupts occur at the same time , Which response has the highest priority , Which comes first .
If the preemption priority and response priority of two interrupts are the same , It depends on which interrupt occurs first ;
Interrupt parameter initialization function
void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);
The structure is as follows
typedef struct
{
uint8_t NVIC_IRQChannel; // Set interrupt channel
uint8_t NVIC_IRQChannelPreemptionPriority;// Set response priority
uint8_t NVIC_IRQChannelSubPriority; // Set preemption priority
FunctionalState NVIC_IRQChannelCmd; // Can make / Can make
} NVIC_InitTypeDef;
Initialize instance
NVIC_InitTypeDef NVIC_InitStructure;
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
Interrupt priority setting steps
① After the system is running, set the interrupt priority group first . Call function :
void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup);
During the execution of the whole system , Set interrupt packet only once .
② For each interrupt , Set the corresponding preemption priority and response priority :
void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);
③ If you need to suspend / Jie hang , View the current activation status of the interrupt , Call related functions respectively .
边栏推荐
- Programming knowledge -- assembly knowledge
- 2021-10-28
- Shell脚本基本语法
- Consul installation
- MySQL之MHA高可用集群
- Summary of SIM card circuit knowledge
- Screen record of the opening ceremony of the Beijing winter olympics 2
- 【云原生 | 从零开始学Kubernetes】三、Kubernetes集群管理工具kubectl
- Semiconductor devices (I) PN junction
- C # joint configuration with Halcon
猜你喜欢

Design a clock frequency division circuit that can be switched arbitrarily

After installing the new version of keil5 or upgrading the JLINK firmware, you will always be prompted about the firmware update

Summary of SIM card circuit knowledge

UEFI development learning 6 - creation of protocol

Hardware 3 -- function of voltage follower

Drive LED -- GPIO control
![Correlation based template matching based on Halcon learning [II] find_ ncc_ model_ defocused_ precision. hdev](/img/42/d857452ccfeccbbf1ac34f47e47e2e.jpg)
Correlation based template matching based on Halcon learning [II] find_ ncc_ model_ defocused_ precision. hdev
![Shape template matching based on Halcon learning [v] find_ cocoa_ packages_ max_ deformation. Hdev routine](/img/a1/d13b37955b044b6be5f1fd10263c5e.jpg)
Shape template matching based on Halcon learning [v] find_ cocoa_ packages_ max_ deformation. Hdev routine

Interview catalogue

Circleq of linked list
随机推荐
Improve lighting C program
[tutorial 19 of trio basic from introduction to proficiency] detailed introduction of trio as a slave station connecting to the third-party bus (anybus PROFIBUS DP...)
C WinForm [exit application] - practice 3
Installation and use of libjpeg and ligpng
Design a clock frequency division circuit that can be switched arbitrarily
Classic application of MOS transistor circuit design (1) -iic bidirectional level shift
Matlab2018b problem solving when installing embedded coder support package for stmicroelectronic
Process communication mode between different hosts -- socket
FIO测试硬盘性能参数和实例详细总结(附源码)
General makefile (I) single C language compilation template
[trio basic from introduction to mastery tutorial XIV] trio realizes unit axis multi-color code capture
Keil use details -- magic wand
Problem solving: interpreter error: no file or directory
Imx6ull bare metal development learning 1-assembly lit LED
Google sitemap files for rails Projects - Google sitemap files for rails projects
Drive LED -- GPIO control
Halcon's practice based on shape template matching [2]
Relationship between line voltage and phase voltage, line current and phase current
MySQL之MHA高可用集群
Brief discussion on Buck buck circuit