Setting up CCP1 interupt

Status
Not open for further replies.

chris414

New Member
I'm trying to set up an interupt to trigger when there is a falling edge on my CCP1 pin (I'm using a PIC18F4550). If I poll for the interupt bit to be set (just run a loop waiting for PIRbits. to go high) everything works. However when I try to use an ISR I get no response.

I am using one of microchip's application notes with USB, and they have a method called "YourHighPriorityISRCode()" which I am using (the comments are from microchip):

Code:
	//These are your actual interrupt handling routines.
	#pragma interrupt YourHighPriorityISRCode
	void YourHighPriorityISRCode()
	{

		if(PIR1bits.CCP1IF == 1){
			alpha = 1;
			PIR1bits.CCP1IF = 0;
		}

		//Check which interrupt flag caused the interrupt.
		//Service the interrupt
		//Clear the interrupt flag
		//Etc.
        #if defined(USB_INTERRUPT)
	        USBDeviceTasks();
        #endif


	
	}	//This return will be a "retfie fast", since this is in a #pragma interrupt section

Anyway ideas why it's not working? I've tried adding an "else" statement which by my understanding should have been triggered every time an interrupt was received, but I got nothing.
 
Nevermind I got it working - for some reason high priority interupts weren't enabled in the INTCON register
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…