at the end of your program, you should or finish by a STOP command or with an endless loop, unless your PIC may behave in a weird way.
You may also need to check if ALL ADCs and comparators are disabled. Here i see 2 missing linesCode:Here: GOTO Here
And then what you drive and how, may help us to go deeper in our understanding.Code:ANSELH = 0 CM2CON0 = 0
HTH
Bookmarks