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.

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.

Latest threads

Back
Top