Replace PBP with Assembly concerning Timer0


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Wink

    Hi selbstdual,

    what do you need to count exactly? Events, internal clock tick, amount of hair lost in the process?

    Well.. what's your current project?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  2. #2
    Join Date
    Aug 2006
    Location
    In a world of german electrons
    Posts
    102


    Did you find this post helpful? Yes | No

    Unhappy

    Hair ? Is this a joke ? I kept on laughing the whole day. Very funny.

    It is about counting the time until CMCON.6 gets a high level.

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Unhappy Rtfds ???

    Just connect pin 2 (C1OUT) to pin 9 or 12 ... and read TMR1H and TMRIL just when needed ...

    Details are in that ****ING DATA SHEET... fig 7.1

    Alain

    PS: No hair lost ... was a pleasure !!!
    Last edited by Acetronics2; - 18th February 2007 at 19:31.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    OR, stop the timer on a comparator interrupt...

    In meantime, is there a specific time range?

    I'll be back...
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Aug 2006
    Location
    In a world of german electrons
    Posts
    102


    Did you find this post helpful? Yes | No

    Default Let's progress

    There is no TMR1H and L as TMR0 is 8 Bit. I cannot use TMR1 as I am using the compare-module. Additionally, Pin2 and Pin12 are used.

    I would need to check for the timer to overflow in the loop instead of reading its value. As basic is not machinecode I don't know how many tics I am missing by that method, you know ...

    MisterE: Interrupts are disabled(INTCON = 0), I am just looking at the 'time' it takes for the comparator's output to change.

    What do you mean by time range ?

    Before we go too much into detail here: Using my method compared to the built in timer, how many more ticks does the built in timer notice ?
    Last edited by selbstdual; - 18th February 2007 at 19:16. Reason: Clarify

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by selbstdual View Post
    What do you mean by time range ?
    Min and Max expected delay between the time you Start the Timer and 'till the comparator's output will change.

    Before we go too much into detail here: Using my method compared to the built in timer, how many more ticks does the built in timer notice ?
    Hard to say, but it can be measured with a scope + extra I/O OR by using something like Darrel suggested bellow...
    http://www.picbasic.co.uk/forum/showthread.php?t=365

    i'll do something simple here to help you to start. i think you're not as this far anyway.

    stay tunned
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  7. #7
    Join Date
    Aug 2006
    Location
    In a world of german electrons
    Posts
    102


    Did you find this post helpful? Yes | No

    Default

    Currently I get values between 1800 and 400 for 'Value'. Whatever, don't hurry to answer this question because my current implementation works already. This is just for finetuning...
    Last edited by selbstdual; - 18th February 2007 at 21:34.

  8. #8
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default Why don't you use interrupts?

    Hi,

    I would prefer using interrupts.

    Your TIMER_ZERO is already a word variable. So on a timer zero interrupt you can just increment the HighByte of the variable and normally dump the TMR0 to the lowbyte. This would make a pseudo 16bit timer. On a comparator interrupt, get the readings. It should not be very difficult in ASM . By the way what is your clock frequency and your timer0 prescaler value ? If you are using a high prescale then Darrel's Instant Interrupt may work.
    Regards

    Sougata

Similar Threads

  1. Assembly Language inside PBP
    By Bill Legge in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 12th October 2009, 21:52
  2. Replies: 2
    Last Post: - 8th February 2009, 05:10
  3. 4 Chanel Dmx512 ready assembly code to PBP ?
    By syscoder in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 21st March 2007, 23:55
  4. Passing arrays PBP <-> Assembly
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th April 2006, 01:01
  5. Assembly Language + PBP
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th January 2006, 13:54

Members who have read this thread : 0

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