View previous topic :: View next topic |
Author |
Message |
cerr
Joined: 10 Feb 2011 Posts: 241 Location: Vancouver, BC
|
TMR0IE bit [solved] |
Posted: Wed Apr 06, 2011 11:07 am |
|
|
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
|
|
Posted: Wed Apr 06, 2011 11:35 am |
|
|
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
|
|
Posted: Wed Apr 06, 2011 11:54 am |
|
|
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; |
|
|
|
|