EmbeddedRelated.com
Forums
Memfault Beyond the Launch

low VS high priority interrupt routines

Started by Vecheslav Silagadze March 7, 2005

I've setup two interrupt routines. One for a timer and one for I2C.
It seems both are sent to the high priority vector even though I
setup the I2C as low priority.

here's the relevant part of the code

//Configure interrupts
INTCON2bits.TMR0IP = 1; //set timer0 interrupt at high priority
IPR1bits.TMR1IP = 1; //set timer1 interrupt at high priority
PIE1bits.SSPIE = 1; //enable MSSP interrupts
IPR1bits.SSPIP = 0; //set MSSP interrupt as low priority
INTCONbits.GIE = 1; //global interrupts enable

can anyone help me out here?




Re: low VS high priority interrupt routines

Oh, I should mention the chip is PIC18F458 and the high vector is
0x08, and the low vector is 0x18

--- In , "Vecheslav Silagadze"
<uwobjectivist@h...> wrote:
>
> I've setup two interrupt routines. One for a timer and one for I2C.
> It seems both are sent to the high priority vector even though I
> setup the I2C as low priority.
>
> here's the relevant part of the code
>
> //Configure interrupts
> INTCON2bits.TMR0IP = 1; //set timer0 interrupt at high priority
> IPR1bits.TMR1IP = 1; //set timer1 interrupt at high priority
> PIE1bits.SSPIE = 1; //enable MSSP interrupts
> IPR1bits.SSPIP = 0; //set MSSP interrupt as low priority
> INTCONbits.GIE = 1; //global interrupts enable
>
> can anyone help me out here?




--- In , "Vecheslav Silagadze"
<uwobjectivist@h...> wrote:
>
> Oh, I should mention the chip is PIC18F458 and the high vector is
> 0x08, and the low vector is 0x18
>
> --- In , "Vecheslav Silagadze"
> <uwobjectivist@h...> wrote:
> >
> > I've setup two interrupt routines. One for a timer and one for
I2C.
> > It seems both are sent to the high priority vector even though I
> > setup the I2C as low priority.
> >
> > here's the relevant part of the code
> >
> > //Configure interrupts
> > INTCON2bits.TMR0IP = 1; //set timer0 interrupt at high priority
> > IPR1bits.TMR1IP = 1; //set timer1 interrupt at high priority
> > PIE1bits.SSPIE = 1; //enable MSSP interrupts
> > IPR1bits.SSPIP = 0; //set MSSP interrupt as low priority
> > INTCONbits.GIE = 1; //global interrupts enable
> >
> > can anyone help me out here?

You need to set the IPEN bit in the RCON REGISTER to
enable interrupt priority levels.



In that vector you need polling to find out which device caused the interrupt.

john wrote:

 
--- In p...@yahoogroups.com, "Vecheslav Silagadze"
<uwobjectivist@h...> wrote:
>
> Oh, I should mention the chip is PIC18F458 and the high vector is
> 0x08, and the low vector is 0x18
>
> --- In p...@yahoogroups.com, "Vecheslav Silagadze"
> <uwobjectivist@h...> wrote:
> >
> > I've setup two interrupt routines. One for a timer and one for
I2C.
> > It seems both are sent to the high priority vector even though I
> > setup the I2C as low priority.
> >
> > here's the relevant part of the code
> >
> > //Configure interrupts
> > INTCON2bits.TMR0IP = 1; //set timer0 interrupt at high priority
> > IPR1bits.TMR1IP = 1; //set timer1 interrupt at high priority
> > PIE1bits.SSPIE = 1; //enable MSSP interrupts
> > IPR1bits.SSPIP = 0; //set MSSP interrupt as low priority
> > INTCONbits.GIE = 1; //global interrupts enable
> >
> > can anyone help me out here?

You need to set the IPEN bit in the RCON REGISTER to
enable interrupt priority levels.
 
 
 
 

to unsubscribe, go to http://www.yahoogroups.com and follow the instructions
 

--
*******************************************
VISIT MY HOME PAGE:
<http://home.online.no/~eikarlse/index.htm>
LAST UPDATED: 23/08/2003
*******************************************
Regards
Eirik Karlsen
 

Attachment (not stored)
C:\DOCUME~1\ek\LOKALE~1\Temp\nsmailPU.gif
Type: image/gif

Attachment (not stored)
C:\DOCUME~1\ek\LOKALE~1\Temp\nsmail0T.gif
Type: image/gif


> You need to set the IPEN bit in the RCON REGISTER to
> enable interrupt priority levels.

Ah! I knew there was something I was forgetting. Thanks, I'm sure it
will fix things.




--- In , Eirik Karlsen <eikarlse@o...> wrote:
> In that vector you need polling to find out which device caused the
> interrupt.
>

Well, that's the way I was doing it before, but having different
priority interrupts has the benefit that you don't have to do that
anymore (unless you have multiple sources for the same priority,
which I don't.)



 
 
Hi
I'm programming a PIC18F452 microcontroller, using CCS C Compiler. I have to regulate the interrupt levels of external interrupt 0,1,2 and timer 0 interrupt. Timer0 interrupt will be  the lowest one and external interrupt 2 is the highest one. The high level interrupt vector is at 000008h and low priority interrupt vector is at 000018h. Can anyone give some information about how can i set priority levels of interrupts with C language.
Thanks!
 
 

Send instant messages to your online friends http://uk.messenger.yahoo.com


Memfault Beyond the Launch