Nicolaas Gerhardus Scheepers of ElectronCraft Says:

OK,

First tip to myself and to you all out there that has problems porting code from the 16F84a to the 16F877 or for that matter to any other MCU.

1. RTFDS - This means "Read The ^#$@%^@#$% Data Sheet"

One big difference between the 16F84 and the 16F877 is the peripherals the 16F877 has extra on board. Some of these peripherals like the A/D needs to have some of the ports setup as analog ports. Microchip in their wisdom decided to make some of the ports analog by default and it took me two weeks to actually find this out.

Use the ADCON1 register to setup the D and E ports as analog or digital. You still have to do all the other setup, do not go and throw your other code out the window.

Let me know how this helped you!!!

P.S. I know we are usually lazy to read the datasheet but I think it is worth your while to take a day or two and thoroughly scan the datasheet before digging in.

HOME