Put a 1K resistor in series from the LiPo battery to A.0 PERIOD.It's just safe engineering practice. I don't see a need to post the code, or parse the replies any further.
I have a button read subroutine that must set the pin to an input before reading it. Something in the program, totally unrelated to that pin, is setting it to an output low. Sound familiar? Now, I can go through every subroutine and watch that line to find out EXACTLY what is tripping the pin to be an output, or I can make sure it is an input before I read it. I choose to set it to a known state before I rely on the test. If it is an output, the reading will be unreliable. I won't lose the chip. In your case, you will. If you have the time, go ahead and see what is causing the problem. Connecting any port directly to B+ is a very bad idea.
Ron
Bookmarks