Not getting this timer thing.


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: Not getting this timer thing.

    YES!!!
    The test loop adds execution time, which causes your time before check to be longer.
    There are prolly some differences in how you can use timer 1 and timer 2, but if they are set up as counters triggered by fosc/4, they will count the same.

    You have a few choices in how to deal with getting accurate times. the first and always pointed at is to use interrupts. The second is to auto adjust the count while the program is running. to do this, once the timer is greater then target number, subtract target number from the CURRENT timer value. when you reload the timer, reload it with your reload value + the difference just calculated. Mind you, that is for a counter counting up. If using PR (as with timer 2) you can just load timer 2 with the difference. then it will count from adjusted number to PR value, instead of from zero to PR.

    Did any of that make sense? Both methods are valid and useful depending on application. (Thanks PBP members for the auto correct idea)
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: Not getting this timer thing.

    Consider dt-ints and this structure.Name:  INTERRUPT.JPG
Views: 444
Size:  70.9 KB
    don
    amgen

  3. #3
    Join Date
    May 2011
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: Not getting this timer thing.

    I can attain the results I need through the Timer2 and with the serial comms I need to mix in, timer2 is probably the best way. Thanks to all who set me straight on this. I think I understand enough now to get me to the next item I don't understand.

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