Timing out DT's Blinking Led


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    You could increment a couter variable in your interrupt, and just disable the interrupt after x number of counts.

    The big problem however is with Timer1. It stops working during sleep since the oscillator is shut off in sleep. You would need to setup Timer1 with an external oscillator for it to run during sleep periods.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Thanks Bruce for your suggestion.
    The idea I was toying with was to toggle the led for a few moments then time out and go to sleep, ...I then added to the main: the high led/low led to signal that it had returned from the ToggleLed1. Then sleep....

    Thanks again for the reply.

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    The reason your first version is WAY slow is because Timer1 shuts down during sleep. When the WDT wakes it from sleep, you only have 1 nop and the GOTO Main instruction cycles before it goes back to sleep.

    So it takes Timer1 a really long time to increment to overflow with a prescaler of 1:8.

    Just increment a variable in the interrupt handler, and check it for a certain value in Main. When it reaches the pre-set value, disable Timer1 and go to sleep.

    You can re-enable it as needed.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts