CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Interrupt Not Working - 16F690 - CCP1 [solved]

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
buler



Joined: 27 Apr 2011
Posts: 10

View user's profile Send private message

Interrupt Not Working - 16F690 - CCP1 [solved]
PostPosted: Wed Apr 27, 2011 12:47 pm     Reply with quote

I have a pic eval board that has a couple leds on it and a pic 16F690. I have one led that is set to turn on and off in a continuous loop. I also have a wire going from that led to the capture pin on the 16f690 and am trying to catch the rising edges of the signal. To indicate it has found a rising edge I have it set to turn another LED on (until I get it to work I have it set to remain "ON").

However I am unable to get the LED to turn on (get pin C1 to output high).

Here is my code:
Code:
#include <16F690.h>
#fuses HS,NOWDT,NOPROTECT
#use delay(clock=20000000)

#INT_CCP1
void isr()
{
   output_high(pin_C1);
}


void main()
{
   setup_ccp1(CCP_CAPTURE_RE);
   enable_interrupts(INT_CCP1);
   
   while(TRUE){
   
   output_high(pin_C0);
   delay_ms(1000);
   output_low(pin_C0);
   delay_ms(1000);
   }
}


Last edited by buler on Wed Apr 27, 2011 2:05 pm; edited 1 time in total
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Apr 27, 2011 1:20 pm     Reply with quote

You don't have Global interrupts enabled. You need to add that line.
buler



Joined: 27 Apr 2011
Posts: 10

View user's profile Send private message

PostPosted: Wed Apr 27, 2011 1:45 pm     Reply with quote

PCM programmer wrote:
You don't have Global interrupts enabled. You need to add that line.


Thank you, I had that line in earlier but for some reason I had deleted it. It looks like my main reason (when that line of code was present) for this not working was because I was only supplying the board with 3.3V and by the time the signal was reaching the capture port it must have been too low to trigger anything.

I have supplied the board 5V and added in that line of code and it is working perfectly.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group