Modified logic; PxSEL bits are only set AFTER the initial PWM value is written to the CCR register, to avoid glitching due to prior timer runs + prior CCR values being intact.