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

GPIO interrupt

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



Joined: 16 Nov 2004
Posts: 8

View user's profile Send private message

GPIO interrupt
PostPosted: Thu Jun 16, 2005 12:03 pm     Reply with quote

Hello everyone,
I am using PIC 12F675.I need the PIC to wake up from sleep by a GPIO interrupt on GP0.
I used the directive #INT_RA0.
I saw its defined in the 12f675.h header file.
But I get an error, when I compile saying "INVALID PREPROCESSOR DIRECTIVE".
I would like to know, what is wrong in the code
Code:

#INT_RA0
interrupt_handle()
{
static int data;
if(data==0x30){
data=0x31;
}
else {
data=0x30;
}
}

// MAIN PROGRAM
void main()
{
   init();
   enable_interrupts(GLOBAL);
   enable_interrupts(INT_RA0);
   while(1)
   {
   SLEEP();
   delay_ms(100);
   }
}

Aslo, I saw an INT_RB directive in the 12f675.h header file.
Since, there is only one GPIO port, I dont know, what is the purpose of INT_RB.
And also, I would like to know, how the interrupts are defined in the header file, I tried to figure it out but I could'nt . It be really helpful, if somebody can help me on this issue.
Thanks
cartic
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 16, 2005 12:08 pm     Reply with quote

See my post which explains how to use INT_RA0, etc.:
http://www.ccsinfo.com/forum/viewtopic.php?t=4352&highlight=intra0

See these posts by Ttelmah which explain more:
http://www.ccsinfo.com/forum/viewtopic.php?t=21564&highlight=intra0
http://www.ccsinfo.com/forum/viewtopic.php?t=21440&highlight=intra0
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