Solved

How to set PIC 18F4431 internal oscilator

Posted on 2011-02-15
4
1,578 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
[X]
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
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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
How to get all the API from website? 11 160
Why is enum singleton a better approach than static factory 3 66
Java array 10 86
Convert number to hex in Lua 16 90
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.
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
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…

734 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