Try add flags = 0
I usually eliminate POT from circuit & tie pin 3 to ground
The PIC 16F877a has power and ground pins on both sides of the chip, make sure both sides are hooked up
I did not see any config statement in that code, so how it is running or not is anyone's guess, are you sure it is? Try making a blinking led to be sure.
The code below is the 16F877A.inc file from my v2.6 install
Notice it says XT_OSC, this is incorrect for your 20 mhz osc, it should say HS_OSC, for any resonator and crystals above 4 mhz, this is an oscillator power setting, either change it here or comment this line out and put the config in your code. This statement assumes you are using a version older than 3.0Code:;**************************************************************** ;* 16F877A.INC * ;* * ;* By : Leonard Zerman, Jeff Schmoyer * ;* Notice : Copyright (c) 2003 microEngineering Labs, Inc. * ;* All Rights Reserved * ;* Date : 11/06/03 * ;* Version : 2.45 * ;* Notes : * ;**************************************************************** NOLIST ifdef PM_USED LIST include 'M16F87xA.INC' ; PM header device pic16F877A, xt_osc, wdt_on, lvp_off, protect_off XALL NOLIST else LIST LIST p = 16F877A, r = dec, w = -302 INCLUDE "P16F877A.INC" ; MPASM Header __config _XT_OSC & _WDT_ON & _LVP_OFF & _CP_OFF NOLIST endif LIST
It is always better to copy paste your code than a link to somewhere,however; a link does make a good supplemental.




Bookmarks