Thanks Steve but I think Melanie is right - time for a lot of beer. Followed your code exactly and the PWM still comes out on RB0. Do you have any other ideas I can try when I get sober?