Weird Servo Speed Control problem
You should set counter before the loop at the beginning of the conditional blocks. 

Also, you can use the same counter for both outer loops. 

The inner loops can be replaced by __delay_us (counter). 

Apart from that, it looks like it should ramp the PWM nicely. 

Your PIC supports PWM on two ports, which automates what you are doing in software. Try that, because your delay programmed function will be very awkward to program around once you try to do something else as well.