4.6.1.16 Oscval Option

The -moscval=value option allows you to specify the hexadecimal value that will be used to calibrate the oscillator for some PIC10/12/16 devices. The calibration value is usually preprogrammed into your device; however this option allows you to specify an alternate value, or the original value if it has been erased from the device.

The calibration value is stored at the top of program memory, encapsulated into a movlw instruction. The runtime startup code executes this instruction and stores the WREG into the calibration register. The option -moscval=55 would ensure that the value 0x55 is loaded to the oscillator calibration register at startup (see 5.2.9 Oscillator Calibration Constants). Using the -mno-oscval form of this option (even with an argument), or not specifying any -moscval option, will result in the calibration register being programmed with whatever value is currently stored in the device.