View previous topic :: View next topic |
Author |
Message |
gjs_rsdi
Joined: 06 Feb 2006 Posts: 468 Location: Bali
|
PIC12F629 interrupt RA (SOLVED) |
Posted: Wed Aug 23, 2017 5:36 am |
|
|
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: 19551
|
|
Posted: Wed Aug 23, 2017 6:51 am |
|
|
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
|
|
Posted: Wed Aug 23, 2017 3:22 pm |
|
|
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
|
|
Posted: Wed Aug 23, 2017 3:49 pm |
|
|
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
|
|
Posted: Wed Aug 23, 2017 4:46 pm |
|
|
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
|
|
Posted: Sat Aug 26, 2017 2:37 pm |
|
|
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
|
|
|
|