Once again I am looking for help with what might be a simple topic or yet again, another dopey question. I have written some code for a 12F202 but when I want to program a second or third chip with the same code, I have to adjust the code parameters. This makes me think the differences I’m finding is probably in the internal oscillator.
I have been over the Microchip Memory Programming Specification like a rash, and I see it draws reference to OSC Cal in several places but to be truthful, it may well be written in Swahili, Greek or some other obscure language as either ways it is beyond my comprehension.
Is there a straightforward bit of scratch code anywhere which I can scrounge?
Or can anyone throw a little bit of light on this topic as it is beginning to look a better kept secret than a Harry Potter Spell….
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In most of the 12F series chips, the OSCCAL register allows you to fine tune the internal oscillator up and down from its nominal value.
To accurately set the oscillator, you need some means of measuring its frequency, like a frequency counter, and then if its not what you want, you can vary the value in the Osccal register to move it up and down.
If your code is critical, in so far as needing an accurate oscillator frequency, then you should look at using an external crystal oscillator.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you kindly for your reply. This is the first practical explanation I have come across covering the mystic surrounding this topic.
I had thought and hoped that there would be a code string or a routine I could include which would not necessarily calibrate the internal oscillator at a specific frequency but standardise the oscillator frequency across three or more devices. (I’m not making this too clear am I?)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The Internal oscillators are simply RC oscillators and they drift over time.
Some of the 12F series chips, the 12F675 for example, includes a calibration value in the last memory location when the chip is made, and if you read this value and then write it into OSCCAL it will set initially the frequency to 4 Mhz or close to it.
Unfortunately, many of the programmers for programming PICS wipe the memory map when they first program. so this value gets lost.
What kind of program are you running that needs the internal oscillators to be so precise.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Once again I am looking for help with what might be a simple topic or yet again, another dopey question. I have written some code for a 12F202 but when I want to program a second or third chip with the same code, I have to adjust the code parameters. This makes me think the differences I’m finding is probably in the internal oscillator.
I have been over the Microchip Memory Programming Specification like a rash, and I see it draws reference to OSC Cal in several places but to be truthful, it may well be written in Swahili, Greek or some other obscure language as either ways it is beyond my comprehension.
Is there a straightforward bit of scratch code anywhere which I can scrounge?
Or can anyone throw a little bit of light on this topic as it is beginning to look a better kept secret than a Harry Potter Spell….
Where's tour code?
In most of the 12F series chips, the OSCCAL register allows you to fine tune the internal oscillator up and down from its nominal value.
To accurately set the oscillator, you need some means of measuring its frequency, like a frequency counter, and then if its not what you want, you can vary the value in the Osccal register to move it up and down.
If your code is critical, in so far as needing an accurate oscillator frequency, then you should look at using an external crystal oscillator.
Thank you kindly for your reply. This is the first practical explanation I have come across covering the mystic surrounding this topic.
I had thought and hoped that there would be a code string or a routine I could include which would not necessarily calibrate the internal oscillator at a specific frequency but standardise the oscillator frequency across three or more devices. (I’m not making this too clear am I?)
The Internal oscillators are simply RC oscillators and they drift over time.
Some of the 12F series chips, the 12F675 for example, includes a calibration value in the last memory location when the chip is made, and if you read this value and then write it into OSCCAL it will set initially the frequency to 4 Mhz or close to it.
Unfortunately, many of the programmers for programming PICS wipe the memory map when they first program. so this value gets lost.
What kind of program are you running that needs the internal oscillators to be so precise.