some more things to consider
1.
you have not set any individual timer resource options [ CCPTMRS0 ]Many devices allow a selection of Timer resource for some or all of the PWM
channels. The HPWM command will automatically determine the preset Timer
selection upon execution. Note that PWM channels that share a single timer may
not operate at independent output frequencies. While duty-cycle settings are
always independent from one channel to the next, independent frequency settings
require independent timer resources.
so
settings get overwritten by use oft2con=4
PR2 = 255
hpwm 2 , duty1, 2000
2.
you have not specified how your "pot" is connected , if its connected between vdd an ground then use of a fvr of 2.048 v is totally inappropriate and
may even damage your chip. analogue in voltage should never exceed vref
3.
all your trouble was probably caused by incorrect adc settings , hpwm1 should now work
Bookmarks