Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Is it possible to change the clock source for a PIC.

Status
Not open for further replies.
Hello,

I wanted to know if it is possible to change between the internal rc oscillator and an external oscillator midway through a program. Currently, the program i've written runs off the internal 4 MH z oscillator, but i want to change to a high speed external oscillator so i can recieve GPS. Is this possible?

thanks.
 
Ok, i'll try it with the 4MHz oscillator. I know the 4 Mhz can go as high as 9600, but 9600 is not a multiple of 4 Mhz so the will be some error whatever a value is loaded in to SPBRG.

thanks for your help,
ed.
 
Which PIC is it that you're running? If it's the 16F628, bit BRGH in the TXSTA register has to be set (in "High" mode) with an error code of 0x19 (or decimal 25) for 9600 baud on a 4MHz oscillator with only a 0.16% error (actually comes out to 9615). There's always going to be SOME error...you can never get them perfect, which is why they allow a certain amount of tolerance percentage.
 
I use the 16F886 and switch between internal and external. Set the config to external and then set bit 0 of OSCCON to switch to internal.

Mike.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top