At 17.27 2008.05.22, you wrote: >>And I dind't do that. What I am experiencing is that the ISR gets >>executed, but the main program remains sleepy. Is it normal? > >Yes. How do you expect the main program to wake up? > >Think about what is happening. You put the chip to sleep while still in the >ISR, Again, I've never put the chip to Sleep inside a ISR, never in my life. What I an experiencing is that once I put the chip to sleep IN THE MAIN ROUTINE, then (when the Timer1 generates the interrupt) the ISR gets called, but once the RETFIE instructions executes, the chip returns to sleep, instead (as I was instead expecting) restart main program execution after the PWRSAV instruction (which is, again, in the main program, not in the ISR!). Is my chip (an engineering sample) bugged? The data sheet says: 6.2.5 Wake-up from Sleep and Idle Any source of interrupt that is individually enabled, using its corresponding control bit in the IECx registers, can wake-up the processor from Sleep or Idle mode. When the interrupt status flag for a source is set and the interrupt source is enabled via the corresponding bit in the IEC Control registers, a wake-up signal is sent to the dsPIC30F CPU. When the device wakes from Sleep or Idle mode, one of two actions may occur: 1. If the interrupt priority level for that source is greater than the current CPU priority level, then the processor will process the interrupt and branch to the ISR for the interrupt source. 2. If the user assigned interrupt priority level for the source is less than or equal the current CPU priority level, then the processor will simply continue execution, starting with the instruction immediately following the PWRSAV instruction that previously put the CPU in Sleep or Idle mode. What the data sheet says though leads to think that the behaviour I am experiencing is normal, i.e. 1 would exclude 2. In 1 it doesn't say "after the ISR is terminated, the execution will continue from the instruction immediately following the PWRSAV instruction that previously put the CPU in Sleep or Idle mode. >so how does the main program run if you haven't done a RETFIE >instruction, or whatever the equivalent is on a dsPic. > >-- >http://www.piclist.com PIC/SX FAQ & list archive >View/change your membership options at >http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist