View previous topic :: View next topic |
Author |
Message |
ebarnes
Joined: 16 Apr 2007 Posts: 11
|
Returning from an interupt |
Posted: Tue Apr 17, 2007 12:32 pm |
|
|
I am confused on how to acquire a return value from an interrupt.
Normally to return a value would be
value = subroutine()
int Subroutine() {
some statements;
return (int);
}
but there is no calling statement for an interrupt.
Help |
|
![](templates/subSilver/images/spacer.gif) |
kevcon
Joined: 21 Feb 2007 Posts: 142 Location: Michigan, USA
|
|
Posted: Tue Apr 17, 2007 1:05 pm |
|
|
Interrupts don't return anything; you need to use a global variable if you want to get a value from an ISR. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Apr 17, 2007 1:06 pm |
|
|
The poll is not really worth anything because I have a 16F690 in my
parts box, but I'm not designing it into my current project. So am I
"using it" ?
Anyway, you don't return a value from an isr. You just use a global
variable which is updated inside the isr. |
|
![](templates/subSilver/images/spacer.gif) |
ebarnes
Joined: 16 Apr 2007 Posts: 11
|
|
Posted: Tue Apr 17, 2007 1:10 pm |
|
|
Anyway, you don't return a value from an isr. You just use a global
variable which is updated inside the isr.[/quote]
It was interesting how if I don't begin the interrupt with a void, a warning is received at compilation. this is what made me think that an interrupt was able to return a value. but i guess it is just a bug in the compiler.
thanks anyway.
I will use a global variable. |
|
![](templates/subSilver/images/spacer.gif) |
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Tue Apr 17, 2007 5:12 pm |
|
|
Quote: | The poll is not really worth anything because I have a 16F690 in my
parts box, but I'm not designing it into my current project. So am I
"using it" ?
|
Is the part taking up space in your parts box? If it is then you must be using it. If you weren't using it you would be able to put something else in that space.
The CCS IDE does not give any warning if a 'void' is not placed before the ISR function. MPLAB does, however, like to have those kind of things in front of _every_ function and since the ISR is formatted like a regular function then MPLAB wants to see that syntax there. It is just a warning, though.
Ronald |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Apr 17, 2007 5:18 pm |
|
|
MPLAB is just an editor/IDE. It doesn't care about 'void'.
The warnings come from the CCS compiler. They are turned on or off
with a command line switch that you set in the Project/ Build Options
window in MPLAB. These options are passed to the compiler.
MPLAB is just a front-end. |
|
![](templates/subSilver/images/spacer.gif) |
|