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 CCS Technical Support

INT_RAx with PIC 12F629 Problem

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







INT_RAx with PIC 12F629 Problem
PostPosted: Thu Jan 05, 2006 4:44 pm     Reply with quote

Hi,

I've got a problem on writing some simple code for the PIC 12F629. The 12F629.h file contains this:

////////////////////////////////////////////////////////////////// INT
// Interrupt Functions: ENABLE_INTERRUPTS(), DISABLE_INTERRUPTS(),
// 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
<b>#define INT_RB 0x0B08</b>
#define INT_EXT 0x0B10
#define INT_TIMER1 0x8C01
#define INT_TIMER0 0x0B20
#define INT_EEPROM 0x8C80
#define INT_COMP 0x8C08
<b>#define INT_RA0 0x010B08
#define INT_RA1 0x020B08
#define INT_RA2 0x040B08
#define INT_RA3 0x080B08
#define INT_RA4 0x100B08
#define INT_RA5 0x200B08</b>

Why is there a INT_RB? The 12F629 just has this GP-Port which seems to correspond to Port A in the CCS. At least I can switch the outputs by output_low(PIN_A3) for example.
But how can I use interrupts on let's say GP3 (or A3)?
<i>enable_interrupts(INT_RA3); </i>does not cause a problem but with
<i>#INT_RA3
void RB_isr(){
output_low(PIN_A0);
}</i>
the compiler complains about the #INT_RA3 ("Invalid Pre-Processor directive").

Can anyone help me? Thanks a lot!!!

Thomas
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jan 05, 2006 6:49 pm     Reply with quote

Quote:
#define INT_RB 0x0B08

Why is there a INT_RB?

In the current version of the compiler (PCM 3.241), it has been
changed to INT_RA.
thb
Guest







but how to use the INT_RA3?
PostPosted: Thu Jan 05, 2006 10:09 pm     Reply with quote

Hi, thanks so far,
but how can I use an interrupt with the GP3? Which interrupts do I have to enable and which #-statement do I have to write to introduce my interrupt routine?
Or doesn't it work at all with my compiler version 3.15?

Thank you,
Thomas
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jan 05, 2006 10:48 pm     Reply with quote

Quote:
but how can I use an interrupt with the GP3? Which interrupts do I have to enable and which #-statement do I have to write to introduce my interrupt routine?
Or doesn't it work at all with my compiler version 3.15?


You didn't give your exact version number, so I couldn't check to
see if the following code works with your version. I did look at the
.LST file for vs. 3.241, and it looks OK.
Code:

#byte Port_A = 0x05


#INT_RA
void int_ra_isr(void)
{
char c;

// Put code to hand the interrupt here.


c = Port_A;    // Read port to clear "change" condition
}   

//===========================
void main()
{


enable_interrupts(INT_RA3);
enable_interrupts(GLOBAL);

while(1);
}
 
Ttelmah
Guest







PostPosted: Fri Jan 06, 2006 5:00 am     Reply with quote

Just as an 'explanation', the 'GP' port on these chips, sits at the address occupied by port B, on the larger chips. Hence in some othe code, the 'port B' nomenclature was used. As PCM Programmer has posted, this has been updated on latter compiler releases.

Best Wishes
thb
Guest







It works!
PostPosted: Fri Jan 06, 2006 8:09 am     Reply with quote

Hello,

thanks a lot for your help PCM programmer and Ttelmah, now it works. It's a bit confusing, in my version I have to use
enable_interrupts(INT_RA3); and #INT_RB.

Greetings,
Thomas
Ttelmah
Guest







PostPosted: Fri Jan 06, 2006 8:14 am     Reply with quote

That is typically 'brilliant'. It almost matches some of MicroSoft's labelling genius!... :-)
I find myself trying to visualise driving a car with controls as logical as this.
Glad you found the combination that works.
Potentially, just to make things 'clearer', you should be able to do something like:
#define INT_RA INT_RB

and then use INT_RA.

Best Wishes
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