Use POT or RCTIME statement. Must add an external capacitor prior to make it work. Input must be set to analog too. CMCON=7.