This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

get current time in microseconds method

I'm using the Timer 3 and I want to verify that the ISR is being called at the correct interval. I wanted to use a the clock() function but I can't include <time.h>. What should I do??? Thanks

Parents
  • As Andy pointed out the BEST and most accurate method is to toggle a spare port pin on the processor using a scope to watch the timing.

    Even if the processor HAD a real time clock, what makes you think it would be accurate down to microseconds?

    Have you tried the simulator with break points in the ISR? Playing with the simulator first can be helpful (or you can end up making a complicated project if you aren't careful), I suggest using that if you don't know if a timer is firing or when. You will need to set up the sys clock etc. correctly.

    Stephen

Reply
  • As Andy pointed out the BEST and most accurate method is to toggle a spare port pin on the processor using a scope to watch the timing.

    Even if the processor HAD a real time clock, what makes you think it would be accurate down to microseconds?

    Have you tried the simulator with break points in the ISR? Playing with the simulator first can be helpful (or you can end up making a complicated project if you aren't careful), I suggest using that if you don't know if a timer is firing or when. You will need to set up the sys clock etc. correctly.

    Stephen

Children