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

How to determine time for calculation to execute.

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



Joined: 18 Jul 2006
Posts: 98

View user's profile Send private message

How to determine time for calculation to execute.
PostPosted: Mon Apr 16, 2007 7:44 am     Reply with quote

I am using a PIC16C76.

I have a fairly complicated math routine to calculate the time delay before turning on an output. The variables in the routine can change depending on input states, programmend variables, etc.

Since these variables can be different every time the calculations are made the time it takes to execute the calculation is different.

Does anyone know a way to see how long it takes to execute a certain part of code on the fly? I can see the different times using the Stopwatch fucntion in MPLAB but I need to be able to get this value into the code so I can subtract if from the final calculation to get a correct delay time.

Thanks
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Mon Apr 16, 2007 8:12 am     Reply with quote

How about starting a timer when you collect the data. Then when you are done with the math you read the timer and subtract from your calculated time. Or more likely just let the timer run till it matches your calculated time, then do your I/O. Then you have the precise time between the data collection and the output.
_________________
The search for better is endless. Instead simply find very good and get the job done.
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