If only Microchip would leave all that stuff turned OFF on power-up, things would be a lot easier.

And this forum would have a couple thousand fewer threads.

Glad you got it working.