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

Jump to different location after interrupt?

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



Joined: 21 Apr 2007
Posts: 1

View user's profile Send private message

Jump to different location after interrupt?
PostPosted: Sat Apr 21, 2007 3:36 pm     Reply with quote

Hi,

I'm trying to implement something that'll allow me to jump to a specific location after an port b change interrupt.

I remember a post here somewhere that addressed this, but I can't seem to find it anymore. It involved POPing the stack, and PUSHing in the new address before returning from the ISR. I'm not exactly sure how to do this or how to find the address of the line I want to jump to.

Can anyone help me out?

Thanks in advance Smile
Ttelmah
Guest







PostPosted: Sun Apr 22, 2007 2:31 am     Reply with quote

Seriously, try to do this another way.
The problem is that while the actual 'transfer' can be made to work fairly easily, it is almost certain to lead to other problems. If (for instance), the transfer occurs while the code is inside a subroutine, then the latter return from this, may well result in problems (and remember that even if you are not directly coding routines, keeping everything in 'main', the compiler itself will call routines). The 'odds' are that you will corrupt the scratch variables, and worse, the stack. When your newly called routine 'returns'. The most likely to work solution, is not to pop the return address at all, but just to push the address of your routine. Then when your new routine finishes, it will 'return' to where the interrupt event occured, and the stack should then keep in order. Effectively you then have an extended interrupt handler, which is called, with interrupts re-enabled after the normal handler.
Otherwise, if you want to do this, then I'd really say that you need to be writing a lot in assembler, and disabling interrupts around all system routines, if problems are not going to result.
You can get the subroutine address, with 'label_address'.

Best Wishes
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Apr 22, 2007 3:11 pm     Reply with quote

I couldn't find the thread that you mentioned. I vaguely feel like
there was one somewhat like that. Try these. Some of these
suggest the other ways that Ttelmah is referring to.
http://www.ccsinfo.com/forum/viewtopic.php?t=30011
http://www.ccsinfo.com/forum/viewtopic.php?t=25529
http://www.ccsinfo.com/forum/viewtopic.php?t=24536
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