If you haven't disabled LVP mode, it may acts funny. It may also act funny if you
- haven't connect ALL Vss AND Vdd pins.
- have left MCLR pin floating
- haven't properly set all ADC register properly
- have a noisy PSU, lacking of decoupling cap
- etc