Home

AT2XTKB Keyboard Converter  -  OSCCAL Value in PIC12F629 Chip


OSCCAL

When programming firmware into the 12F629 chip using an EPROM programmer (or PIC programmer), your programmer may refer to something called the "OSCCAL" value.  You may even be asked to enter that value.

What is it ?

OSCCAL is a shorted form of oscillator calibration.

The 12F629 contains an internal 4 MHz oscillator, and that oscillator has a specified accurary of 1%.  To achieve that accuracy, at the factory, a unique OSCCAL value is calculated for each 12F629 chip produced, and that value stored within the 12F629 at the end of the program memory (specifically at address 0x3FF).

Example values are 34A3, 3405, 34BC.  For a reason that I don't need to explain here, the value always starts with '34'.

For the OSCCAL value to actually get used (use is optional if 1% accuracy is not required), the firmware author codes their firmware so that at power-on time, the OSCCAL value is fetched from the end of the program memory, and then placed into the OSCCAL register (one of the 12F629's Special Function registers).

If your application of the 12F629 uses the internal 4 MHz oscillator, and the 1% accuracy is required, then obviously, the factory supplied OSCCAL value stored at the end of the program memory must never be accidentally changed.  Some people read the value and then write it on a label that they stick to the top of the 12F629.

Some EPROM programmer software may:
•  have no regard for the OSCCAL value in program memory, expecting that the operator knows exacly what they are doing; or
•  pop up a window showing the operator the current OSCCAL value in program memory, and giving the operator the ability to alter it; or
•  behave differently to the above.


As Used in the AT2XTKB

The OSCCAL value is used by the AT2XTKB's firmware, so one must be present.

It is highly unlikely that the AT2XTKB requires 1% accuracy of the internal 4 MHz oscillator.  Chuck(G) at the VCFF, the firmware author, confirmed that with, "And yes, the 'slop' in frequency is pretty wide for this application."

In my early days of building AT2XTKB units, I did not know about the OSCCAL value, and I was in ignorance overwriting it (with some kind of default value I think, possibly 3480).  I am very positive that it did not affect operation of the AT2XTKB converter.

So, if you do accidentally/unintentionally lose the factory supplied OSCCAL value in the 12F629 chip of your AT2XTKB, then I suggest that you use the 'center frequency' OSCCAL value of 3480.