This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Entering IDLE mode within Timer0

To keep very accurate timing during ACTIVE and IDLE modes I would like to push the core into IDLE mode and pull it out within Timer0. When I try to do this the system hangs. If I simply set a flag and have the main loop set PCON.IDLE it works fine. It is written in assembler and I am checking the push/pop stuff. I think the problem is in RETI. What happens to the hardware with RETI? Any help or pointers would be great.

Parents
  • Hi Michael,

    Are you also trying to set the program into idle mode within the timer0 interrupt routine? if so this may explain why your program hangs as you are relying upon an interrupt to wake up the system and if a reti has not been executed then the interrupt system remains 'blocked' from responding to the next (timer0/any) interrupt.

    Also, I am not quite sure why you feel the need to put the processor into idle mode to preserve timer accuracy - isn't that what interrupts are for? to vector to your timer routine the moment it overflows? and this should be no different to normal operation unless you have sections of code where interrupts are blocked (CLR EA)

    Hope this helps
    Mark :-)

Reply
  • Hi Michael,

    Are you also trying to set the program into idle mode within the timer0 interrupt routine? if so this may explain why your program hangs as you are relying upon an interrupt to wake up the system and if a reti has not been executed then the interrupt system remains 'blocked' from responding to the next (timer0/any) interrupt.

    Also, I am not quite sure why you feel the need to put the processor into idle mode to preserve timer accuracy - isn't that what interrupts are for? to vector to your timer routine the moment it overflows? and this should be no different to normal operation unless you have sections of code where interrupts are blocked (CLR EA)

    Hope this helps
    Mark :-)

Children
  • Thanks for the quick reply. I am suffering through conflicting requirements. My device must maintain very low power consumption and support FHSS on a single timer. The other timers are allocated for other uses. My plan is to have the synchronous FHSS run completely via timer0. This means I must enter and exit IDLE mode in this timer or have a very tight main loop to deal with the entry. This not a good plan because the main loop can not really do anything now or in the furture. If I can find out what RETI does maybe I can tweak the write stuff before I enter IDLE.