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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/13/06 16:57
Read: times


 
#120213 - Additional input
Responding to: ???'s previous message
Eric Lugt said:

MOV IE,#084H ;enable interrupt 1
MOV PCON,#DOWN_MODE ;power down
MAIN_INIT_0: SJMP MAIN_INIT_0


As Jan said, you're never exiting the interrupt with RETI. You need to do that. That said, you're also powering down the MCU while you're still in the interrupt. Even if you put a RETI after the MOV PCON,#DOWN_MODE, you'll be putting the MCU to sleep before the interrupt exits and that's going to prevent the interrupt from executing again while you are asleep.

The best way to do this would probably be to remove the code from the interrupt. Make your interrupt do nothing but execute RETI. The only purpose of the interrupt will be to wake up the MCU.

Make your main loop be:
MAIN_INIT_0:  
   MOV PCON,#DOWN_MODE ;power down until interrupt
   ;... Here you should insert all the code you currently
   ;execute in your interrupt.
   SJMP MAIN_INIT_0

That way your MCU goes to sleep. The interrupt will cause the MCU to wake up and execute the interrupt which does nothing but return using RETI. You then execute your code (currently in your interrupt) in the main program above. You then go back to MAIN_INIT_0 which will put the unit to sleep again and repeat the process.

I'm not sure I can think of any case that telling the MCU to go to sleep during an interrupt would be a good thing.

Regards,
Craig Steiner


List of 15 messages in thread
TopicAuthorDate
at89s8253 wakes up only once from pwr down.            01/01/70 00:00      
   i tried            01/01/70 00:00      
      unformatted code            01/01/70 00:00      
         sure you can            01/01/70 00:00      
            ...formatted code            01/01/70 00:00      
               mismatch            01/01/70 00:00      
                  nothing else to do.            01/01/70 00:00      
                     you should exit the interrupt by reti..            01/01/70 00:00      
                     Why does everyone insist on doing things WITHOUT e            01/01/70 00:00      
                     And then ?            01/01/70 00:00      
                        all true, but ...            01/01/70 00:00      
               Additional input            01/01/70 00:00      
   Re: at89s8253 wakes up only once from pwr down.            01/01/70 00:00      
   Thanks, everything OK            01/01/70 00:00      
      but you did not do so            01/01/70 00:00      

Back to Subject List