Ccs _ View Topic - Multiple Interrupts

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Ccs _ View Topic - Multiple Interrupts as PDF for free.

More details

  • Words: 556
  • Pages: 2
CCS :: View topic - multiple interrupts

FAQ

Forum Help Profile

http://ccsinfo.com/forum/viewtopic.php?t=25400&highlight=inte...

Official CCS Support

Search

Log in to check your private messages

Register Log in

multiple interrupts CCS Forum Index -> General CCS C Discussion View previous topic :: View next topic Author eaton10500 Guest

Message multiple interrupts Posted: Sat Dec 10, 2005 8:10 am

Hello I have 3 interrupts active. external,rb int on change, and a timer. The external interrupt ISR is kind of lengthy. It has to be. The question is while control is in the external int ISR there is a possibility that both the timer overflow flag and the interrupt on change flag could be set. When the external int ISR exits and the global interrupt is enabled what happens? Which interrupt is triggered? Would it be better to ensure those flags are clear before exiting the external interrupt ISR? Thanks, Ttelmah Guest

Posted: Sat Dec 10, 2005 10:34 am

The global 'parser', bases the order that interrupts are tested for, on the order they are declared in your code, or on the order in a #priority statement if this is present. So when the external interrupt exits, the code will go to whichever o the other interrupt handlers was defined first (unless #priority has overridden this). You could potentially speed this with some careful programming. Something like: Code: void rbsub(void) { //Read port B, before clearing the interrupt clear_interrupt(INT_RB); //rest of your RB interrupt handler here } #int_rb noclear void rbint(void) { rbsub(); } void timersub(void) { clear_interrupt(INT_TIMERX); //Need to set the interrupt used to your timer //Rest of your timer interrupt handler here }

#int_timerx noclear void timer_interrupt(void) {

1 от 2

01.3.2007 г. 11:28

CCS :: View topic - multiple interrupts

http://ccsinfo.com/forum/viewtopic.php?t=25400&highlight=inte...

timersub(); } #INT_EXT void external_interrupt(void) { //Have your EXT handler here //You need to define bits to directly access the interrupt flags //Now check for the other interrupts order these tests //according to your own 'priority' criteria. if (TIMERX_INTFLAG) timersub(); if (RB_CHANGED_INTFLAG) rbsub(); }

Now the 'handler' for the two other interrupt events, are rewritten as subroutines, and take over the function of clearing the interrut flag inside the routines. You turn off the default behaviour in the standard handler of clearing this flag. This then allows these routines to be called inside the other interrupt handler as well. The big 'plus', is that if one of these occurs inside the long external handler, the system does not have to restore all the main registers, then see the new interrupt, and save the registers again before calling it's handler. There is a couple of extra instructions 'overhead' in the default interrupt path, to call the seperate routine. Best Wishes eaton 10050 Guest

Posted: Sat Dec 10, 2005 11:10 am

Thanks tt i think that work just great

Display posts from previous: All Posts

Oldest First

CCS Forum Index -> General CCS C Discussion

Go All times are GMT - 6 Hours

Page 1 of 1 Jump to: General CCS C Discussion You can post new topics You can reply to topics You cannot edit your posts You cannot delete your posts You cannot vote in polls

Go in in in in in

this this this this this

forum forum forum forum forum

Powered by phpBB © 2001, 2005 phpBB Group

2 от 2

01.3.2007 г. 11:28

Related Documents