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 interrupts

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







12f675 interrupts
PostPosted: Mon Apr 28, 2003 5:43 pm     Reply with quote

I am trying to set up an interrupt on GP03. I have looked at the interrupts that are defined in the .h file and they look like this:
#define GLOBAL 0x0BC0
#define INT_RTCC 0x0B20
#define INT_RB 0x0B08
#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_RA0 0x010B08
#define INT_RA1 0x020B08
#define INT_RA2 0x040B08
#define INT_RA3 0x080B08
#define INT_RA4 0x100B08
#define INT_RA5 0x200B08


I can't make any sense of the INT_RA3 name or address. I assume that I need to use RA3 when the PIC actually calls them GPxx.

I could set them directly in INTCON and IOC, but I don't know what to use in the #INT_??? directive.

My requirement is to have a push button on pin 4. It has to be pin 4, because the other pins are used for either output or ADC. Any help or direction to documentation would be greatly appreciated.
___________________________
This message was ported from CCS's old forum
Original Post ID: 14034
Mike Broom
Guest







Re: 12f675 interrupts
PostPosted: Tue Apr 29, 2003 3:02 am     Reply with quote

You will use the:

#INT_RA3
void int_on_change_GP03 (void)
{
//INT HANDLER
}

And your initialisation would be:

enable_interrupts(INT_RA3);

mike

:=I am trying to set up an interrupt on GP03. I have looked at the interrupts that are defined in the .h file and they look like this:
:=#define GLOBAL 0x0BC0
:=#define INT_RTCC 0x0B20
:=#define INT_RB 0x0B08
:=#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_RA0 0x010B08
:=#define INT_RA1 0x020B08
:=#define INT_RA2 0x040B08
:=#define INT_RA3 0x080B08
:=#define INT_RA4 0x100B08
:=#define INT_RA5 0x200B08
:=
:=
:=I can't make any sense of the INT_RA3 name or address. I assume that I need to use RA3 when the PIC actually calls them GPxx.
:=
:=I could set them directly in INTCON and IOC, but I don't know what to use in the #INT_??? directive.
:=
:=My requirement is to have a push button on pin 4. It has to be pin 4, because the other pins are used for either output or ADC. Any help or direction to documentation would be greatly appreciated.
___________________________
This message was ported from CCS's old forum
Original Post ID: 14036
R.J.Hamlett
Guest







Re: 12f675 interrupts
PostPosted: Tue Apr 29, 2003 3:18 am     Reply with quote

:=I am trying to set up an interrupt on GP03. I have looked at the interrupts that are defined in the .h file and they look like this:
:=#define GLOBAL 0x0BC0
:=#define INT_RTCC 0x0B20
:=#define INT_RB 0x0B08
:=#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_RA0 0x010B08
:=#define INT_RA1 0x020B08
:=#define INT_RA2 0x040B08
:=#define INT_RA3 0x080B08
:=#define INT_RA4 0x100B08
:=#define INT_RA5 0x200B08
:=
:=
:=I can't make any sense of the INT_RA3 name or address. I assume that I need to use RA3 when the PIC actually calls them GPxx.
:=
:=I could set them directly in INTCON and IOC, but I don't know what to use in the #INT_??? directive.
:=
:=My requirement is to have a push button on pin 4. It has to be pin 4, because the other pins are used for either output or ADC. Any help or direction to documentation would be greatly appreciated.

Worth understanding here, that the 12 family chips, use a different naming convention from the rest of the PICs. On the 16, and 18 family, the ports are all referred to as port A, port B etc.. The 12 family chips, instead refer to them using the 'GP' name. The 67x, has the port register at the address used for 'port A' on the larger brethren, while the 508, puts the IO register at the address used for port B.
Why Microchip decided to call the ports 'GPIO' on the smaller chips, and port A, B etc., on the bigger chips, is really pretty inexplicable.
CCS C, uses the same names for these chips, so 'GPIO' is not used, instead these are addressed with the names used for the larger chips.
The answer to how this affects the name used for the interrupt routine, and addresses, has allready been posted.

Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 14039
TerryS
Guest







