MG32F157 Standard Peripherals Firmware Library
|
****************** (C) COPYRIGHT 2023 Megawin Technology ******************* * @file NVIC/NVIC_IRQ_Priority/readme.txt * @author Megawin Application Team * @version V0.0.4 * @date 16-June-2023 * @brief Description of the NVIC_IRQ_Priority example. ****************************************************************************** * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, MEGAWIN SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM * THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. ******************************************************************************
This example describes the use of the Nested Vectored Interrupt Controller (NVIC).
The system clock works at 96Mhz and is generated through PLL configuration. The PLL clock source is an external 8Mhz crystal oscillator. The frequency division ratio of APB1 is 2, and the frequency division ratio of APB2 is 1.
First, the PreemptionPriorityValue is equal to 0, the Wakeup button EXTI Line has higher preemption priority than the SysTick handler.
In the key button EXTI Line interrupt routine the Wakeup button EXTI Line and SysTick preemption priorities are inverted.
In the Wakeup button EXTI Line interrupt routine the pending bit of the SysTick interrupt is set this will cause SysTick ISR to preempt the Wakeup button EXTI Line ISR only if it has higher preemption priority.
The system behaves as following:
1) The first time Key button EXTI Line interrupt occurs the SysTick preemption become higher than Wakeup button EXTI Line one. So when the Wakeup button EXTI Line interrupt occurs, the SysTick ISR is executed and the PreemptionOccured variable become TRUE and led1 start toggling.
2)When the next Key button EXTI Line interrupt occurs the SysTick preemption become lower than Wakeup button EXTI Line one. So when the Wakeup button EXTI Line interrupt occurs, the PreemptionOccured variable became FALSE and led1 stop toggling.
In order to make the program work, you must do the following :
Run the example