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

PIC12F629 interrupt RA (SOLVED)

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



Joined: 06 Feb 2006
Posts: 468
Location: Bali

View user's profile Send private message Send e-mail

PIC12F629 interrupt RA (SOLVED)
PostPosted: Wed Aug 23, 2017 5:36 am     Reply with quote

Hi

CCS PCM C Compiler, Version 5.062, xxxxx
I have an understanding problem regarding the RA interrupt.
In the PIC12F629 Header File is written:
Code:

#define INT_RA                    0x00FF0B08
#define INT_RA0                   0x0010B08
#define INT_RA1                   0x0020B08
#define INT_RA2                   0x0040B08
#define INT_RA3                   0x0080B08
#define INT_RA4                   0x0100B08
#define INT_RA5                   0x0200B08

Using:
Code:
#INT_RA
void  RA_isr(void)
{}

Everything works fine.
But if I am trying:
Code:
#INT_RA4
void  RA4_isr(void)
{}

I am getting (when compiling):
Quote:
Error 7: Invalid Pre-Processor directive

Maybe I understand wrong the header file or doing something else wrong.
Will appreciate an explanation.

Best wishes
Joe


Last edited by gjs_rsdi on Thu Aug 31, 2017 6:26 am; edited 1 time in total
Ttelmah



Joined: 11 Mar 2010
Posts: 19433

View user's profile Send private message

PostPosted: Wed Aug 23, 2017 6:51 am     Reply with quote

OK.
This is one of those 'needs explaining' bits....

There is only actually one RA interrupt. INT_RA.

What there is is a separate 'mask' that allows you to specify which RA pins will trigger the interrupt.

enable_interrupts(INT_RA4);

enables INT_RA, and sets the mask so that only the RA4 bit will trigger the interrupt.

The handler needs to always just be for INT_RA.

There is an example of doing this with a chip that has similar programmable interrupts for portA and portB, in ex_sk_rotary_encoder_isr.c, where the code enables INT_RB7 and INT_RB4, then just has a single handler for this interrupt and tests in the handler what bit has triggered the call.
gjs_rsdi



Joined: 06 Feb 2006
Posts: 468
Location: Bali

View user's profile Send private message Send e-mail

PostPosted: Wed Aug 23, 2017 3:22 pm     Reply with quote

Thanks Ttelmah for the prompt answer.

I understand now how it works.
I would like to read the:
ex_sk_rotary_encoder_isr.c
to understand how to do that, but can't find the file in the CCS Examples on my computer, not in CCS Help (in MPLB), also not by a forum search (except your post)
Could you tell me where to find this file?

Best wishes
Joe
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Aug 23, 2017 3:49 pm     Reply with quote

gjs_rsdi wrote:

CCS PCM C Compiler, Version 5.062

I would like to read the: ex_sk_rotary_encoder_isr.c
but can't find the file in the CCS Examples on my compute

I think you just missed it. Based on the date of the file, I think it
first came with vs. 5.063.
gjs_rsdi



Joined: 06 Feb 2006
Posts: 468
Location: Bali

View user's profile Send private message Send e-mail

PostPosted: Wed Aug 23, 2017 4:46 pm     Reply with quote

Thank you for the answer PCM programmer.
I will ask from CCS to send me by email, hope they will do.

Best wishes
Joe
gjs_rsdi



Joined: 06 Feb 2006
Posts: 468
Location: Bali

View user's profile Send private message Send e-mail

PostPosted: Sat Aug 26, 2017 2:37 pm     Reply with quote

Hi

I got the file from CCS by email.
Will post again on the topic if I have some understanding problem.
Thanks again for the help.

Best wishes
Joe
gjs_rsdi



Joined: 06 Feb 2006
Posts: 468
Location: Bali

View user's profile Send private message Send e-mail

PostPosted: Mon Aug 28, 2017 5:45 am     Reply with quote

Hi

By the end, as I have 2 interrupts on change, I am using just the INT_RA.
I have an additional understanding problem not connected to this one so I made a new topic.
https://www.ccsinfo.com/forum/viewtopic.php?p=214213#214213

Best wishes
Joe
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