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

TMR0IE bit [solved]

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



Joined: 10 Feb 2011
Posts: 241
Location: Vancouver, BC

View user's profile Send private message

TMR0IE bit [solved]
PostPosted: Wed Apr 06, 2011 11:07 am     Reply with quote

Hi There,

I have two routines called:
DisableAllInterrupts(int8 *storePIEreg)
and
EnableAllInterrupts(int8 *storePIEreg)
with which I enable/disable all set interrupts in my program for a critical process in the middle that requires its interrupt (thus i don't just switch them with the GLOBAL flag).
However, I switch them by storing the PIE registers before (re-)setting them to 0:
Code:
    storePIEreg[0] = PIE1;
    storePIEreg[1] = PIE2;
    storePIEreg[2] = PIE3;
    storePIEreg[3] = PIE4;
    storePIEreg[4] = PIE5;
    storePIEreg[5] = PIE6;
    PIE1 = 0;
    PIE2 = 0;
    PIE3 = 0;
    PIE4 = 0;
    PIE5 = 0;
    PIE6 = 0;

Now I'm also using Timer0 that doesn't get disabled like this as there's no PIE bit for TMR0 or better it is in the INTCON register for some weird reason. Any suggestions how I best solve this problem? Architecture-wise it would be nice to not need to store values from different registers but I guess I can't avoid it here, can I?
BTW:This is on a 18f87k22

Thanks for hits, suggestions & opinions!

Ron
cerr



Joined: 10 Feb 2011
Posts: 241
Location: Vancouver, BC

View user's profile Send private message

PostPosted: Wed Apr 06, 2011 11:35 am     Reply with quote

I'm wondering if I'm supposed to store all the interrupt registers away temporarily to really cover everything. That would be the following:
Code:

INTCON
INTCON2
INTCON3
PIR1
PIR2
PIR3
PIR4
PIR5
PIR6
PIE1
PIE2
PIE3
PIE4
PIE5
PIE6
IPR1
IPR2
IPR3
IPR4
IPR5
IPR6
RCON

or rather basically just every register that contains a XXXIE bit (Interrupt Enable) - right?
cerr



Joined: 10 Feb 2011
Posts: 241
Location: Vancouver, BC

View user's profile Send private message

PostPosted: Wed Apr 06, 2011 11:54 am     Reply with quote

Yes, I think I got them all covered now with this:
Code:
   storePIEreg[0] = IPR6;
    storePIEreg[1] = PIE1;
    storePIEreg[2] = PIE2;
    storePIEreg[3] = PIE3;
    storePIEreg[4] = PIE4;
    storePIEreg[5] = PIE5;
    storePIEreg[6] = PIE6;
    storePIEreg[7] = INTCON;
    storePIEreg[8] = INTCON3;
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