Thank you for your comment, I will try your suggestion. Just a note: the code works fine on a 16F688 using the same I/O pin GP4.(with minors modifications: TRISIO replaced by TRISA, ANSEL replaced by ADCON1, CMCON line removed). I didn't try to connect directly to my PC.