Since you're using the 16F887 which has two CCP-modules the first thing I'd do is the rewire the thing so that the EN-pins of the L298N are connected to PortC.1 and PortC.2 and use HPWM instead.
That way the PWM generation is handled in the background, by the CCP-modules (instead of tying up the processor) and you only need to update it when you want to change the speed. Your program gets a lot of time to do other things.

Then I'd probably set up a timer interrupt to trip every 25ms or something. In the ISR I'd read the sensors and set the PWM dutycycles accordingly.