I highly dislike the method of trying to initialize ALL the registers at the top of your program.
Unless you know EVERYTHING about that chip, many of them get initialized incorrectly.
This had led to more problems than any other issue.
With the exception of comparators on the older chips ... Everything is turned OFF at power-up.
All you have to do is turn ON the things you want to use.
Don't try to turn everything off, they already are.
Now the first thing people will say is ...
Then why do I have to turn off analog pins with ADCON1 or ANSELx?
It's because you aren't turning the Analog functions OFF, you are turning the Digital Inputs ON.
Analog inputs are always ON, even when the Digital Input is enabled.
So just concentrate on what you want the chip to do, not what you don't want it to do.
Bookmarks