Your A/D part looks fine. If GPIO.4 is going high on power-up, it's most likely due to you
not initializing the port latches before writing to the tris register. Port latches are unknown
at power-up so it's a good idea to set the port to whatever you want 1st then write to the
tris register.

I.E. GPIO = 0 followed by TRISIO = whatever. Then you know the pins that are outputs will
be at a certain logic level at POR.

You have trisio = %00101001, a few other init lines, a pause 1000, then you write to the
port. You have no idea what value is on the output pins until you write to the port after the
pause 1000. Which may not be good with your outputs controlling a motor!

Note: Reading or writing to a port does not clear the interrupt on-change flag. This will just
end the miss-match condition, which then allows you to manually clear the flag.

Read the port, then clear the flag, then enter sleep. That may help.