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

Meaning of #device HIGH_INTS=TRUE

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



Joined: 23 Jan 2018
Posts: 19

View user's profile Send private message

Meaning of #device HIGH_INTS=TRUE
PostPosted: Mon Feb 05, 2018 2:06 am     Reply with quote

I am using PIC18F452 in CCS C compiler.
In the system configuration the line have to compile, #device HIGH_INTS=TRUE.
I want to know the meaning of this and why this line is being used?
Ttelmah



Joined: 11 Mar 2010
Posts: 12946

View user's profile Send private message

PostPosted: Mon Feb 05, 2018 2:55 am     Reply with quote

On the PIC18 chips, there are two hardware interrupt priorities.

HIGH_INTS=TRUE adds the code to allow these to be used.

It is in the manual, but is under the #INT_XXXX entry, for how to organise an interrupt handler:
Quote:

The keywords HIGH and FAST may be used with the PCH compiler to mark an interrupt as high priority. A high-priority interrupt can interrupt another interrupt handler. An interrupt marked FAST is performed without saving or restoring any registers. You should do as little as possible and save any registers that need to be saved on your own. Interrupts marked HIGH can be used normally. See #DEVICE for information on building with high-priority interrupts.



A summary of the different kinds of PIC18 interrupts:

#INT_xxxx

Normal (low priority) interrupt. Compiler saves/restores key registers.

This interrupt will not interrupt any interrupt in progress.

#INT_xxxx FAST

High priority interrupt. Compiler DOES NOT save/restore key registers.

This interrupt will interrupt any normal interrupt in progress.

Only one is allowed in a program.

#INT_xxxx HIGH

High priority interrupt. Compiler saves/restores key registers.

This interrupt will interrupt any normal interrupt in progress.



You need to read the two manual sections, the chip data sheet, and the example, to get the whole picture. (ex_hpint.c). The example here shows a deliberately badly written interrupt handler 'blocking' another, and then using the hardware priority to avoid this.

There are some significant 'hardware caveats'. So (for instance) on most (all?) chips if high priority interrupts are enabled, INT_EXT is always high priority. Then having these will slightly slow the interrupt response time on the other interrupts (the hardware register save/restore is used for the high priority interrupts), and (of course) extra RAM used to save a second set of registers.

You can't use the HIGH or FAST settings, unless you have specified HIGH_INTS=TRUE.
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