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

12F675 invalid preprocessor directive with INT_RA4

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



Joined: 14 Oct 2008
Posts: 103

View user's profile Send private message

12F675 invalid preprocessor directive with INT_RA4
PostPosted: Sat Aug 08, 2009 9:56 pm     Reply with quote

Hello guys, according to 12F675.h file there is a interrupt INT_RA4.
I tried to setup this interrupt but it gives me "invalid preprocesor
directive". What is the wrong? Here is my code part:
Code:

#INT_RA4

void int_on_change_A4 (void)
{
if(A4_int_mode==1)
{
led('r',2,50);
}
}


and used as

Code:
   enable_interrupts (INT_EXT);
   enable_interrupts(INT_RA4);// today
   disable_interrupts (INT_TIMER1);
   disable_interrupts (INT_TIMER0);
   enable_interrupts (GLOBAL);
   
   // TODO: USER CODE!!
   
   
   WHILE (1)
   {
      chk_ir ();

      if (first_INT_done == 1)
      {
         first_INT_done = 0;
         set_timer ();
      }
   }
}



and here is 12F675.h
Code:

////////////////////////////////////////////////////////////////// INT
// Interrupt Functions: ENABLE_INTERRUPTS(), DISABLE_INTERRUPTS(),
//                      CLEAR_INTERRUPT(), INTERRUPT_ACTIVE(),
//                      EXT_INT_EDGE()
//
// Constants used in EXT_INT_EDGE() are:
#define L_TO_H              0x40
#define H_TO_L                 0
// Constants used in ENABLE/DISABLE_INTERRUPTS() are:
#define GLOBAL                    0x0BC0
#define INT_RTCC                  0x0B20
#define INT_EXT                   0x0B10
#define INT_AD                    0x8C40
#define INT_TIMER1                0x8C01
#define INT_TIMER0                0x0B20
#define INT_EEPROM                0x8C80
#define INT_COMP                  0x8C08
#define INT_RA                    0xFF0B08
#define INT_RA0                   0x010B08
#define INT_RA1                   0x020B08
#define INT_RA2                   0x040B08
#define INT_RA3                   0x080B08
#define INT_RA4                   0x100B08
#define INT_RA5                   0x200B08
#list

thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Aug 08, 2009 10:37 pm     Reply with quote

Always post your compiler version. We don't remember it from previous
threads.
aruna1



Joined: 14 Oct 2008
Posts: 103

View user's profile Send private message

PostPosted: Sat Aug 08, 2009 11:11 pm     Reply with quote

version is 4.084
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Aug 08, 2009 11:52 pm     Reply with quote

Here is the explanation:
There is only one "interrupt on change" interrupt. It's called #INT_RA.
But, each pin (GP0-GP5) can be individually enabled for the interrupt-on-
change feature. So the interrupt routine itself will always only have
#INT_RA above it. But in your code, for the enable_interrupts() and
disable_interrupts() functions, you should use INT_RA0 to INT_RA5 as
the parameter. See the example below:
Code:

#include <12F675.h>
#fuses INTRC_IO, NOWDT, NOMCLR, PUT, BROWNOUT
#use delay(clock=4000000)

#int_ra
void int_ra_isr(void)
{
int8 temp;

temp = input(PIN_A4); // Read pin to clear mismatch condition

}

//======================
void main()
{
// There is only one "INT_RA" interrupt.  Clear it.
clear_interrupt(INT_RA);

// Enable interrupt-on-change for pin A4 only.
enable_interrupts(INT_RA4);

enable_interrupts(GLOBAL);

while(1);
}
aruna1



Joined: 14 Oct 2008
Posts: 103

View user's profile Send private message

PostPosted: Sun Aug 09, 2009 1:21 am     Reply with quote

So interrupt code will only run for changes in A4? and it will not run even other pins are changing?
Thanks

edit:
i just checked its working
thanks PCM
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