setting PWM Counter and registers yields odd behavior

That doesn't compile. Where is pwm declared?