Interrupt handeling problem

Status
Not open for further replies.

Kryten

New Member
Hi

Im having dificulties compiling this code. It halts on the red section...

I thought I had it right
Code:
#pragma interrupt YourHighPriorityISRCode
void YourHighPriorityISRCode ()
{
	if(PIRbits.TMR1IF == TRUE)                  // check interrupt flag from timer0
	{
		if(PORTbits.RB5 == 0)
			{
			TMR1H = (timerServo & 0xFF00) >> 8; // Keep MSB
			TMR1L = timerServo & 0x00FF;        // Keep LSB
			PORTBbits.RB5 = 1;                   // high pulse
			}
		else
			{
			TMR1H = 0x8A                       // Timer interups after 83.3ns*8*(65536-35536) = +/- 20 ms
			[COLOR="Red"]PORTBbits.B5 = 0;[/COLOR]                  // low pulse
			}
		PIR1bits.TMR1IF = FALSE;               //reenable TMR1 interrupt
	}	
}

#pragma interruptlow YourLowPriorityISRCode
void YourLowPriorityISRCode()
{
}
This is part of Dwengo turtorial for light tracking servo
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…