As the PIC is being manufactured, a laser is used to trim the RC components to establish the nominal frequency of the internal oscillator. The final step is to test it and write a calibration offset value to the highest location in memory. The Define OSCCAL instruction fetches that factory calibration value and plugs it into the OSCCAL register.
AS long as you do not erase the value, this can be done each time the chip starts up. The melLabs programmers can be set so the calibration value does not get erased. If it does get erased, you can set OSCCAL by measuring the frequency and inputting the necessary offset. To do this you need to configure for the internal oscillator with clock out.
You should perform the calibration whenever using time critical functions like RS232.
Bookmarks