sagor1 ...from the data sheet
INTERNAL 4 MHz OSCILLATOR
When calibrated, the internal oscillator provides a fixed 4 MHz (nominal) system clock. See Electrical Specifications. Section 12.0. for information on variation over voltage and temperature.
Two options are available for this Oscillator mode which allow GP4 to be used as a general purpose I/O or to output Fosc/4.
Calibrating the Internal Oscillator
A calibration instruction is programmed into the last location of program memory. This instruction is a RETIN where the literal is the calibration value. The literal is placed in the OSCCAL register to set the calibration of the internal oscillator. Example 9-1 demonstrates how to calibrate the internal oscillator. For best operation, decouple (with capacitance) Voo and Vss as dose to the device as possible.