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
.
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
Not discussing the port method, that is surely the best one. About clock() function I'm working with MCB2300 and don"t have search feature implemented (neither with RTX included). Well what it would be using as a base time ? (RTC does not provide a us accuracy, in my case 1s/2^15)
If you use a other hardware timer, you may read TC after N interrupts, calculate mean TC/N and convert it to time. Be aware of you timer resolution, and when its resetting.
But in fact measuring T1 accuracy with T2 that would have the same accuracy has something tricky.
I'm working with MCB2300 so what does this have to do with a '51? But in fact measuring T1 accuracy with T2 that would have the same accuracy which is not true for a '51
Erik
I'm working with MCB2300 so what does this have to do with a '51? The way we check the include files is the same. I mean : look at your include file list and check for time.h & clock() presence. http://www.keil.com/support/man/docs/c51/c51_library.htm
which is not true for a '51 That does not change the conclusion :)