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 problem with INT_RA

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








12f675 problem with INT_RA
PostPosted: Tue Nov 13, 2007 3:38 pm     Reply with quote

OK, here is the problem:
I`m programing a 12f675, and I need to simulate an interrupt when the start bit is at the A3 pin, because the program is too busy excecuting a lot of rutines, so it cannot take the time enougth to check the pin A3 again, and again in order to detect the change, so I'm using the chage state interrupt for the A3 pin.

The problem is tha the compiler shows me an error

i tried this:

enable_interrupts(INT_RA3);
enable_interrupts(INT_RB); << is this needed
enable_interrupts(GLOBAL);

at the main
and this

#INT_RA3 <-- but it says that it doesn't work, that this is not a valid interrupt

void RA3_isr(){


}

please help! Rolling Eyes

thanks!

pd.: this interrupt is general, or identifies witch pin changes?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Nov 13, 2007 3:48 pm     Reply with quote

See the sample code in this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=25589


If it doesn't work, then post your compiler version.
Guest








PostPosted: Tue Nov 13, 2007 5:31 pm     Reply with quote

ok.
the version is 3.180 (PCB)
then i just have to enable INT_R3 and use INT_RB.
does it work for pic12f675?

i hope! i'll try then!
thanks for asking! and if you have another suggest i'm lisening!!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Nov 13, 2007 6:13 pm     Reply with quote

Quote:
I`m programming a 12f675.
the version is 3.180 (PCB)

The 12F675 requires the PCM compiler. If it's compiling, then you have
PCM (not PCB).
Guest








PostPosted: Wed Nov 14, 2007 2:15 pm     Reply with quote

PCM, yes, you are right. Sorry about the mistake, but I still with the question, when I enable the interrupt INT_RA3, do I have to enable INT_RB?
Also, that interrupt will execute when detect a change on other pins, or only when changes pin A3?

Thanks for any suggestions. Very Happy
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Nov 14, 2007 3:13 pm     Reply with quote

Here's a demo program for INT_RA for your version of the compiler.
It has several "fixes" that are necessary for vs. 3.180.

This program toggles pin A2 in a while() loop in main. You have to
put a jumper between pins A2 and A3. Then pin A3 will receive the
square wave from pin A2. It will generate an interrupt on each edge
of the input square wave. The interrupt routine will then toggle pin A0
on every interrupt. So pin A0 will output a square wave at the same
frequency as the input on pin A3. You can look at it with an oscilloscope
and see this.
Code:

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

#byte ADCON0 = 0x1F
#bit GPIF = 0x0b.0
#byte PortA = 5

// Need to use INT_RB with vs. 3.180  (instead of INT_RA)
#INT_RB
void int_ra_isr(void)
{
char c;

output_toggle(PIN_A0);

c = PortA;   // Clear mismatch condition
}   

//===========================
void main()
{
int8 c;

setup_comparator(NC_NC);
ADCON0 = 0;   // Turn off ADC -- Needed for vs. 3.180

output_low(PIN_A0);
output_low(PIN_A2);

c = PortA;     // Clear mismatch condition
GPIF = 0;      // Clear INT_RA interrupt
enable_interrupts(INT_RA3);
enable_interrupts(GLOBAL);


while(1)
  {
   output_high(PIN_A2);
   delay_ms(50);
   output_low(PIN_A2);
   delay_ms(50);
  }

}
Guest








PostPosted: Wed Nov 14, 2007 6:39 pm     Reply with quote

I'll try with this then!
Thank you! Very Happy
Guest








PostPosted: Sun Nov 18, 2007 10:50 am     Reply with quote

Thank you a lot!
It works!
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