Darrel Taylor Interrupts and MultiCalc


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: Darrel Taylor Interrupts and MultiCalc

    I'm pretty sure PAUSE messes up the timer routines.

    I think you're supposed to use FOR loops instead.

    Robert


    EDIT: Something like:

    Code:
    for loop = 1 to 500
        pause 1
    next loop

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


    Did you find this post helpful? Yes | No

    Default Re: Darrel Taylor Interrupts and MultiCalc

    He's not using ON INTERRUPT Robert.

    Greg,

    It takes 2 interrupts to turn an LED On and Off. So 200hz interrupts produces a 100 hz flashing led.
    If you want to keep time from 100hz interrupts, that would be too fast.

    Since you want accuracy, you shouldn't just load the timer with a value.
    It takes time to get to the interrupt handler, and the timer has been counting during that time.
    If you just load a value into the timer, that amount of time is lost.

    If you ADD the reload value to the current timer value, it no longer matters how long it took to get to the handler.
    It also takes a certain amount of time to ADD the value to the time, and that time must be accounted for as well.

    Take a stab at the "Timer Template" http://www.darreltaylor.com/DT_INTS-...rTemplate.html
    It does all that stuff for you.

    Use a prescaler of 1.

    It should give exactly 100hz interrupts, down to the exact cpu cycle.
    Close enough to be only a few seconds off after a month or two. Depending on your crystal.
    DT

  3. #3
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Darrel Taylor Interrupts and MultiCalc

    Thank you. It's always nice getting a concise answer to a question. Especially when it is understandable and works.

    Now if I could learn to be more concise asking the questions.

    Regards.

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


    Did you find this post helpful? Yes | No

    Default Re: Darrel Taylor Interrupts and MultiCalc

    Sometimes, it's only after you've gone through the pain, that an answer makes sense.

    Thanks for the original effort.
    DT

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