5.5.7 · D1 · HinglishEmbedded Systems & Real-Time Software

FoundationsInterrupts — ISR design, NVIC priority, interrupt latency

2,313 words11 min read↑ Read in English

5.5.7 · D1 · Coding › Embedded Systems & Real-Time Software › Interrupts — ISR design, NVIC priority, interrupt latency

Yeh page kuch bhi assume nahi karta. parent topic padhne se pehle, aapko uske har word aur symbol mein fluent hona chahiye. Hum har ek ko ek picture se build karte hain.


1. CPU actually kya kar raha hai (the moving finger)

Figure — Interrupts — ISR design, NVIC priority, interrupt latency

Normally finger bas aage badhti hai: address, address+1, address+2. Ek jump matlab finger achanak kisi alag address par land karti hai. Interrupt ek aisa jump hai jo hardware force karta hai, koi aapne likha nahi.


2. Registers — CPU ka tiny scratchpad

Figure — Interrupts — ISR design, NVIC priority, interrupt latency

3. Stack — jahan saved context park hota hai

Figure — Interrupts — ISR design, NVIC priority, interrupt latency
Recall LIFO kyun aur queue kyun nahi saved context ke liye?

Interrupts nest ho sakte hain (ek interrupt ke andar ek interrupt). Sabse recently interrupted context pehle resume hona chahiye — yeh exactly LIFO hai. Stack ke kis end ko push aur pop dono par touch kiya jata hai? ::: Top, dwara track kiya gaya.


4. Functions aur "jump and come back" pattern


5. Peripherals, flags, aur interrupt line


6. NVIC aur vector table — traffic controller

Figure — Interrupts — ISR design, NVIC priority, interrupt latency

7. Numbers jo aapko padhne aane chahiye: powers of two aur cycles


8. Masking — mute button


Prerequisite map

Program Counter - the moving finger

Jump and come back

Registers R0 to R12 LR xPSR

Saved context = 8 words

Stack and SP - LIFO parking

ISR - forced function call

Peripherals flags IRQ lines

NVIC controller

Vector table - address phone book

Powers of two 2 to the n

NVIC priority levels

Cycles and clock frequency

Interrupt latency

Masking and volatile

Safe shared variables

Interrupts topic


Equipment checklist

Khud test karo — agar koi bhi jawab fuzzy lage, toh parent note se pehle woh section dobara padho.

kya hold karta hai, aur interrupt ke dauran uske saath kya hota hai?
Current instruction ka address; hardware ise save karta hai aur ISR ka address load karta hai taaki finger jump kare.
Cortex-M ke 8 auto-stacked registers ke naam batao.
, , , , .
Saved context ke liye LIFO (stack) kyun aur queue kyun nahi?
Nested interrupts ko most-recently-interrupted pehle resume karna chahiye — Last In, First Out.
"Flag" kya hai aur ISR ko ise early kyun clear karna chahiye?
Peripheral status bit jo event record karta hai; clear na karne par woh IRQ baar baar assert hoti rehti hai → ISR bar bar re-enter karta hai.
Vector table kya map karta hai?
IRQ number → us interrupt ke ISR ka memory address.
implemented priority bits kitne levels dete hain?
total, split preempt × sub.
100 MHz par 12 cycles ko time mein convert karo.
.
volatile compiler ko kya force karta hai?
Variable ko register mein cache karne ki bajaye har access par memory se re-read karna.
Interrupts mask (disable) karna aapko kya deta hai, aur uski kya cost hai?
Shared data tak atomic access milti hai; cost hai added interrupt latency ().

Next: har symbol earn karne ke baad, parent topic padho. Related foundations jo aap saath rakhna chahein: Polling vs Interrupt-driven I/O, Concurrency & Race Conditions, Ring Buffers / FIFO Queues, ARM Cortex-M Architecture, Real-Time Scheduling & Deadlines, Power Management & Sleep Modes.