Solved

How to set PIC 18F4431 internal oscilator

Posted on 2011-02-15
4
1,512 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
count7 challenge 12 70
powerN  challenge 3 47
mapAB Challlenge 35 88
C# code editing and collaboration 3 47
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
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 fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now