For a nasty 8 bit resolution ... yuk!!!!
Code:
adcin 0, B0
Read B0
HPWM 1,b0,Frequency
or use the internal ressource to have a 10 bit resolution of your PWM.

everything will be done by your lookup table in the EEPROM.

Look for DATA & READ