Hmmm, if you are using a 10k pull-up to VDD and a button to ground, do you have an additional 10k resistor between the button and PORTA.0? If so you have a voltage divider possibility where the Input thresholds occasionally do not exceed min/max, thus the sporadic results. (again, stabbing at unknowns)
Try using 4.7k resistors instead of 10k resistors for isolation. I had a project where I used 10k for MCLR. It was used in a noisy environment where it would occasionally RESET. I replaced the 10k with a 4.7k and the unintended RESET stopped.
Bookmarks