You are on page 1of 6

Interrupts

HRO, Timisoara, February 2012

F-7761EN_C (2011-06)

Interrupts

Microcontrollers must provide real time (predictable, though not necessarily fast)

response to events in the embedded system they are controlling. When certain events
occur, an interrupt system can signal the processor to suspend processing the current
instruction sequence and to begin an interrupt service routine (ISR, or "interrupt
handler"). The ISR will perform any processing required based on the source of the
interrupt before returning to the original instruction sequence. Possible interrupt
sources are device dependent, and often include events such as an internal timer
overflow, completing an analog to digital conversion, a logic level change on an input
such as from a button being pressed, and data received on a communication link.
Where power consumption is important as in battery operated devices, interrupts may
also wake a microcontroller from a low power sleep state where the processor is
halted until required to do something by a peripheral event.

Analog to Digital Converter| Craciun G.| HRO | Timisoara, January 2012

What is an Interrupt

A interrupt is a signal that stops the current program forcing it to execute another

program immediately
An asynchronous signal indicating the need for attention or a synchronous event in

software indicating the need for a change in execution.


The processor must save its state of execution and begin execution of an interrupt

handler.
Types of interrupts:

Maskable interrupts
Non maskable interrupts
Software interrupts
Spurious interrupt
Interrupt sources: pin edges, ADC completed, Serial Rx data received, timer overflow

Reset, POR and LVI| Craciun C.| HRO | Timisoara, February 2012

Interrupt Service Routine

Is a routine in the programmed software, operating system or device driver whose

execution is triggered by the reception of an interrupt


Each interrupt has associated an interrupt service routine
Link between interrupt and interrupt service routine is normaly done through the

Interrupt Vector Table


The Interrupt Vector Table is an array (vector) of addresses that point to the interrupt

service routine
Each interrupt has an entry in the Interrupt Vector Table

Analog to Digital Converter| Craciun G.| HRO | Timisoara, January 2012

Interrupt ISR Vector Table

Analog to Digital Converter| Craciun G.| HRO | Timisoara, January 2012

Interrupts on 78K0R

Types: Maskable Interrupts and Software Interrupt (BRK)


64 entries in Interrupt Vector Table (address:0x0000 0x007F, 61 max used)
4 priorities, nesting allowed
IAR Compiler:
Association between interrupts and ISRs can be done:

by pragma directives
#pragma vector =
- Assigns a vector from the Interrupt Vector Table to the following function
__interrupt
- Makes a function to be treated as an interrupt

Dirrect writing in the Interrupt Vector Table

Analog to Digital Converter| Craciun G.| HRO | Timisoara, January 2012

You might also like