View Full Version : To calculate a constant for a different crystal frequency
lilimike
- 23rd April 2010, 21:33
Hi,
I am trying to get some information indicated in file "Elapsed_INT" from DT_INT
In the file it reffers to a link which does not exist possibly since this forum changed yesterday.
' ------------------------------------------------------------------------------
' To calculate a constant for a different crystal frequency - see this web page
' http://www.picbasic.co.uk/forum/showthread.php?t=2031
' ------------------------------------------------------------------------------
Is there any way to get to it?
Thanks
Mike
Darrel Taylor
- 23rd April 2010, 23:00
That thread got lost about a year or so ago.
Fortunately, there's something much better from mister-e.
Use the Timer Helper app in this ...
PicMultiCalc V_1.3.1
http://www.picbasic.co.uk/forum/attachment.php?attachmentid=2957
<br>
lilimike
- 23rd April 2010, 23:46
Got it thanks,
I am trying to understand how to use it to calculate what I need, nonetheless it is hard enough for me to even know what I need but is there any tutorial/examples available?
Mike
lilimike
- 24th April 2010, 03:20
I think I will be ok with this after all.
The only thing I don't have a clue what it is for and/or how to apply is the value called "Reload(instr. Cycle)" but it doesn't seam to affect anything.
Mike
Darrel Taylor
- 25th April 2010, 03:17
The "Reload(instr. Cycle)" value is important for Long-Term accuracy.
It represents the number of Clock Cycles (instructions) that it takes to Reload the timer.
In the case of Elapsed_INT ... there are 7 cycles between the point where the timer is stopped until it's been reloaded and turned back on again.
; ----------------- ADD TimerConst to TMR1H:TMR1L
ADD2_TIMER macro
CHK?RP T1CON
BCF T1CON,TMR1ON ; Turn off timer
MOVLW LOW(TimerConst) ;1 1
ADDWF TMR1L,F ;2 1 ; reload timer with correct value
BTFSC STATUS,C ;3 1/2
INCF TMR1H,F ;4 1
MOVLW HIGH(TimerConst) ;5 1
ADDWF TMR1H,F ;6 1
endm
; ----------------- ADD TimerConst to TMR1H:TMR1L and restart TIMER1 ----------
RELOAD_TIMER macro
ADD2_TIMER
BSF T1CON,TMR1ON ;7 1 ; Turn TIMER1 back on
endm
7 is also the default number in mister-e's program, but different reload routines may take longer, or shorter times.
hth,
lilimike
- 25th April 2010, 04:32
That's great information.
Thank you
Mike
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.