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

Returning from an interupt

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



Joined: 16 Apr 2007
Posts: 11

View user's profile Send private message

Returning from an interupt
PostPosted: Tue Apr 17, 2007 12:32 pm     Reply with quote

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
kevcon



Joined: 21 Feb 2007
Posts: 142
Location: Michigan, USA

View user's profile Send private message

PostPosted: Tue Apr 17, 2007 1:05 pm     Reply with quote

Interrupts don't return anything; you need to use a global variable if you want to get a value from an ISR.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Apr 17, 2007 1:06 pm     Reply with 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" ?


Anyway, you don't return a value from an isr. You just use a global
variable which is updated inside the isr.
ebarnes



Joined: 16 Apr 2007
Posts: 11

View user's profile Send private message

PostPosted: Tue Apr 17, 2007 1:10 pm     Reply with quote

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



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Tue Apr 17, 2007 5:12 pm     Reply with quote

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

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
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Apr 17, 2007 5:18 pm     Reply with quote

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