|
|
View previous topic :: View next topic |
Author |
Message |
Slynge
Joined: 27 Jul 2007 Posts: 2
|
PIC12F675 < internal oscillator |
Posted: Fri Jul 27, 2007 3:59 am |
|
|
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
|
|
Posted: Fri Jul 27, 2007 4:30 am |
|
|
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 |
|
|
|
|
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
|