
Originally Posted by
HenrikOlsson
Hi,
The 16F1829 has analog inputs on PortA, PortB and PortC but you're only disabling it on PortA. You absolutely MUST read the datasheet for these things. A pin in analog mode may seem to work when used as an output (but it will eventually bite you (RMW issue etc)), however when you're trying to read the state of that output pin (which is what you're doing (or originally did) in the ISR it will not give you the correct result. This is also clearly stated in the datasheet:
And the same thing applies for ANSELB and C of course. As you can see, if the ANSELx register isn't set correct any READ of that port-pin will return 0.
/Henrik.
Bookmarks