Hi ken you send schematic or some help who i made that...

my pic is pic18f252 and i conect to the pwm pin with 2 res. one to ground and the other to the gate in the same line like a volt divider..

my code

MotorDC VAR CCPR1L
MotorOut VAR PORTC.2
MotorOn CON %1111110 '16 Pre/Scale
MotorOff CON %1111010
MotorEnable VAR T2CON

PumpDcSet=15
CurrentStep = 0 to 100 of rc pulse
MotorScaleFactor = 255 - 15
MotorScaleFactor / CurrentStep

MotorDC = MotorScaleFactor / 100 * CurrentStep + PumpDcSet

Pause PauseScalefactor * 1000 / MotorScaleFactor Factor