Menu

Timer clarification

Help
2010-08-30
2013-05-30
  • Nobody/Anonymous

    if i have a 8mhz osc, and a 1/8 prescaler, then i start and stop my timer1, what is the units of the timervalue? i want to be able to measure time between start and stop in microseconds.

     
  • Capaction

    Capaction - 2010-09-10

    May be you will clarify the TIMERx  useage with this free tool:

    http://pictimer.picbingo.com/

    It looks nice, I did not use it yer.
    Let us know your experience please.

     
  • pico

    pico - 2010-09-10

    I use this for timer0 with no prescaler, tick_interval defined in ns
    #define TICK_Clk TICK_INTERVAL*ChipMHz/4000
    If you use this formula and add /8 for the prescaler value 8, then the result is 250 clk.
    subsequently one ms equivales to a timer value of 250
    With a error of 2.4% you could simply use the high byte of timer1 in order to read ms (max 256) directly.
    It´s possible to calibrate the chip in such a way that the internal resonator is off 2.4% in order to compensate the
    error on some chips.  Hope this helps

     
  • pico

    pico - 2010-09-10

    for microseconds , you should change the prescaler to 2 and you can read directly microseconds, otherwise you must multiply(shift) the result by 4(2) .

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.