Hi Mengckid,

Your Pic has the hardware PWM built-in so it is your best choice.
Your program can read the ADC (pot) and update the speed variable
and the hardware PWM does the rest.
Depending on your motor voltage & current draw you may need to
consider your Mosfet circuit. Your Mosfet's voltage rating should be
at least twice your DC supply voltage. You need a clamp diode connected
across your motor (cathode to M+ anode to M-).
Your Mosfet has 2 losses that generate heat, conduction loss (dc current squared times the rds on resistance). example 2 Amps x 2 Amps x .1 ohm = .4 watts, requiring a heat sink. The Mosfet has a large gate capacitance that can give slow turn on & turn off times (switching losses). I prefer to use a mosfet driver IC such as TC4426 or TC4427.

The code:
IF SPEED > SPD THEN SPD = SPD + 1 'accelerate
IF SPEED < SPD THEN SPD = SPD - 1 'de-accelerate
will slowly icrement the PWM SPD by + or - 1 count per loop.
This acts like a "soft start" reducing the inrush starting current
and also a filter effect for your pot voltage. You can easily modify to
speed the accelerate/de-accelerate response.

Have fun!

Mark