Expanding Timer1 counting range


Results 1 to 15 of 15

Threaded View

  1. #5
    Join Date
    Dec 2007
    Location
    Malaysia
    Posts
    20


    Did you find this post helpful? Yes | No

    Default

    Yeah, I did make TMR1H = $FC, TMR1L=$18, which is obtained from 65536-1000. But the timer does not give me 1ms interval. I do not know what is wrong. Below is my program:

    'MAIN PROGRAM
    '------------
    ResetTimer:
    GoSub SetReg
    LCDOUT $FE, 1
    Timer1H = 0
    Timer1L = 0
    Result = 0
    TimerOverflow = 0

    Main:
    LCDOUT $FE, $80, "Test Mode 1"
    LCDOUT $FE, $C0, "Visual Response Test"
    If ButStart = 1 Then goto StartTimer
    Goto Main

    StartTimer:
    LCDOUT $Fe, 1
    LCDOUT $FE, $80, "Calculating..."
    T1CON.0=1

    Looping:
    While PIR1.0=0
    Wend
    PIR1.0=0
    TimerOverflow=TimerOverflow+1
    LCDOUT $FE,$C0,DEC5 TimerOverFlow
    If ButStop = 1 Then goto StopTimer
    Goto Looping

    StopTimer:
    T1CON.0 = 0
    LCDOUT $Fe, 1
    GoSub GetValue

    DisplayResult:
    Result = TimerOverflow
    LCDOUT $FE,$C0, dec5 Result
    If ButStart = 1 Then goto StartTimer
    If ButReset = 1 Then goto ResetTimer
    goto DisplayResult


    'SUBROUTINES
    '===========
    'Reset Timer1 Register to Start from 1ms interval
    '-------------------------------------------------------
    SetReg:
    TMR1H = $FC
    TMR1L = $18
    Return

    Is there anything wrong with the program that cause the Timer unable to display 1ms interval timing on LCD?
    Last edited by sycluap; - 13th January 2008 at 14:57.

Similar Threads

  1. Software PWM using Timer1
    By muqasim in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th December 2009, 11:49
  2. Help with TIMER1 + SLEEP
    By Yodoad in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 22nd May 2009, 15:07
  3. Time Period of Timer1
    By arnol34 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 4th May 2007, 00:31
  4. continious counting process (capture)
    By asynch in forum General
    Replies: 1
    Last Post: - 17th February 2006, 07:42
  5. Timer1 and Interupt wierdness
    By mind in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 23rd August 2005, 01:24

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