Hey guys, I am using PWM on a motor and I have an LED that flashes after I send the pulse to the motor. When ever the LED flashes the motor revs up really fast. If I disable the LED or leave it on all the time there is no problem, eg. the motor gives a constant speed. Any Idea why this might be?

Thanks , heres my code

DEFINE OSC 20
DEFINE LOADER_USED 1 ;bootloader
main

x var byte
TRISB.1 = 0
TRISa.2 = 0
TRISB.2 = 0
high porta.2
low portb.2
pwm portb.1,150,200

low porta.2
pause 500

goto main
end