View previous topic :: View next topic |
Author |
Message |
jma_1
Joined: 08 Feb 2005 Posts: 147 Location: Wisconsin
|
warning interrupt disabled - revisited |
Posted: Thu Feb 25, 2010 9:26 am |
|
|
Greetings,
I have read the posts in the forum as this seems to be a common theme. I have an ISR which has a division and multiplication which does not seem to be avoidable.
Is there a way to tell the compiler to only disable the offending interrupt routine and not all interrupts (global)?
Cheers,
JMA |
|
|
Wayne_
Joined: 10 Oct 2007 Posts: 681
|
|
Posted: Thu Feb 25, 2010 9:54 am |
|
|
Yes |
|
|
jma_1
Joined: 08 Feb 2005 Posts: 147 Location: Wisconsin
|
|
Posted: Thu Feb 25, 2010 10:01 am |
|
|
Wayne_,
Any more information on how to accomplish this? Thank you for your time.
Cheers,
JMA |
|
|
Wayne_
Joined: 10 Oct 2007 Posts: 681
|
|
Posted: Thu Feb 25, 2010 10:59 am |
|
|
Well that all depends on the interrupt you are trying to disable.
You havn't really given any information what so ever.
No pic type, fuses, curent code for setting up your interrupts or interrupt code.
So I doubt you will get very much help at all.
At least state which interrupt it is! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Feb 25, 2010 11:06 am |
|
|
Quote: |
I have an ISR which has a division and multiplication which does not
seem to be avoidable.
|
See this post. It explains how to create an 2nd instance of the CCS
math library routines, to avoid getting that compiler warning:
http://www.ccsinfo.com/forum/viewtopic.php?t=25464&start=4 |
|
|
jma_1
Joined: 08 Feb 2005 Posts: 147 Location: Wisconsin
|
|
Posted: Thu Feb 25, 2010 11:09 am |
|
|
Greetings Wayne_,
Thanks for the advice. I understand the need for specifics when trying to come up with potential solutions. Below are a few details. I thought there might be a simple answer like SEE XXX of the CCS manual or XXX posting.
Details:
PIC18F4585
INT_TIMER2
H4, WDT16, NOPROTECT, NOLVP
JMA |
|
|
jma_1
Joined: 08 Feb 2005 Posts: 147 Location: Wisconsin
|
|
Posted: Thu Feb 25, 2010 11:14 am |
|
|
PCM Programmer,
Thank you for the suggestion. I'm in the process of looking of looking at this posting. I was thinking there might be another work around with only disabling specific interrupts.
Just for clarification, when the assembly code lists an 'RCALL', is this a clue the compiler is making a relative call to a library routine which is not in the lst file?
Cheers,
JMA |
|
|
Wayne_
Joined: 10 Oct 2007 Posts: 681
|
|
Posted: Fri Feb 26, 2010 2:41 am |
|
|
I have to appologise. I did not fully understand your problem until PCM posted.
I thought you just wanted to know how to disable interrupts.
You could also write your own division/multiplication routines either in C or inline asm. I would prob choose this option depending on the complexity and accuracy required. |
|
|
Ttelmah Guest
|
|
Posted: Fri Feb 26, 2010 3:31 am |
|
|
As a 'comment', there is a way to sort of do what the original question asked.
Obviously, provided code space is not a problem, it is more efficient, to just duplicate the arithmatic.
What you do, is 'encapsulate' the routine giving the problem, in your own wrapper.
So (crude demo for a 18F452, assuming the 'problem' routine, is the 8bit*8bit multiply).
Code: |
#include <18F452.h>
#FUSES XT
#use delay(clock=4000000)
int8 tval1;
int8 tval2;
int1 in_int = false;
int8 MUL8x8(int8 x,int8 y) {
int8 temp;
disable_interrupts(INT_EXT);
if (!in_int) enable_interrupts(global); //If we are _not_ in the interrupt
//re-enable the global interrupts
temp=x*y;
enable_interrupts(INT_EXT);
return temp;
}
#INT_EXT
void dummy_int(void) {
int8 testval=2;
in_int=true; //Flag to say we are in the interrupt
testval=mul8x8(testval,tval1);
in_int=false;
}
void main(void) {
enable_interrupts(INT_EXT);
enable_interrupts(GLOBAL);
while (TRUE) {
tval1=mul8x8(tval1,tval2);
}
}
|
You will still get the warning, and the global interrupts will be disabled before the routine is called, but as soon as you are inside the routine, if you are not in the interrupt, you disable the single 'problem' interrupt, and re-enable the global interrupts.
Best Wishes |
|
|
|