Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/15/05 11:50
Read: times


 
Msg Score: +1
 +1 Good Answer/Helpful
#99408 - possible troubles
Responding to: ???'s previous message
hi,
Russell Bull said:
interrupt:
do whatever....
pop a
pop a ;remove return address off the stack
clr a
push a
push a ;push return address of 0x0000 onto the stack
reti ;this will return to address 0x0000

If you'd done some reading, this would have been obvious!
Remember jumping to address 0x0000 is not the same as doing a reset!


Exactly! Moreover with such "technique" there are some hard-traced problems:

- if an interrupt with this code has high priority level and occures during low-priority one is in progress then after recovering from program initialization you will lost low-level interrupts in the whole. It is because they are still blocked (need another reti).
- this code jumps to address 0x0000 with interrupts enabled. This way is very dangerous because as a rule, program initialization code supposes that all interrupts are disabled during setup of variables.

As Abhishek mentioned, enable the watchdog. To reboot the micro, just have your code sit in a dead loop and the watchdog will bail you out.


Indeed, this is the best idea. Anyway in some cases this way may be rejected as well. For example, when you need with quick recover-back time (as I remember, fastest watchdog prescaler of AT89S8252 provides 16ms delay).

Regards,
Oleg

List of 31 messages in thread
TopicAuthorDate
Interrupt question            01/01/70 00:00      
   Interrupt            01/01/70 00:00      
      then how?            01/01/70 00:00      
         One way is to            01/01/70 00:00      
            Little more description            01/01/70 00:00      
               Routine            01/01/70 00:00      
   interrupt exit            01/01/70 00:00      
      tried but gives error            01/01/70 00:00      
         assembler???            01/01/70 00:00      
            Assembler is Pinnacle            01/01/70 00:00      
               go to Pinnacle support            01/01/70 00:00      
               Asking for solutions            01/01/70 00:00      
      Now THAT was elegant!            01/01/70 00:00      
   use WDT to RESET the micro            01/01/70 00:00      
   some comments            01/01/70 00:00      
      Its like this            01/01/70 00:00      
         Emergency stop            01/01/70 00:00      
            I understand            01/01/70 00:00      
               If you REALLY want to do it            01/01/70 00:00      
                  optimizing            01/01/70 00:00      
                  possible troubles            01/01/70 00:00      
                     excellent point!            01/01/70 00:00      
                        This is not a solution            01/01/70 00:00      
                           Do it as you wish            01/01/70 00:00      
                              Makes sense            01/01/70 00:00      
                              the consensus last time was that the onl            01/01/70 00:00      
                                 WD reset - yes, why not            01/01/70 00:00      
                                    You say "no" and agree            01/01/70 00:00      
                                       no no = yes            01/01/70 00:00      
                                    Watchdog output            01/01/70 00:00      
                              Thanks, Done            01/01/70 00:00      

Back to Subject List