Welcome to EDAboard.com

Welcome to our site! EDAboard.com 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

Status
Not open for further replies.

arif01230

Member level 2
Joined
May 22, 2012
Messages
53
Helped
4
Reputation
8
Reaction score
4
Trophy points
1,288
Activity points
1,565
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? !!!!!...
 

milan.rajik

Banned
Joined
Apr 1, 2013
Messages
2,528
Helped
540
Reputation
1,078
Reaction score
523
Trophy points
1,393
Activity points
0
Zip and post your complete mikroC PRO PIC project files. I will check if oscillator is configured properly and also other config bits.
 

arif01230

Member level 2
Joined
May 22, 2012
Messages
53
Helped
4
Reputation
8
Reaction score
4
Trophy points
1,288
Activity points
1,565
compiler mikroC not mikroC pro
 

Attachments

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

milan.rajik

Banned
Joined
Apr 1, 2013
Messages
2,528
Helped
540
Reputation
1,078
Reaction score
523
Trophy points
1,393
Activity points
0
I checked the project and the config bits were set properly. Maybe the Compiler generated wrong config bits due to bug.
 

paulfjujo

Advanced Member level 4
Joined
Jun 9, 2008
Messages
1,429
Helped
290
Reputation
580
Reaction score
275
Trophy points
1,363
Location
France 01800
Activity points
10,025
hello,

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.
 

zuisti

Advanced Member level 1
Joined
Jul 2, 2004
Messages
480
Helped
188
Reputation
376
Reaction score
184
Trophy points
1,323
Location
Hungary
Activity points
3,297
Hi arif01230;

Paragraph 9.2.5.1 of datasheet:
EXAMPLE 9-1: CALIBRATING THE INTERNAL OSCILLATOR

In mikroC:
Code:
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:

arif01230

Member level 2
Joined
May 22, 2012
Messages
53
Helped
4
Reputation
8
Reaction score
4
Trophy points
1,288
Activity points
1,565
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?
 

aashitech

Member level 4
Joined
Oct 7, 2008
Messages
77
Helped
33
Reputation
66
Reaction score
32
Trophy points
1,298
Location
Uttar pradesh (INDIA)
Activity points
1,902
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.
 

arif01230

Member level 2
Joined
May 22, 2012
Messages
53
Helped
4
Reputation
8
Reaction score
4
Trophy points
1,288
Activity points
1,565
I needs the name of the bits of 0 1 2 3 4 5 6 7 8 as shown in picture
 

Attachments

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

milan.rajik

Banned
Joined
Apr 1, 2013
Messages
2,528
Helped
540
Reputation
1,078
Reaction score
523
Trophy points
1,393
Activity points
0
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.
 

aashitech

Member level 4
Joined
Oct 7, 2008
Messages
77
Helped
33
Reputation
66
Reaction score
32
Trophy points
1,298
Location
Uttar pradesh (INDIA)
Activity points
1,902
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.
 

ard

Full Member level 5
Joined
May 3, 2009
Messages
252
Helped
52
Reputation
104
Reaction score
50
Trophy points
1,308
Location
Mumbai, India
Activity points
2,783
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.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top