Embedded System

 

 

 

 

Interrupt

 

If you first get into the world of computer (or microcontroller) as programmer, one of the words that you hear most often but very confusing would the word 'interrupt'. It would be even more frustrating because everybody knows what 'interrupt' means in our daily talk, but can't make any clear sense when they are talking in computer things.

 

Let's first think of what 'interrupt' means in our daily talk. Followings are two definition from dictionary.

  • Stop something from happening for a short period (http://dictionary.cambridge.org/dictionary/english/interrupt)
  • Stop the continuous progress of (an activity or process) (https://en.oxforddictionaries.com/definition/interrupt)

Actually the term 'Interrupt' in computer (Microcontroller) is not so much different from those definitions listed above.

 

Just adding and tweaking a couple of words from the above definitions would give pretty good definition on 'Interrupt' in computer / microcontroller.

 

Interrupt is a singnal (usually hardware signal) or event to stop 'CPU (microcontroller)' from doing current process for a short time.

 

Do you realized what is the biggest difference between the Interrupt in computer and the interrupt in our daily talk ?

 

Interrupt in our daily talk usually used as a 'verb', but Interrupt in computer is used as a 'noun'.  

 

Let me add a couple of words to make the definition more practical in terms of computer / microcontroller programming.

 

Interrupt is a singnal (usually hardware signal) or event to stop 'CPU (microcontroller)' from doing current process for a short time and execute a short/predefined procedure.

 

Now what you have to figure out is 'What is the singnal (usually hardware signal) or event ?'. In case of microcontroller, there are usually one or more pins specially assinged to handle this kind of signal. Any signal coming into this pin will function as 'Interrupt'. If you connect a small button to the special pin, an interrupt will be generated whenever you hit the button. If you connect a keypad to the pin, an interrupt will be raised whenever you press a key on the pad.  In some microcontroller, some event (e.g, the expiration of a specified Timer) can generate interrupt. As you see here, interrupt generation mechnically is mostly determined by chipset design. 'How many interrupt are supported ? or what kind of interrupts are supported ? ' are one of the most common / important factors for many embedded application. So you may find these information at the first page of the CPU / Microcontroller datasheet.

 

Now let's think of 'execute a short/predefined procedure'. In microcontroller (CPU), it is designed to execute a specific procedure when the interrupt happens. This specific procedure is called 'Interrupt Vector' or 'Intterrupt Handler' and most of the interrupt vector is supposed to written by user (the programmer).

 

Reference :

 

[1]