TMR0 Longer time


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: TMR0 Longer time

    Hi,
    Yes, TMR0CON = %10001111 should be TMR0 enabled, prescaler assigned to it with ratio 1:256. If I where you I'd try it on real hardware, I'm willing to bet it's a simulator issue...

    You do realise though that this forum is for MeLabs PBP compiler which is not the same as the Oshonsoft compiler, right? They're both BASIC, they're both for PIC but they are not the same.

    /Henrik.

  2. #2
    Join Date
    Jan 2013
    Posts
    64


    Did you find this post helpful? Yes | No

    Default Re: TMR0 Longer time

    Quote Originally Posted by HenrikOlsson View Post
    Hi,
    Yes, TMR0CON = %10001111 should be TMR0 enabled, prescaler assigned to it with ratio 1:256. If I where you I'd try it on real hardware, I'm willing to bet it's a simulator issue...

    You do realise though that this forum is for MeLabs PBP compiler which is not the same as the Oshonsoft compiler, right? They're both BASIC, they're both for PIC but they are not the same.

    /Henrik.
    Hi H,

    I am using the simulator, then putting it on the hardware, as the simulator doesn't actually support what I am doing

    I realise that this is not an Oshonsoft support forum, I have had good replies from this forum, also there isn't much on Oshonsoft.

    Thanks, C.

  3. #3
    Join Date
    Jan 2013
    Posts
    64


    Did you find this post helpful? Yes | No

    Default Re: TMR0 Longer time

    Correction. The simulator doesn't support [I]fully[I] what I'm doing.

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: TMR0 Longer time

    Hi,
    Bit 3 of TMR0CON needs to be 0 in order to assign the prescaler to TMR0 - I got that backwards in my previous post, you had it correct in your original code.
    Code:
    TMR0CON = %10000111
    The above have been tested on an 18F4431 (actual hardware) and it does work.

    /Henrik.

  5. #5
    Join Date
    Jan 2013
    Posts
    64


    Did you find this post helpful? Yes | No

    Default Re: TMR0 Longer time

    Quote Originally Posted by HenrikOlsson View Post
    Hi,
    Bit 3 of TMR0CON needs to be 0 in order to assign the prescaler to TMR0 - I got that backwards in my previous post, you had it correct in your original code.
    Code:
    TMR0CON = %10000111
    The above have been tested on an 18F4431 (actual hardware) and it does work.

    /Henrik.
    Hi H,

    Thanks very much for re-checking. I spend many hours chasing small errors like that. In fact, I couldn't get TMR0 to work because I removed the TIME = 1 with INTCON.TMR0IF = 1, and as the TMR0 is count down not up, this was also backwards. TMR0 is now working.

    Thanks, C.

Similar Threads

  1. Using TMR0 to keep time
    By BraveZero in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 23rd November 2011, 05:25
  2. ArrayRead on longer arrays
    By amgen in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 21st September 2011, 16:07
  3. Calculate TMR0 reload value at compile time?
    By HenrikOlsson in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 28th December 2010, 19:59
  4. PBP is no longer a stranger to Microchip
    By MarioC in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 12th March 2008, 22:59
  5. code needs much longer then expected
    By mischl in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd March 2006, 02:03

Members who have read this thread : 1

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