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 CCS Technical Support

Get MCU running frequency in a variable ( realtime)

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



Joined: 01 Feb 2012
Posts: 63

View user's profile Send private message

Get MCU running frequency in a variable ( realtime)
PostPosted: Sun Feb 05, 2012 8:36 pm     Reply with quote

ok , so i wanted to ask this in my previous thread about this but from some strange reason i am returned to index when i press "post reply" button..(yes..i am logged in)..anyway..
I want to run my 16f88 with a external clock source that is variable..so i will have a variable MCU speed..question is how can i get the current speed that the MCU is running in a variable? the speed update must happen fast..i need this for calculating a formula that is based on the MCU system clock. Thank you forum
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Mon Feb 06, 2012 2:43 am     Reply with quote

You can't, unless you have some other clock that is constant available.
It is trivial to do if (for instance) you have timer1 running off an external 32KHz crystal, where you can just take a measured interval using this, and count how many processor clock cycles this involves, but without another reference you are basically stuck.
You could get a 'rough' estimate based upon doing something like charging a capacitor from a pin and timing how long this takes to discharge through a fixed resistor, again counting processor cycles.

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