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
More questions in this forum