CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

internal & external oscillator

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
madhura027



Joined: 27 May 2015
Posts: 8

View user's profile Send private message

internal & external oscillator
PostPosted: Wed Jun 03, 2015 10:09 pm     Reply with quote

What is the difference between internal and external osc in pic?
How does internal work when using external osc & how does external osc react when using internal osc?
Which is the best use of oscillator ? Why?
gpsmikey



Joined: 16 Nov 2010
Posts: 588
Location: Kirkland, WA

View user's profile Send private message

PostPosted: Wed Jun 03, 2015 10:54 pm     Reply with quote

The internal one does not require any external parts, but is not as accurate (see the data sheet for the PIC in question) as the external oscillator. The external one usually requires a crystal and a couple of small capacitors as well as the added traces on your circuit board. For something that is not timing critical (led flasher, heater controller etc. ) the internal one may be just fine. If you have an application where timing has to be precise or requires accurate baud rates, then an external one will be better suited to the job. The internal one is actually not too bad in the newer PICS - look at the data sheet for the one you are thinking of using for the exact specifications. Using the internal one may also free up a pin or two for other uses which may be important with the smaller chips. You select which (int/ext) oscillator you want in the fuses you define for your application.

mikey
_________________
mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3
temtronic



Joined: 01 Jul 2010
Posts: 9245
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Jun 04, 2015 8:55 am     Reply with quote

what mikey says and...
if you're using the internal to free up a pin or two, buy a bigger PIC ! Only a few pennies more and you 'shouldn't' run out of pins.
also be careful about the internal oscillator if not 'on the bench'. Timing WILL change due to temperature !
frankly it's a great idea to using the xtal and 2 caps.Cost isn't that bad and the precise timing benefits will more than pay for the parts.

Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19548

View user's profile Send private message

PostPosted: Fri Jun 05, 2015 2:31 am     Reply with quote

There are a couple of other things that are commonly 'missed'.

Often the main processor does not 'need' an accurate clock. If you want 'timings', you will use something like a watch crystal, or an external RTC, so a few percent error in the actual CPU rate is unimportant.

Things that do need accurate CPU timings, are first, serial (still a percent or two error is acceptable), and USB (here tiny fractions of a percent matter).

The second is 'why' the 4550/2550, _require_ an external clock to run USB.

However some of the later chips allow the USB clock to be separately synchronised (using a PLL), to the incoming USB stream. On the former problem, many (most) chips allow the internal clock to be adjusted, so you can in fact write a software routine, that if the error rate on the link starts to go unacceptable, adjusts the master clock to better synchronise to the serial. Using this approach you can actually get better synchronisation than with a crystal, since it is common to find many other sources also have errors - try actually 'timing' a PC serial port sometime, using a calibrated frequency counter!.

It comes down to knowing which parts of your system use timings that 'matter', and then choosing a clock for these parts.

As a 'caveat', I've seen a lot of 'off the shelf' USB components that will actually fail if used at temperatures like 6C, and even more fail at temperatures like 40C. The manufacturers have used relatively cheap resonators, and their temperature drift is bad enough to go 'out of spec' at anything much outside 'room' temperatures...
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group