what pic do you use ?

sample for 16f876:

TRISA = 255 ' Set PORTA als input
ADCON1 = 0
define OSC 8
DEFINE ADC_BITS 8 ' adc = 8 bits

v1 var byte 'Variable v1 holds pot information

high portc.2
pause 100
High portd.2 'power indicator

main:

adcin 0,v1 'Read resistance of pot
pause 10
Hpwm 1, v1, 10000 'hardware pwm on RC2

goto main


End