Re: 12f675 interrupts
PostPosted: Fri May 02, 2003 11:19 am     Reply with quote

:=You will use the:
:=
:=#INT_RA3
:=void int_on_change_GP03 (void)
:={
:=//INT HANDLER
:=}
:=
:=And your initialisation would be:
:=
:=enable_interrupts(INT_RA3);
:=
:=mike
:=
:=:=I am trying to set up an interrupt on GP03. I have looked at the interrupts that are defined in the .h file and they look like this:
:=:=#define GLOBAL 0x0BC0
:=:=#define INT_RTCC 0x0B20
:=:=#define INT_RB 0x0B08
:=:=#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_RA0 0x010B08
:=:=#define INT_RA1 0x020B08
:=:=#define INT_RA2 0x040B08
:=:=#define INT_RA3 0x080B08
:=:=#define INT_RA4 0x100B08
:=:=#define INT_RA5 0x200B08
:=:=
:=:=
:=:=I can't make any sense of the INT_RA3 name or address. I assume that I need to use RA3 when the PIC actually calls them GPxx.
:=:=
:=:=I could set them directly in INTCON and IOC, but I don't know what to use in the #INT_??? directive.
:=:=
:=:=My requirement is to have a push button on pin 4. It has to be pin 4, because the other pins are used for either output or ADC. Any help or direction to documentation would be greatly appreciated.


When I try to use the #int_ra5 directive, I get an "Invalid Preprocessor Directive" error from the compiler (PCM 3.155). I was able to get an interrupt to work using #int_rb for the interrupt definition, and enable_interrupts(int_RA5). I am using the GP5 pin. This results in an interrupt when the level on pin 5 changes (either low to high or high to low). My problem is, I would like to use the ext_int_edge(L_to_H) to only cause an interrupt on the rising edge of my signal (I am using a 12f629). Any thoughts on why #int_ra5 causes a compile error, or why the edge triggered interrupt won't work???
___________________________
This message was ported from CCS's old forum
Original Post ID: 14147
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: 12f675 interrupts
PostPosted: Fri May 02, 2003 9:13 pm     Reply with quote

:=
:=When I try to use the #int_ra5 directive, I get an "Invalid Preprocessor Directive" error from the compiler (PCM 3.155). I was able to get an interrupt to work using #int_rb for the interrupt definition, and enable_interrupts(int_RA5). I am using the GP5 pin. This results in an interrupt when the level on pin 5 changes (either low to high or high to low). My problem is, I would like to use the ext_int_edge(L_to_H) to only cause an interrupt on the rising edge of my signal (I am using a 12f629). Any thoughts on why #int_ra5 causes a compile error, or why the edge triggered interrupt won't work???
--------------------------------------------------------

It doesn't work because...it's not used that way.
The INT_RA0 through INT_RA5 constants are only used
as parameters with these two functions:

enable_interrupts();
disable_interrupts();

Example:
enable_interrupts(INT_RA0);
disable_interrupts(INT_RA0);

As you discovered, these interrupts are processed by
an interrupt service routine that is prefixed with #int_rb.
Example:

#int_rb
void int_rb_isr(void)
{
// Do something here to process the interrupt.

}

---------------

You said that you want to use an edge triggered interrupt,
and you want to specify the polarity of the edge.
To do that, you need to use the "External Interrupt".
In the 12F629, that's on pin GP2. You must use that pin.

So your isr would look like this:

#int_ext
void int_ext_isr()
{

// Do something to process the external interrupt.

}


And you would enable it like this, in main():

void main()
{

output_float(PIN_A2); // Make pin GP2 into an input
ext_int_edge(L_TO_H);
enable_interrupts(INT_EXT);
enable_interrupts(GLOBAL);

while(1);
}
___________________________
This message was ported from CCS's old forum
Original Post ID: 14160
TerryS
Guest







Re: 12f675 interrupts
PostPosted: Sat May 03, 2003 2:25 pm     Reply with quote

Thanks. I appreciate the help. It works fine with your suggestions.


___________________________
This message was ported from CCS's old forum
Original Post ID: 14162
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