Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PIC12F675 internal oscillator calibration problem for SIRC Sony ir remote control

Not open for further replies.


Member level 2
May 22, 2012
Reaction score
Trophy points
Activity points
in my SIRC Sony ir remote control project I use PIC12F675 (internal RC no clock out using MikroC).

In hardware two (2) PIC12F675 working fine out of twenty (20) PIC12F675,but if I connect external crystal (4MHz) then all PIC12F675 work properly.

I use 1838 receiver(38KHz) module.

How can I solve this internal oscillator calibration problem? !!!!!...

Zip and post your complete mikroC PRO PIC project files. I will check if oscillator is configured properly and also other config bits.

compiler mikroC not mikroC pro


  • GP3 as RX Prob.rar
    54.8 KB · Views: 87

I checked the project and the config bits were set properly. Maybe the Compiler generated wrong config bits due to bug.


What about Calibrating the Internal Oscillator ?
and OSCAL value ?

see paragraph 9.5.1 of datasheet

A calibration instruction is programmed into the last
location of program memory. This instruction is a
RETLW XX, where the literal is the calibration value.
The literal is placed in the OSCCAL register to set the
calibration of the internal oscillator. Example 9-1
demonstrates how to calibrate the internal oscillator.
Hi arif01230;

Paragraph of datasheet:

In mikroC:
void main(void) {

    RP0_bit = 1;      // or STATUS.F5 = 1; // switch to BANK 1
    asm call 0x3FF;
    asm movwf OSCCAL;
    ...... // rest of the main function :-)
Last edited:
Erasing the device will also erase the pre-programmed
internal calibration value for the internal oscillator. The calibration value must be saved prior to erasing part as specified in the PIC12F629/675 Programming specification. Microchip Development
Tools maintain all calibration bits to factory settings.

How to programmed PIC12F675 so that internal calibration value for the internal oscillator not to Erase? and re-use same Chip?

First tell us which programmer are you using ? most of the programmers will preserve the factory programmed calibration values BUT still it is possible that some programmers may not support this or have this thing supported with some "optional" setting. To rule out any such thing i recommend you use PICkit2 as device programmer . PICkit2 also support regeneration of this calibration value if this factory programmed value gets erased accidentally/mistakenly.
I needs the name of the bits of 0 1 2 3 4 5 6 7 8 as shown in picture


  • Config bit.png
    Config bit.png
    97.2 KB · Views: 96

Zip and post the latest mikroC PRO PIC project files. I will see if the config bits in the IDE match the config bits in PICKit3.

Dear Arif ,
It`s not a good programming practice to set configuration bits through writer/programmer configuration word setting , instead you should read thoroughly the manual of your "C" compiler / "IDEs" there you will find a way to define configuration word settings using a macro or some define . Generally all major "C" compilers or IDEs support some way of declaring configuration word inside source file and same will be generated in resulted .hex file from where Pickit2/3 etc will get/load the configuration value automatically , so by doing this you are at no risk of getting configuration word corrupted/wrongly set at every loading instance of the target .hex file.
As Ashish pointed out, the easiest way to regenerate OSCCAL is by using a Pickit2.

If not that, write a simple program to serially load values from 3400 to 34ff into the OSCCAL register, and monitor it (the value you've just written) on a serial terminal emulator (Hyperlink/Coolterm..)

You'll start getting garbage, until suddenly you start getting legible numbers. Make a note of the 34?? starting value, and the end value; the mean should be your OSCCAL value, which you can manually burn at the right address.

Crude, but it works. I've resurrected many 12F6xxs using this technique before the Pickit2 was made available.
Not open for further replies.

Part and Inventory Search

Welcome to