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.Setting the appropriate ANSELA bit high will cause all
digital reads on the pin to be read as ‘0’ and allow
analog functions on the pin to operate correctly
Also, I don't see you're using the ADC for anything yet you're setting ADCON1=7, why is that?
/Henrik.
Bookmarks