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

PIC12F675 < internal oscillator

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



Joined: 27 Jul 2007
Posts: 2

View user's profile Send private message

PIC12F675 < internal oscillator
PostPosted: Fri Jul 27, 2007 3:59 am     Reply with quote

Does anybody know how to set up the oscillator calibration value on the PIC12F675 ? There's this guy that uses this code with the MikroC - compiler and the code is like this:

//////////////////////////////////////////////////////////////////////
// Extract oscillator calibration value from location 0x3ff and use.
void get_set_osc_cal(void) {
#ifndef debug
asm {
bsf STATUS, RP0 // ; Bank 1
call 0x3ff // ; Get the cal value
movwf OSCCAL // ; Calibrate
bcf STATUS, RP0 // ; Bank 0
}
#endif
}
And his homepage is:
http://www.best-microcontroller-projects.com/12F675.html
thanks,
Ttelmah
Guest







PostPosted: Fri Jul 27, 2007 4:30 am     Reply with quote

It is done automatically for you. If the internal oscillator is selected, at the very start of the code generated for the 'main', the compiler automatically calls the 0x3FF location, and puts the value returned into OSCCAL.
For example, this is the first few lines of the program code, generated, for a 12F675, wth the internal RC oscillator selected:
Code:

0004:  CALL   3FF
0005:  BSF    03.5
0006:  MOVWF  10
0007:  MOVLW  00
0008:  MOVWF  0A


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