It might be interesting to take a look at Microchip's app notes on vector control. This is the state of the arts technique for motor control. It's actually not as complex as it sounds. The algorithm measures the currents and rotor position and then adjust the 3 PWMs to point the magnetic force directly in the direction of rotation. Maximum efficiency and performance is achieved because no power is wasted, pushing against the center of the rotor.
Microchip has already written the motor code and tuning interface. To use it, you just need to change the current monitoring circuit to a simpler one that connects to the ADC. It would also be good to use a dspic33 variant that has peripherals for motor control.