To calculate a constant for a different crystal frequency


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    May 2009
    Location
    Montreal, QC, Canada
    Posts
    118

    Default To calculate a constant for a different crystal frequency

    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

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    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/atta...achmentid=2957
    <br>
    DT

  3. #3
    Join Date
    May 2009
    Location
    Montreal, QC, Canada
    Posts
    118


    Did you find this post helpful? Yes | No

    Default

    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

  4. #4
    Join Date
    May 2009
    Location
    Montreal, QC, Canada
    Posts
    118


    Did you find this post helpful? Yes | No

    Default

    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

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    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.

    Code:
    ; -----------------  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,
    DT

  6. #6
    Join Date
    May 2009
    Location
    Montreal, QC, Canada
    Posts
    118


    Did you find this post helpful? Yes | No

    Default

    That's great information.

    Thank you

    Mike

Members who have read this thread : 2

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