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

PIC18F66K40 Interrupt Priority level

 
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: 44

View user's profile Send private message

PIC18F66K40 Interrupt Priority level
PostPosted: Thu Oct 24, 2019 4:37 am     Reply with quote

Hi All,
I am using PIC18F66K40 in one of my projects and my compiler is v5.083. In a part of this project I need to send data through UART when a 1millisecond timer is running; specifically TIMER0. Now I am facing a problem that during the data sending process through UART timer interrupt is on hold. As because both RDA and TIMER are inetrrupt I want to know which one has a higher priority level? As well as is there any process to change the priority level of interrupts??I want timer interrupt to get higher priority than RDA interrupt.

Thank you.
Ttelmah



Joined: 11 Mar 2010
Posts: 19515

View user's profile Send private message

PostPosted: Thu Oct 24, 2019 5:01 am     Reply with quote

Really is a 'read the manual' question:

Quote:

#INT_xxxx HIGH - High priority interrupt. Compiler saves/restores key registers. This interrupt will interrupt any normal interrupt in progress.

and in the entry for #device:
Quote:

HIGH_INTS=TRUE
Use this option for high/low priority interrupts on the PICĀ® 18.


Basically you need to add the line #DEVICE HIGH_INTS=TRUE up at the
start of the code (immediately after the processor include is loaded), and
you can then simply flag an interrupt as 'HIGH' giving it priority over the
normal interrupts.
One 'caveat'. Most (all?) PIC18's don't have a priority bit for the INT
input. If high priority interrupts are enabled, this interrupt is always
high priority (no choice). So if you are using this interrupt it will have
the same priority as the 'high priority' ones.
temtronic



Joined: 01 Jul 2010
Posts: 9228
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Oct 24, 2019 5:13 am     Reply with quote

I found ,years ago, that if I press F11 while my project is open, that the CCS manual 'magically' pops up !! I use MPLAB BTW, Yeah, I always have it opened as I can't member the syntax to some functions and need a wee bit of help.

I'm confused though, you talk about 'sending data' and RDA. To me the PIC is always the 'processor in charge', so sending data would mean the PIC is transmitting data TO another device. RDA is used to receive data FROM a device.
The good thing is the PIC hardware UARTs have interrupt capabilites for both transmit and receive. Also when doing any serial communications, it's best to use 'buffers'. CCS supplies some example programs, ex_sisr.c , is one of them.
Mrinmoy Dey



Joined: 23 Jan 2018
Posts: 44

View user's profile Send private message

PostPosted: Thu Oct 24, 2019 5:36 am     Reply with quote

@Ttelmah
Thank you Sir. Actually I have those lines in my code but turned off those lines as per one of your previous suggestion for this particular controller on PIN_SELECT and I also forgot about that INTS are turned off now. I think it will work now.

Thank you again.
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