Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Setting the internal oscillator

Status
Not open for further replies.

rob_croxford

New Member
Hi All,

I wanted to do an experiment to see how accurate the internal oscilators on the (PIC12F683) are. This is mainly to reduce components in a project im working on. (as i tend to go for external clocks if accuracy is needed).

The datasheet for this pic mentions that it is possible to choose from 8 different clock speeds. From 8Mhz-125Khz - does anyone have any idea how to set this up?!

for instance how would i set the internal clock to run at 125Khz using only software (so no timing caps etc...) I imagine i would use the OSCCON register somehow...

Im currently working in C.

Any help - Greatly Appreciated.

Rob

p.s. i am currently using MikroC Pro compiler :)
 
Set the releveant bits in the OSCCON register as you have already mentioned.

The datasheet for the 12F683 (Section 3.5) shows you how to set the register. That's about all there is to it.
 
Hi,

You also first need to set the CONFIG parameter OSC to the Internal Oscillator.

The internal osc is good enough for most general purpose work - you don't give any clue as to what you want to control so cannot say if internal is accurate enough.

Using a higher clock speed would help reduce some error - with a 4 meg osc you have a machine cycle of 1 millionth of a second, so even if the internal osc goes out by a few % thats still a very small error.
 
Thanks,

I didnt realise i had to set the internal oscillator up in the project settings. Im not planning on using a clock as low as 125Khz i just wanted to test on all oscillator settings and see how accurate they are.

Problem sorted now,

Cheers! :D
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top