|
|
View previous topic :: View next topic |
Author |
Message |
Guest
|
questions about interrupt for CCS:) |
Posted: Thu Jul 29, 2004 11:12 am |
|
|
Formerly, i am writing assemble code for PIC MCU. When we finish the interrupt handling, such as UART or Timer, we should clear the interrupt flag, such as RCIF and INTF. So when i writing code for CCS, there is only enable_interrupts() and disable_interrupts()-- built in function could be usef for interrupt?
So did i still need to clear the interrupt flag after handling the interupt procession:)
thank you:) |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jul 29, 2004 11:28 am |
|
|
Quote: | So did i still need to clear the interrupt flag after handling the interupt procession ? |
The compiler does this for you, when you tell it that a routine is an isr
by using the #interrupt directive.
Compile a test program and look at the listing file (.LST) and you
will see this. |
|
|
Ttelmah Guest
|
|
Posted: Thu Jul 29, 2004 2:41 pm |
|
|
PCM programmer, has allready posted the answer.
The key 'giveaway', is that one of the options for an interrupt definition, is a flag 'noclear'. If you add this the interrupt is not cleared, otherwise the compiler does it for you.
Beware that the compiler does it at the end of the handler. Hence if events might happen earlier, you might want to use the 'noclear' option, and clear it yourself at the start of the routine, which would allow the flag to be set much earlier, by a repeated event.
Best Wishes |
|
|
|
|
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
|