Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to set PIC 18F4431 internal oscilator

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

828 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