Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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
 
lol Thanks for seeing that, I got kinda blind trying to figure out what was wrong ;)
:D :D
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top