|
|
View previous topic :: View next topic |
Author |
Message |
Tom_HUN Guest
|
Interrupt termination |
Posted: Mon Mar 24, 2008 1:22 am |
|
|
Hi!
Is it possible, to terminate an interrupt routine? I mean, I want to forget about the PCLATH and go to a completely different place, from where the ISR routine was called. I'm running a menu on the LCS screen. There are sub-functions, reachable by pushing buttons. The EXT interrupt is caused by one button (16F877 - B0). I want the isr to go back to the menu function. I can not do by calling it, because then it will run inside the isr (not running - using too much PCLATH). So, what is the solution?
Menu function:
Code: | void Menu()
{
output_low(PIN_B5);
output_low(PIN_B4);
output_low(PIN_B3);
lcd_putc("\f Tesztpanel\n");
lcd_putc("1:INT 2:ADC 3:LED");
delay_ms(500);
while(1)
{
if (!input(PIN_B1))
ADC();
if (!input(PIN_B2))
LED();
}
|
ISR:
Code: |
#int_EXT
void ISR()
{
//?????????????????
}
|
What to do to terminate everything, and go to the menu funct? Except reset_cpu(). |
|
|
Ttelmah Guest
|
|
Posted: Mon Mar 24, 2008 3:10 am |
|
|
Write your main code, so it tests a flag, and calls the menu if this is set. Set the flag in the ISR.
Do a search here, a lot of examples have been posted in the past.
Best Wishes |
|
|
Tom_HUN Guest
|
|
Posted: Mon Mar 24, 2008 3:36 am |
|
|
Ttelmah wrote: | Write your main code, so it tests a flag, and calls the menu if this is set. Set the flag in the ISR.
Do a search here, a lot of examples have been posted in the past.
Best Wishes |
Thanks fot the idea! It's working like charm!
All the very best from Hungary! |
|
|
|
|
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
|