Pumpkin, Inc.

Pumpkin User Forums

Infinite Loop in ISR.C

If you can't make Salvo do what you want it to do, post it here.

Infinite Loop in ISR.C

Postby jmles » Thu Feb 01, 2007 7:46 am

I'm writing a program with two tasks, I signal a Message Queue from one to the other one, sometimes it works well, but sometimes when I'm simulating the program, when it reaches the OS_WaitMsgQ line it enters an infinite loop in that line of code. When I stop the simulation I can see it is executing the IntVectorHigh routine once and once again and it never finishes, this routine is in the ISR.C file(line 55 of this code). Why? Why sometimes happens and sometimes don't?
jmles
 
Posts: 3
Joined: Thu Feb 01, 2007 12:00 am

Re: Infinite Loop in ISR.C

Postby jmles » Thu Feb 01, 2007 7:52 am

I'm using PIC18F452, how can I clear the source of the interrupt? I've noticed that if I declar the variables which contains the message I'm gonna signal like a static variable the amount of times it enters that infinite loop decrements. I don't know if it is simply my impresion or it is true. What can you tell me about it? when should I declare a variable like static in Salvo RTOS?
jmles
 
Posts: 3
Joined: Thu Feb 01, 2007 12:00 am

Re: Infinite Loop in ISR.C

Postby aek » Thu Feb 01, 2007 8:50 am

That sounds like you are failing to clear the source of the interrupt, which results in the code re-entering the ISR immediately upon exiting the ISR, since the source of the interrupt is still present.

You didn't mention which processor + compiler you are using. Some processors (e.g. MSP430) automatically clear the source of the interrupt, others (e.g. PIC) do not and require an explicit clearing.

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: Infinite Loop in ISR.C

Postby aek » Fri Feb 02, 2007 1:07 am

Which compiler?

With MPLAB-C18 + Salvo, all local variables (i.e. the auto variables ina task) must be static.

Review the PIC18 datasheets for how to clear the source of an interrupt. It's usually the IF (interrupt flag) associated with the peripheral.

------------------

[This message has been edited by aek (edited February 02, 2007).]

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm


Return to Coding

Who is online

Users browsing this forum: No registered users and 1 guest

cron