|
|
View previous topic :: View next topic |
Author |
Message |
vijayan
Joined: 15 Nov 2005 Posts: 3
|
TIMERS |
Posted: Wed Nov 16, 2005 3:15 am |
|
|
Greetings to all
ex_stwt.c,ex_stwt1.c,ex_stwt2 .c are examples for measuring time in
secs . Is it possible to measure time in ms and micro secs ? , if so
please help me . I am using 16f877a pic with 20Mhz oscillator --c.vijayan |
|
|
Ttelmah Guest
|
|
Posted: Wed Nov 16, 2005 4:56 am |
|
|
mSec yes. uSec, gets harder.
If the timer used in the example, is reprogrammed to trigger at mSec intervals (I think the examples use between about 50mSec, and 8mSec), then the 'tick', will give a measurement at this level. Going faster than mSec, starts to run into the problems of the latency involved in the interrupts themselves, and the percentage of the time, that the code is spending in the interrupt.
You can relatively easily measure to uSec levels using the hardware CTC, if the chip you are looking at offers one. If you look at EX_CCPMP, this shows this hardware being used to measure a pulse width to better than uSec accuracies (with some limitations on the widths that can be handled). For pulses longer than the timer period, a 'carry' counter will need to be generated as well.
Best Wishes |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|