Can't load 16 bit value in Timer 0


+ Reply to Thread
Results 1 to 8 of 8

Thread: Can't load 16 bit value in Timer 01945 days old

  1. #1
    Prolific Poster charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    1,354
    Thumbs Up
    Received: 44
    Given: 39
    Total Downloaded
    3.36 GB

    0 Not allowed!

    Default Can't load 16 bit value in Timer 0

    Could somebody offer me some help please: I am using TMR0 on a 18F26K22 and I need 16 bit mode. I have read the datasheet a zillion times and can't understand why it doesn't work. The datasheet implies that if you "load" TMR0H first (put a value in it), it will not be actually actioned until TMR0L is loaded. They will both then somehow be loaded at the same time. I know why the two are loaded together, but I just can't get it to work.

    TMR0H = $10
    TMR0L = $00

    Whatever I put in the top line, it doesn't get loaded.

    Thanks
    Charlie

Attention

This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

The advertisements we display are relevant to this web site and your browsing history

Please consider supporting us by disabling your ad blocker.


Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

If you can, please report issues in the forum area WebSite / Forum Issues


Thank you for your attention.

  • #2
    grahamg
    Guest grahamg's Avatar

    0 Not allowed!

    Default Re: Can't load 16 bit value in Timer 0

    Charlie TMR0 is an 8 bit timer not 1 bit. It has a prescaler that is 8 bit and this will be cleared automatically when you load TMR0 low byte.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #3
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,468
    Thumbs Up
    Received: 71
    Given: 29
    Total Downloaded
    6.17 GB

    0 Not allowed!

    Default Re: Can't load 16 bit value in Timer 0

    Charlie,

    the T0CON.6 should be set to 0.

    Code:
    T0CON.6 = 0
    From the datasheet page 159: -

    Bit 6 T08BIT: Timer0 8-bit/16-bit Control bit
    1 = Timer0 is configured as an 8-bit timer/counter
    0 = Timer0 is configured as a 16-bit timer/counter
    I have set this to 16 bit and it work great.
    Regards

    Joseph

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #4
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    688
    Thumbs Up
    Received: 91
    Given: 2
    Total Downloaded
    4.62 GB

    0 Not allowed!

    Default Re: Can't load 16 bit value in Timer 0

    Hi Charlie,
    The 18F26K22 can be configured for 16 bits Timer. (T0CON.6 = 0)
    Read the PIC18F2x/4xK22 datasheet page 159

    I had the same problem with Timer1 with the PIC18F25K22. I solved the problem with this code.
    But I don't know if Timer0 has the same problem.

    First, you must configure the T0CON and clear the bit7. (don't start the Timer0)
    T0CON = 011000 ' only an example
    TMR0H = ValueH
    Nop
    TMR0L = ValueL
    Nop
    T0CON.7 = 1 ' Start Timer0

    I hope this code would be usefull.
    The Binary value is truncated.
    Alberto
    Last edited by AlbertoFS; 16th August 2014 at 16:28.
    73's de Alberto ea3agv

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #5
    Prolific Poster charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    1,354
    Thumbs Up
    Received: 44
    Given: 39
    Total Downloaded
    3.36 GB

    0 Not allowed!

    Default Re: Can't load 16 bit value in Timer 0

    That's done the trick! I hadn't stopped the timer and was trying to reload it on the fly.
    Very useful Alberto. Thanks guys.
    Charlie

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #6
    Senior Member barak's Avatar
    Join Date
    Apr 2008
    Posts
    724
    Thumbs Up
    Received: 30
    Given: 11
    Total Downloaded
    1.53 GB

    0 Not allowed!

    Default Re: Can't load 16 bit value in Timer 0

    Make your life easy, alias the timer register as a word = TMR0L & TMR0H. Example:

    Dim Timer0REG As TMR0L.Word

    Timer0REG = 0x1000

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #7
    Prolific Poster charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    1,354
    Thumbs Up
    Received: 44
    Given: 39
    Total Downloaded
    3.36 GB

    0 Not allowed!

    Default Re: Can't load 16 bit value in Timer 0

    Thanks Barak, that's a very useful tip. Sorry I didn't reply earlier, I've been away on holiday for a week.
    Charlie

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #8
    Prolific Poster hadv215's Avatar
    Join Date
    Sep 2009
    Posts
    1,135
    Thumbs Up
    Received: 66
    Given: 26
    Total Downloaded
    3.46 GB

    0 Not allowed!

    Default Re: Can't load 16 bit value in Timer 0

    dim wTemp as word

    wTemp = <the value>


    TMR0H = wTemp.HighByte
    TMR0L = wTemp.LowByte

    Harm

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

    Thread Information

    Users Browsing this Thread

    There are currently 1 users browsing this thread. (0 members and 1 guests)

       

    Similar Threads

    1. key drivers cannot load
      By ADLIN SYSTEMS in forum The Lounge
      Replies: 2
      Last Post: 9th November 2015, 14:26
    2. Down Load Up-Date Issue
      By myeeplacee in forum Website / Forum Issues
      Replies: 7
      Last Post: 1st September 2014, 10:53
    3. Cant load ProtonIDE
      By Charles Coultas in forum Pre-Sales and Upgrade Questions
      Replies: 2
      Last Post: 24th August 2009, 15:37
    4. 32 bit interrupt timer
      By crankshaft in forum Proton Plus Compiler v3
      Replies: 2
      Last Post: 12th September 2008, 08:17
    5. How to turn 8-bit timer into 16-bit timer?
      By HelpMe! in forum Proton Plus Compiler v3
      Replies: 6
      Last Post: 29th October 2007, 21:08

    Members who have read this thread since 9th December 2019, 23:53 : 0

    Actions :  (Set Date)  (Clear Date)

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

    Tags for this Thread

    Posting Permissions

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