Questions on PB3 and Timers


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2010
    Location
    Austin, TX
    Posts
    68

    Default Questions on PB3 and Timers

    I have lots of question about PBP 3, Timers, and especially Timer 2. I hope someone can answer at lease some of them.

    I will start with the most important two questions here.

    A few programs out there allow you to select the Instruction Reload time (IRT) in the timer calculations. Very nice, if you know what the instruction reload time is when using PBP 3.

    Example:
    For Timer 0, you need something like this
    Interrupt-routine:
    INTCON.2 = 0 ' clear the int flag
    TMR0 = <some value 0-255>
    '<do something>
    resume

    For Timer 1, you need something like
    T1Word var word
    @T1WORD = TMR0L
    Interrupt-routine:
    PIR1.0 = 0 ' clear the int flag
    T1WORD = <some value 0-65535>
    '<do something>
    resume

    In some cases, you don't need to reload the starting value because rolling over to 0 works just fine for the time period you desire.

    So the question is: When using PBP 3, how can I calculate the IRT when I don't know what assembly instructions PB3 generates to accomplish the reloads and resume? I looked at the list and asm files, but there is weird stuff there that I can't yet decode.

    The second question is about the formula for calculating the interrupt time on Timer 2. I think I have it down for Timer 0 and Timer 1, but Timer two appears to have one less count before it interrupts. T0 & T1 count from 0 lets say to FF or FFFF respectively, and then interrupt on the overflow. While T2 appears to interrupt when it reaches FF and so has 1 less count. Am I reading that correctly?

    Thanks for any help.

    PickyBiker
    PickyBiker says, "Riding a motorcycle eases programming frustration".

  2. #2
    Join Date
    Mar 2010
    Location
    Austin, TX
    Posts
    68


    Did you find this post helpful? Yes | No

    Default Re: Questions on PB3 and Timers

    These questions were answered in another forum
    http://support.melabs.com/threads/753-PBP3-and-Timers
    PickyBiker says, "Riding a motorcycle eases programming frustration".

Similar Threads

  1. Timers and Interrupts
    By senior project1 in forum Off Topic
    Replies: 2
    Last Post: - 25th November 2008, 14:17
  2. Timers
    By mitchf14 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 15th November 2008, 20:08
  3. Timers !
    By n qwerty in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 22nd August 2007, 11:39
  4. Timers perhaps?
    By Doormatt in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th June 2007, 16:02
  5. Count Down Timers
    By CocaColaKid in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th October 2005, 17:34

Members who have read this thread : 1

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