1.2.14 1.3.14 1.4.12 1.5.13 1.6.15 1.7.16 1.8.12 1.9.13 1.29.14 1.30.9 1.31.9 1.32.15 1.33.9 1.34.9 1.35.7 1.36.10 1.37.9 1.38.12 1.39.9 1.40.12 1.41.11 1.42.9 Nested Vectored Interrupt Controller (NVIC)
The Nested Vectored Interrupt Controller (NVIC) supports:
-
Tightly coupled interrupt controller provides low interrupt latency
-
An implementation-defined number of interrupts, in the range 1-240 interrupts
-
A programmable priority level for each interrupt. A higher level corresponds to a lower priority, so level 0 is the highest interrupt priority.
-
Supports Vectored interrupt where each interrupt has its own vector stored in a vector table
-
Relocatable Vector table defines the entry address of the processor exceptions and the peripheral interrupts to automatically service the required exception or interrupt
-
Non-Maskable Interrupt
-
Software interrupt generation
-
The processor automatically stacks its state on exception entry and unstacks this state on exception exit, with no instruction overhead. This provides low latency exception handling.
The example code below demonstrates how to Disable global interrupts and then restore based on saved state.
bool intState = NVIC_INT_Disable(); NVIC_INT_Restore(intState);
Using The Library
The NVIC peripheral library initializes interrupt controller as configured by the user in the MHC. The user can enable interrupt, configure priority and specify the interrupt vector name.
Library Interface
Nested Vectored Interrupt Controller peripheral library provides the following interfaces:
Functions
Name | Description |
---|---|
NVIC_Initialize | Initializes interrupt controller (NVIC) module of the device |
NVIC_INT_Enable | Enables all global interrupts |
NVIC_INT_Disable | Disables all global interrupts and returns PRIMASK bit status |
NVIC_INT_Restore | Enables or Disables all global interrupts based on PRIMASK bit state |