TMR0 as counter


Closed Thread
Results 1 to 24 of 24

Thread: TMR0 as counter

Hybrid View

  1. #1
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Hi Savnik,

    Since TMR0 is 8-bit, there is no way you can get 135,6 as you like.

    You need to use TMR1 which is 16-bit.
    Then, you will read 135,6 at TMR1 register as 1356.


    -----------------------------
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Exclamation

    Hi, Sayzer

    As our friend Savnik didn't tell us which pic he uses ... it's difficult to answer.

    let's take the 18F252 i.e.

    Timer 0 can be 8 or 16 bits ... as you decide.

    Some more details from Savnik could be useful ... but we are used to !!!

    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 " !!!
    *****************************************

  3. #3
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Hi, Sayzer

    As our friend Savnik didn't tell us which pic he uses ... it's difficult to answer.

    let's take the 18F252 i.e.

    Timer 0 can be 8 or 16 bits ... as you decide.

    Some more details from Savnik could be useful ... but we are used to !!!

    Alain


    You are right Alain.

    That is my bad.

    But, I take 16F628A as the default PIC in my head when there is no mention of the PIC type.

    Soon enough I will change my default PIC to 18F2550.


    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  4. #4
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    Thanks for yours answer.
    My default PIC is pic16f88.
    Maybe i change with pic18f1330 which have timer0 16bit.

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Question

    Hi, Savnik

    Also could eventually be useful :

    the PIC freq.

    The Porta.4 max input freq. to be measured


    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 " !!!
    *****************************************

  6. #6
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by savnik View Post
    Thanks for yours answer.
    My default PIC is pic16f88.
    Maybe i change with pic18f1330 which have timer0 16bit.
    Savnik,

    16F88 already has 16-bit timer.

    Why change the whole car while you can change one tire and get going?


    ------------------
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  7. #7
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sayzer View Post
    Savnik,

    16F88 already has 16-bit timer.

    Why change the whole car while you can change one tire and get going?


    ------------------
    From datasheet:
    ---------------------------
    The Timer0 module timer/counter has the following
    features:
    • 8-bit timer/counter
    • Readable and writable
    • 8-bit software programmable prescaler
    • Internal or external clock select
    • Interrupt-on-overflow from FFh to 00h
    • Edge select for external clock

  8. #8
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Wink

    Hi, Savnik

    Sayzer was only telling there's a 16 Bits timer in 16F88 : Timer 1 ...

    but, if you want to use RA.4 and keep the same pinout ( must we understand PC board is already made ??? ) ... you'll have to turn to 18F1320 !

    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 " !!!
    *****************************************

Similar Threads

  1. Conway's Game Of Life
    By wellyboot in forum mel PIC BASIC Pro
    Replies: 45
    Last Post: - 28th May 2020, 06:14
  2. help: TMR0 interrupts disabling PORTAchange interrupts???
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th August 2008, 15:10
  3. 20 Digit Virtual LED Counter
    By T.Jackson in forum Code Examples
    Replies: 9
    Last Post: - 19th November 2007, 05:02
  4. using TMR0 as a counter..
    By sirvo in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 28th July 2007, 02:56
  5. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27

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