Thursday, November 6, 2008

Getting started with pic16f877a interrupt programming .

What is an interrupt and why do we need an interrupt in PIC16F877A ?


This is the second tutorial in the series of "Mastering PIC16f877A programming " .

Without interrupts you would have to do loops in order to check if one or another event occurred. This routine checking is called as polling .Polling has disadvantages like consuming valuable microcontroller resources and time . These resources may be used for other data processing tasks. This is why microcontroller comes with built in interrupt support. Instead of checking events microcontroller has ability to interrupt normal program flow on event and jump to interrupt service subroutine(ISR) .

Imagine the ISR as a function in the program and the interrupt source as a event that calls the function .

During interrupt microcontroller stops the task at current point, saves necessary information to stack and gives resources to interrupt subroutine. When interrupt subroutine finishes, and then normal program flow continues .And more over priorities can be set in the interrupts and it can be masked according to your needs .

Here is the famous telephone conversation example for interrupts .

Suppose you are sitting at home, chatting to someone. Suddenly the telephone rings. You stop chatting, and pick up the telephone to speak to the caller. When you have finished your telephone conversation, you go back to chatting to the person before the telephone rang. You can think of the main routine as you chatting to someone, the telephone ringing causes you to interrupt your chatting, and the interrupt routine is the process of talking on the telephone. When the telephone conversation has ended, you then go back to your main routine of chatting.
(read more) .

Before Moving on lets see some interrupt constraints .

INTERRUPT CONSTRAINTS
Usually when an interrupt source is ready it sends a signal to microcontroller saying that it is ready to be serviced.But this signal which is sent by the source must occur in a timely manner or else it may cause malfunction.Usually interrupt source must be initialized considering two important parameters:

1.Minimum time interval between interrupts from the source .ie(The next interrupt should not occur before the interrupt service routine is processed for the previous)
2.Maximum time it takes the microcontroller to execute interrupt service subroutine .

So lets see how to configure the registers in the next tutorial .And another information for those who are wondering what registers are ? .
Registers are something like memories that are built inside a PIC by means of which you tell the microcontroller how it should set the pins or interrupts or timers or anyother peripherals .Its what you use to make the initial settings .

Lets move on to the next tutorial about the register configuration .
There are totally 5 registers so I've broken the tutorials into 4 parts for easy reading .You can follow to the next tutorial by clicking the link below .

2 comments:

Anonymous said...

[url=http://vegasonlines.net/odawa-casino-petoskey.html]vegas tower casino [/url]
[url=http://vegasonlines.net/paradise-island-casino.html]mirage vegas casino [/url]
[url=http://vegasonlines.net/akwesasne-mohawk-casino.html]online casino gaming [/url]
[url=http://vegasonlines.net/casino-buffet.html]las vegas casino [/url]
[url=http://fortheloveofthecode.com/members/casino_2D00_gamblings_2D00_online.aspx]casino ganar en las maquina [/url]
[url=http://vegasonlines.net/hollywood-casino-resort.html]best casino http united states grandcasino com [/url]
[url=http://vegasonlines.net/presque-isle-casino.html]japanese casino http pachinkoplay com [/url]
[url=http://saintlouisblack.com/saintlouisblack/members/online_2D00_casino.aspx]best online casino directory [/url]
[url=http://vegasonlines.net/request-for-qualifications-casino.html]casinos online poker [/url]
[url=http://vegasonlines.net/rising-sun-casino.html]internet casino review [/url]
[url=http://vegasonlines.net/casino-lounge.html]juegos de casinos gratuitos para bajar [/url]
[url=http://vegasonlines.net/three-rivers-casino.html]bueno aire casino puerto madero [/url]
[url=http://vegasonlines.net/online-casino-sign-up.html]mississippi river casino boat [/url]
[url=http://vegasonlines.net/casino-scottsdale-arizona.html]grupo cotizacion casino madrid [/url]
[url=http://vegasonlines.net/hampton-casino.html]juego casino mendoza [/url]
reno atlantis casino resort spa
[b]online casino portal[/b]
casino tigre argentina
custom casino chip
[b]vegas tower casino[/b]
casino 555
[u]betting casino gambling sport uk[/u]
fallsview casino resort
concurso publico casino bilbao
[b]apuesta casino virtual[/b]
apuesta online jugar keno juego casino
casino player

Unknown said...

This is why microcontroller comes with built in interrupt support Instead of checking events microcontroller has ability to interrupt normal program flow on event and jump to interrupt service subroutine. William