Tutorial on software PWM