@Charlie,
Wat code is this ?
OSCCON = 0b01100111; // internal OSC set to 4MHZ
I can't find anything about this code into the datasheet.
Code:
bit 7 Unimplemented: Read as ‘0’
bit 6-4 IRCF<2:0>: Internal Oscillator Frequency Select bits
111 = 8MHz
110 = 4 MHz (default)
101 = 2MHz
100 = 1MHz
011 = 500kHz
010 = 250kHz
001 = 125kHz
000 = 31 kHz (LFINTOSC)
bit 3 OSTS: Oscillator Start-up Time-out Status bit(1)
1 = Device is running from the external clock defined by FOSC<2:0> of the Configuration Word register
0 = Device is running from the internal oscillator (HFINTOSC or LFINTOSC)
bit 2 HTS: HFINTOSC Status bit (High Frequency – 8 MHz to 125 kHz)
1 = HFINTOSC is stable
0 = HFINTOSC is not stable
bit 1 LTS: LFINTOSC Stable bit (Low Frequency – 31 kHz)
1 = LFINTOSC is stable
0 = LFINTOSC is not stable
bit 0 SCS: System Clock Select bit
1 = Internal oscillator is used for system clock
0 = Clock source defined by FOSC<2:0> of the Configuration Word register
BTW, if we use this pins as programmed we can't use rs232 communication in the future and for now no incircuit programming.