News:

Let's find out together what makes a PIC Tick!

Main Menu

osccal 12F508

Started by hitronics, Sep 09, 2022, 05:45 PM

Previous topic - Next topic

hitronics

Hi,
I have 12F508 so how to get preset value of RC and put inside Osccal register?

shantanu@india

There used to be a Declare Set_OSCCAL. Please check the manual.
Regards
Shantanu

Stephen Moss

The calibration value is usually in the last memory location of the device, you simply read it from there and write it to the OSCAL register. As shantanu@india stated there is a the Set_OSCAL command on page 455 of the manual that will do that for you.

However, I would strongly suggest you read the value and note it as a comment in your code before programming the device. This can usually be done with your programmer either through a special function or simply by reading the device and viewing the program memory. The reason for doing this is two fold...
  • First, if the code becomes large enough to fill the device it will overwrite the calibration value and it would then be lost forever
  • Second, if you ever erase the device before programming and have not selected the preserve OSCAL function in your programmers software (where that is an option) you may find that your OSCAL value has been erased as well.

I learnt the second one the hard way when a cheap early programmer I used had preserving the OSCAL as user selectable op in, rather than an op out which would make more sense.

hitronics

Set_Osccal means, it will get preset value from last location and insert inside Osccal register?