Capture without CCP


Closed Thread
Results 1 to 6 of 6

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by boroko View Post
    I spent the last 6 hours learning that when you load TMR1, you need to load TMR1H first, before TMR1L.
    Yes, with RD16 set, you load the highbyte first, then when you load the lowbyte, both bytes a written to the timer at the same time.

    But when reading a timer with RD16, you have to read the lowbyte first. That puts the highbyte in a buffer that can be read in the next instruction.

    If you read the highbyte first, you get the value that was left in the buffer the last time you read/wrote the timer, then the lowbyte of the current timer value.

    Also, when using RD16, you don't need to stop the timer when reading or writing to the timer.

    For something like this where you need Critical timing ... the interrupt handlers should be ASM. Saving/Restoring PBP's system variables to get in/out of a PBP interrupt will throw the results off considerably.

    None of the statements in your handlers use any PBP system variables. So you can just change the handers "type" to ASM without actually having to write it in ASM.

    hth,
    DT

  2. #2
    Join Date
    Feb 2008
    Location
    Michigan, USA
    Posts
    231


    Did you find this post helpful? Yes | No

    Default tidbits..

    Thanks guys,

    Alain, I had not thought to look at the mid-range ref manual. Seeing how they handled it helped to see it better. The longer I'm at the less I'm scared by the asm. I may not be able to write it very well, but it is getting easier to see how it works. I'm not religious about a particular method. I'm interested in results and PBP has given me the best chance to get powerful ones with the least amount of pain.

    Darrel, thanks for going over these details. I was having a blind spot pulling them out of the data sheet.

    It may seem like a small thing to you guys, but your assistance has helped me (and I'm sure others) get through things that in the past, would have pushed me to give up on out of pure frustration.

    Bo

    Wohoo! Stable numbers echoing back! Thank you so much.....
    Last edited by boroko; - 26th March 2009 at 22:13. Reason: update:

  3. #3
    Join Date
    Feb 2008
    Location
    Michigan, USA
    Posts
    231


    Did you find this post helpful? Yes | No

    Default

    None of the statements in your handlers use any PBP system variables. So you can just change the handers "type" to ASM without actually having to write it in ASM.
    I guess that means I don't need to include ReEnterPBP-18.bas either. Do I understand that correctly?

    Bo

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


    Did you find this post helpful? Yes | No

    Default

    Correct!

    Including the file will use some additional RAM and program space that isn't needed.

    But it won't adversely affect the program if it's there.
    <br>
    DT

Similar Threads

  1. mS Timer
    By whmeade10 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th September 2020, 12:12
  2. Using hardware capture
    By Bruce in forum Code Examples
    Replies: 14
    Last Post: - 25th March 2012, 05:52
  3. Measuring change of frequency with PIC
    By Aussie in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 19th July 2007, 01:47
  4. continious counting process (capture)
    By asynch in forum General
    Replies: 1
    Last Post: - 17th February 2006, 07:42
  5. CCP question
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 5th December 2005, 17:08

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