How can I get Timer 1 to overflow every 5 seconds


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink

    ...

    The only solution for timer 1 to overflow every 5 sec is to run the CPU clock @ 400 khz ...

    Depends on what you intend to do ...

    but

    Code:
    IF I detect something
    
    Do something .... for 5 sec
    
    Wait for detect.
    Generally is solved by sleep/ wake use of the µP ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  2. #2
    Join Date
    Mar 2009
    Location
    FLA
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    thanks scalerobotics and acetronics...I guess I had answer my own question

    "...Can I use Timer0 as another prescaler to Timer1?...

    I guess I could use Timer0 and at overflow set any available pin high then low (generate a pulse) and use it as input (via hardwire) to another timer which would be set to read an external clock (that would be the pulse).

    Thinking out of the box.....

    thanks again

  3. #3
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    Just increment/count a variable in the TIMER1 interrupt service routine and you can achieve any interval that you want - from fractions of a second to hours.

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink

    Quote Originally Posted by Acetronics View Post
    ...

    The only solution for timer 1 to overflow every 5 sec is to run the CPU clock @ 400 khz ...

    Alain
    Oh, Oh ...

    I had forgotten the 876 timer1 simply could be driven by its own oscillator up to 200 Khz ... ( NOT the CPU Osc @ 20 Mhz !)

    so, no problem ... 32768 Hz are easy to find Xtals !

    note also exist " Gate driven " Timers on numerous chips ( see 12f 683 i.e)

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

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