CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

TIMERS

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
vijayan



Joined: 15 Nov 2005
Posts: 3

View user's profile Send private message Yahoo Messenger

TIMERS
PostPosted: Wed Nov 16, 2005 3:15 am     Reply with quote

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







PostPosted: Wed Nov 16, 2005 4:56 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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