piclist 2001\02\07\101658a
>
Thread:
Return From Interrupt
www.piclist.com/techref/microchip/ints.htm?key=interrupt
BY
:
NDuckworth@spamBeGonesignam.co.uk email (remove spam text)
On Wednesday, February 07, 2001 2:07 PM, D Lloyd [SMTP:dan.lloydspamBeGone
RemoveMEGB.ABB.COM]
wrote:
> This may be daft but does the compiler allow you to call functions from
interrupts?
Yes, it's allowed, the following is a snippet of code which I know works.
Nigel
void interrupt ServiceIRQ(void)
{
byte temp;
BUSY = 1; // set busyflag to PC
if(T0IF) // 50mS wake-up interrupt
{
TMR0 = RELOAD;
IRQFlag = 1;
if(TPHWatchdogCounter) TPHWatchdogCounter--;
if(MotorWatchdogCounter) MotorWatchdogCounter--;
T0IF = 0; // clear interrupt flag bit
}
if(PSPIF) // PSP input & output interrupt
{
if(PSPIRQCounter < 255) PSPIRQCounter++;
PSPIF = 0; // clear interrupt flag bit
if(IBF) ServicePSP(); // if interrupt is a receive from PC
else (OBF) = 0; // clear output buffer flag
if(IBOV) // test input buffer overflow flag
{
temp = PORTD; // read extra character
IBOV = 0; // clear overflow flag
}
}
if(TMR1IF) // Timer 1 overflow interrupt
{
TMR1IF = 0; // clear interrupt flag
ServiceTimer1();
}
// IRQs with no reset in main loop?
if(PSPIRQCounter < 10) BUSY = 0; // clear busyflag to PC
}
--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics
<01C09117.634426E0.NDuckworth@signam.co.uk> 7bit
See also: www.piclist.com/techref/microchip/ints.htm?key=interrupt
Reply
You must be a member of the
piclist mailing list
(not only a www.piclist.com member) to post to the
piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
month overview.
new search...