timer0 10ms setting check


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: timer0 10ms setting check

    As your error is double, it's likely a problem with the 2:1 prescaler. Perhaps your setting of T0CON is being overwritten in one of the include files.

    Or your clock is running at 16Mhz.

    George
    Last edited by towlerg; - 30th June 2015 at 03:50. Reason: old and stupid

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,627


    Did you find this post helpful? Yes | No

    Default Re: timer0 10ms setting check

    Not sure it's got anything to do with your problem but flipping INTCON.5 does not start/stop TMR0 - it enables/disables the interrupt.
    Code:
      Timer0_Count:
        
        INTCON.5 = 0                 ' STOP TIMER   <----- No it doesn't
       T0Count1 = T0Count1 + 1      ' inc counter on interupt flag
        TMR0H = $63               ' preset Timer 0 to a 10ms timer
        TMR0L = $C0                              
        INTCON.5 = 1                 ' START TIMER       <------ No it doesn't
    @ INT_RETURN
        RETURN
    Also, verify that your oscillator is actually running at the expected frequency. A simple LED blinking at 10Hz will tell you if it's off bu a factor of 2.

    /Henrik.

Similar Threads

  1. HPWM ....use Timer0?
    By HankMcSpank in forum General
    Replies: 2
    Last Post: - 18th June 2011, 09:18
  2. Help with Comparator and Timer0
    By dbachman in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 14th February 2009, 20:19
  3. I2C post write/read 10ms pause mandatory?
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 18th May 2008, 18:06
  4. Replies: 4
    Last Post: - 18th May 2008, 18:00
  5. Performing a loop every 10ms
    By wasssup1990 in forum mel PIC BASIC Pro
    Replies: 40
    Last Post: - 15th February 2008, 10:31

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