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?
Bookmarks