Introduction to Interrupt

What is the Interrupt?

What‘s the difference between polling and Interrupt?

Let ‘s take an example when you need to know if you have a phone call , you can know this using one of two ways :

1- Go to the telephone and pickup the handset to see if you have a phone call. You‘ll need to do this many times. And you will stop what you do every time.

2- Wait until the phone rings , then you go to it and pick up the hand-set.

Polling is like the first example and Interrupt is like the second example. You need to use interrupt in some applications. It sure decreases the load on the microcontroller and saves its time while doing another thing.

There are two types of interrupt: software and hardware interrupts.

In the following application, we will use Timer interrupt ( one of the Software interrupts ) which is initiated by the Timer0 overflow.

The timer is a free counting register that increments depending on the crystal oscillator speed and the prescaler settings. We can use the timer to calculate accurate time periods. And because we are using interrupt , we don ‘t have to keep track of time while we are doing another thing. In the following example , the main program functions to monitor a push button and displays a number on a 7 segment display. The number on the display indicates the period in seconds.

Without using interrupt, we would have to calculate the time of the period and taking the display time into account.

Here is the link for the project file and code.

Today, I revisited this page which contains many Microcontroller projects. This is the Cornell University Electrical Engineering students projects page. Many ideas can be found here.

2 thoughts on “Introduction to Interrupt

Leave a Reply

Your email address will not be published. Required fields are marked *