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

Priority problems

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



Joined: 30 Jan 2008
Posts: 197

View user's profile Send private message

Priority problems
PostPosted: Fri Jul 09, 2010 8:44 am     Reply with quote

Hello, I am implementing a module with a PIC18F452 at 20MHz, which communicates with a GPRS modem using the serial port. This module must also listen any event that is present in RB0 and RB1 as external interrupts activated flanks, my problem is follows:
This modem has unique features that make the pic must be continually asking the modem to see if the sensitivity is adequate to TX the message. If the modem has a low or very low sensitivity the answers to the asking pic varies from a few milliseconds to reach minutes, so the pic must be continually listening to the modem. For that I am using the interruption INT_RDA. This interruption has the highest priority, after there are the external interrupts INT0 and INT1. But the problem occurs when there is an event in RB0 or RB1 and the pic is attending the interruption INT_RDA. The pic does not meet these breaks, be busy and miss the event. But if I change the order of priority of interrupts I run the risk of losing some character response from the modem.
Someone like me could help me with this problem.
Code:

#priority INT_RDA, INT_RB,  INT_RB1
Ttelmah



Joined: 11 Mar 2010
Posts: 19384

View user's profile Send private message

PostPosted: Fri Jul 09, 2010 9:28 am     Reply with quote

Code:

#include <18F452.h>
#device HIGH_INTS=TRUE

#priority INT_RB, INT_RB1

#int_rda HIGH
void RDA_INT_HANDLER(void) {
   //Your INT_RB code

}


This says make INT_RB, the higher priority interrupt of the 'standard' interrupts, and make INT_RDA, a _hardware_ high priority interrupt, that can interrupt other interrupt events.

#PRIORITY, sets the 'polling' order among the standard interrupts. The code above, sets up a genuine hardware 'HIGH priority' interrupt.

Best Wishes
pilar



Joined: 30 Jan 2008
Posts: 197

View user's profile Send private message

PostPosted: Fri Jul 09, 2010 10:15 am     Reply with quote

Quote:
#include <18F452.h>
#device HIGH_INTS=TRUE

#priority INT_RB, INT_RB1

#int_rda HIGH
void RDA_INT_HANDLER(void) {
//Your INT_RB code

}


Hi Ttelmah, I do not understand. You tell me that within the RDA_INT () code I must to place the INT_RB(), INT_RB1() codes?
Ttelmah



Joined: 11 Mar 2010
Posts: 19384

View user's profile Send private message

PostPosted: Fri Jul 09, 2010 2:39 pm     Reply with quote

No.
I just typed 'RB' in the comment, instead of RDA.... The RDA handler needs to just contain your INT_RDA code. You need separate handlers for INT_RB, and INT_RB1.
As I said, what is posted shows how to setup INT_RDA, to be a hardware high priority interrupt.
There is one 'caveat' with this. Hopefully doesn't apply if the interrupts you show are the only ones being used?. On the PIC18, if hardware high priority interrupts are setup, INT_TIMER0 (or INT_RTCC), will always be a high priority interrupt if used.

Best Wishes
pilar



Joined: 30 Jan 2008
Posts: 197

View user's profile Send private message

PostPosted: Fri Jul 09, 2010 3:13 pm     Reply with quote

Thanks...
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