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

High Priority PIC18 Interrupts

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



Joined: 22 Apr 2011
Posts: 2

View user's profile Send private message

High Priority PIC18 Interrupts
PostPosted: Fri Apr 22, 2011 1:00 pm     Reply with quote

Hi all,

My code is something like I describe below:

----------------------------------
----------------------------------
----------------------------------
#include <18F4550.h>
#device high_ints = true

#FUSES ...
.....
.....
#FUSES ...

#use delay(clock=48000000)
#use rtos(timer=0,minor_cycle=20ms)

#INT_TIMER1 HIGH //<-- error line here
void sampletimer_int() {
...........................
interrupt code here
...........................
}

void main() {
...........................
main program here
...........................
}
----------------------------------
----------------------------------
----------------------------------

When I try to compile it I get "Error 7 "test.c" Line 19(12,17): Invalid Pre-Processor directive.
The indicated line is "#INT_TIMER1 HIGH" and the errors disappears if I delete the "HIGH" directive. I really need this interrupt to be of high priority.

Is there anything I'm doing wrong? The compiler version I use is 4.104.

Thanks in advance.
Regards...
_________________
... sigmaorion ...
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Apr 22, 2011 1:41 pm     Reply with quote

Try this program. It compiles OK for me with vs. 4.104. It doesn't give
any errors.
Code:
#include <18F4550.h>
#device high_ints = true
#fuses HS,NOWDT,BROWNOUT,PUT,NOLVP
#use delay(clock=20M)             

#int_timer1 HIGH
void t1isr(void)
{
int8 temp;

temp = 0x55;
}

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

while(1);
}


Also, try it like this. Sometimes CCS doesn't parse compiler directives.
They are treated like a "glyph". They can't accept spaces. Try it as
shown below:
Code:
#device HIGH_INTS=true
Ttelmah



Joined: 11 Mar 2010
Posts: 19224

View user's profile Send private message

PostPosted: Fri Apr 22, 2011 2:22 pm     Reply with quote

Separately, if you are also using the INT_EXT interrupt, you should be aware that this will always be a high priority interrupt, if high priority interrupts are enabled. Can catch the unwary.
I'm sure it's the spaces causing the problem.

Best Wishes
sigmaorion



Joined: 22 Apr 2011
Posts: 2

View user's profile Send private message

PostPosted: Fri Apr 22, 2011 3:08 pm     Reply with quote

Hi guys, thank you very much for your responses.

Finally I found the problem was I had defined "define HIGH TRUE" because I wanted to use the keyword "HIGH" for pin states. Of course it was causing troubles later in the code when I tried to use the keyword HIGH to define the interrupt as high priority.

The "stupid" code:
#define HIGH TRUE
#INT_TIMER1 HIGH

Is not a good idea!!! I passed my eyes over that mistake without seeing it, hehe.

Thanks again everyone!
_________________
... sigmaorion ...
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