What pull-up resistor value do you have?

Just for fun try this one
Code:
        CMCON = 7
        DutySelect var bit
        Dutyselect = 0
        gosub ChangeDuty
                           
Main:
        If PORTA.1=0 then
               pause 20
               dutyselect=dutyselect ^1
               gosub ChangeDuty
               while porta.1=0 : Wend
               Pause 20                      
               endif

        goto main                  
        
ChangeDuty:
        If DutySelect then
            hpwm 1,254,2000
            else
                hpwm 1,64,2000
            endif
            
        return