Hi,
I am trying to run a PIC18F4550 at 3.3V using its internal oscillator. My code is as follows:
The PIC runs properly but much slower (around 8 times) when compared with a 16f with a 8Mhz external crystal. For example, the following FOR loop:
for (i=0; i<500; i++);
delays around 1 millisecond on a 16f with 8MHz crystal. But on this PIC, it delays for 8 milliseconds.
I have tried to enable the PLL (x4) using OSCTUNE but that does not seem to have any effects. Is there a divider somewhere that divide the internal oscillator frequency before using it? Or it it because I run at 3.3v and everything is slower. The datasheet says that this PIC can run from 2V to 5V.
Thanks for any advice.
I am trying to run a PIC18F4550 at 3.3V using its internal oscillator. My code is as follows:
#pragma config WDT = OFF
#pragma config MCLRE = OFF
#pragma config FOSC = INTOSC_HS //Internal oscillator, port function on RA6, HS crystal used by USB
#pragma config BOR = OFF
#pragma config LVP = OFF //to be able to use RB5
#pragma config PBADEN = OFF
#pragma config ICPRT = OFF
#pragma config PLLDIV = 1
....
OSCCON = 0b01110000; //8Mhz internal oscillator
The PIC runs properly but much slower (around 8 times) when compared with a 16f with a 8Mhz external crystal. For example, the following FOR loop:
for (i=0; i<500; i++);
delays around 1 millisecond on a 16f with 8MHz crystal. But on this PIC, it delays for 8 milliseconds.
I have tried to enable the PLL (x4) using OSCTUNE but that does not seem to have any effects. Is there a divider somewhere that divide the internal oscillator frequency before using it? Or it it because I run at 3.3v and everything is slower. The datasheet says that this PIC can run from 2V to 5V.
Thanks for any advice.
Last edited: