Well heres few things i have learned over the years with microcontrollers.
- Crystal oscillator, make sure you have proper bypass capacitor to ground. Keep ground path short as bossible.
- Pin out of chip, check it, check it again just in case.
- Output pins, check datasheet for internal hardware to see what its exactly can do. PIF16F84 had infamous RB4 pin that could not source current at all, could sink it well... Bite me first time i tried to use it... Yes this is old example but very fitting when if comes to pin thats open-drain type output only.
- Options inside program code that can effect how chip behaves, oscillator settings, etc... Make sure you know the default values witch chip comes from factory.
- Always double check your connections. Not a few times i have forgot one wire from breadboard and that missing wire has caused circuit to do strange things...
- Program code itself, are you sure you understand what its doing or is supposed to be doing. I have tons of these, bugs, incompability issues between chips over missing hardware options, etc...
- If anything else fails, go back to basics, read datasheet again, bring out multimeter and just try drive that pin up or down...
Yes, even after all these years i still get bit by some of these still. Live and learn i say. Failure often teaches us more then success.