🚀 Why Do MCUs Have Vector Tables?

When an interrupt or reset occurs, the CPU must quickly know which function to execute.
Instead of searching through code, MCUs use a Vector Table — a fixed memory table that stores the addresses of interrupt handlers.

Example (ARM Cortex-M):
C
void Reset_Handler(void);
void UART_IRQHandler(void);
void SysTick_Handler(void);
The vector table stores pointers to these handlers:

0x00000000 → Initial Stack Pointer  
0x00000004 → Reset_Handler  
0x00000008 → NMI_Handler  
0x0000000C → HardFault_Handler
...
When an interrupt occurs, the CPU simply reads the handler address from the vector table and jumps to it.
📌 Why this design?
• Instant interrupt response
• Simple hardware implementation
• Deterministic interrupt latency

💡 Key Insight
The vector table acts like a hardware lookup table that maps interrupts to their handlers.
#EmbeddedSystems #Firmware #Microcontrollers #ComputerArchitecture #WhySeries

Comments

Popular posts from this blog

Why Do Microcontrollers Start with an Internal Oscillator?

What Happens Inside a Microcontroller in the First Few Microseconds After Power-On?

Why RISC is ideal for embedded systems