MELabs actually helped me solve this issue over the phone.

If you use MCLR as an input pin, then you need to delay at least two seconds before configuring the osc drive... these are notes I made in my code... and they work.


' Turn PGC (PORTB.6) & PGD (PORTB.7) into inputs (tris.x =1)
' Disable hardware Crystal drive
' Pause ~2 seconds.
' This allows the PIC to reset for programming. Otherwise, it's a hit & miss for programming.