Added code for software pwm and changed testcode.
Added code for software pwm.