Fixed calculating PWM