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

HIGH_INTS on 18F4525

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



Joined: 10 Feb 2008
Posts: 46
Location: Asheville, North Carolina

View user's profile Send private message

HIGH_INTS on 18F4525
PostPosted: Wed Apr 09, 2008 2:35 pm     Reply with quote

This has to be a simply syntax thing, but I can't find it. I have multiple interrupts running on this 4525 and I need to prioritize them in the following order:

1 - INT_EXT
2 - INT_RDA
3----and so forth.

Seems I can't do this unless I have a #device HIGH_INTS=TRUE.

So, here's the top of my 18F4525.h file:

Code:
//////// Standard Header file for the PIC18F4525 device ////////////////
#device PIC18F4525
#device *=16
#device HIGH_INTS=TRUE
#nolist
//////// Program memory: 24576x16  Data RAM: 4096  Stack: 31
//////// I/O: 36   Analog Pins: 13
//////// Data EEPROM: 1024
//////// C Scratch area: 00   ID Location: 2000


The compiler complains that there are "extra characters on preprocessor command line".

What am I overlooking?
_________________
Confidence is the feeling you have right before you fully understand the situation...
Ken Johnson



Joined: 23 Mar 2006
Posts: 197
Location: Lewisburg, WV

View user's profile Send private message

PostPosted: Wed Apr 09, 2008 2:45 pm     Reply with quote

Don't know if this is it, but it sounds like you modified the ccs header file?

Why not just include that file, then put your high_ints in your file, after the #include?

Ken
w2drz



Joined: 27 Dec 2006
Posts: 55
Location: Western New York - USA

View user's profile Send private message Visit poster's website

PostPosted: Wed Apr 09, 2008 2:46 pm     Reply with quote

try this

As pointed out NOT in the device header file,
insert code in the area before your fuse settings in the program.

#device *=16
#device ADC=16
#device HIGH_INTS=true
#priority ext,rda // ect: of ints used


tom
Guest








PostPosted: Wed Apr 09, 2008 2:57 pm     Reply with quote

It is also worth understanding the two types of 'priority'.
The chip itself, supports just two interrupt 'levels'. High priority, and low priority. High priority interrupts can interrupt low priority interrupts.It is this feature that is enabled by the 'high_ints=true' syntax. With this enabled, you can flag one or more of the interrupt handlers as 'high', and these will be able to interrupt the other handlers.
Separately, inside each hardware priority level, there is software priority. This is set by the order the compiler scans the hardware flags in each handler. By default, this is set by the order the interrupts are defined in the code. This can be overridden by the '#priority' statement. This priority affects which interrupts will be serviced first, if multiple sources exist. This does not need the high_ints option.

Generally, it is considered 'bad practice' to modify the supplied include files, since this means they will have to be changed with each compiler update. Better as Ken says, to just add the lines in your main code, immediately after including the file.

You don't need the *=16 syntax (does nothing on 18 chips).

The probable reason for the error, is that you have something in your main _before_ you include this file. The syntax really needs to be that the processor file is the very first thing included in the main, followed immediately by the 'extra' statements, like 'HIGH_INTS=TRUE'.

Best Wishes
KU5D



Joined: 10 Feb 2008
Posts: 46
Location: Asheville, North Carolina

View user's profile Send private message

PostPosted: Wed Apr 09, 2008 2:59 pm     Reply with quote

Ah, but of course. It's happy now, and I really don't like fooling with the device file in any case.

Now for the priority I assume it would go thusly:

#priority INT_EXT, INT_RDA, INT_EXT1, INT_RTCC

where my interrupt routines are called as,

#INT_EXT
#INT_RDA,

etc.

Many thanx for the quick answer.
_________________
Confidence is the feeling you have right before you fully understand the situation...
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