Pwm Duty Cycle Calculation