Solved

How to set PIC 18F4431 internal oscilator

Posted on 2011-02-15
4
1,542 Views
Last Modified: 2012-05-11
I am confused about how to set the internal oscillator for the PIC 18F4431. I would like to use the chip's internal oscillator and run it at its fastest speed but I am not sure how to do this. The OSC configuration bits and the OSCCON register are not clear to me. I am not sure what OSC = HS implies. Also, according to the datasheet, the fastest speed that OSCCON can be set to is 8 MHz but I read that the 18F4431 can run at 40 MHz. Please help! Thank you!
0
Comment
Question by:0av067
4 Comments
 
LVL 12

Accepted Solution

by:
HappyCactus earned 500 total points
ID: 34904444
The PIC microprocessor can be set up with various oscillator configuration, with internal clock source or by providing an external clock (with an active oscillator or a quartz crystal).
In chapter 2of the datasheet (here), you can see all the configuration you can use.
"HS" mode means an "high speed resonator", that means you can use both a quartz crystal or a monolithic resonator. In the same page 21, you can see many suggested values for the resonation network capacitors.
Instead INTIO1 and INTIO2 are modes with the "internal clock source". Maximum frequencies for both modes are 8Mhz for internal clock source and 40MHz for external clock source with PLL enabled (10Mhz x 4).

As you can see in the pic18fxx31 microprocessor (pag. 26), the OSCCON register is a bit mapped register.
The ITF2:ITF0 bits sets the frequency of the internal oscillator. the "111" configuration drives the clock directly from the 8MHz internal clock source, overriding the post-scaler. This is the maximum frequency available without an external source.

If you want to reach 40MHz, you must use the HSPLL mode, and provide the clock externally. I suggest a good resonator and a good layout for your PCB. If you are using a breadboard / prototype board, check carefully how you connect the ground and the capacitors; be warned that in this condition your clock may be unstable and the cpu may work bad.

refer to the Chapter 2 of the datasheet for other information about the oscillator section of the CPU.

Hope that helps.
0
 

Author Comment

by:0av067
ID: 35283570
Apologies I simply forgot about this post. The answer covers everything regarding internal oscillator setup and even a little about external oscillator configs. I can't accept it as a solution, however, because of the above close request. I would like to accept with a grade of "A" as it was complete, accurate, and easy to follow. Thank you.
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 35321624
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
0

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question