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 OSC bits in 16F628

Status
Not open for further replies.

PeterK

New Member
Hi,

I am trying to set the osc bits in 16f628

I want to run 32k ext osc, but change in the program to intrc then back to 32k ext osc.

Any suggestions welcome.

Peter
 
PeterK said:
Hi,

I am trying to set the osc bits in 16f628

I want to run 32k ext osc, but change in the program to intrc then back to 32k ext osc.

Any suggestions welcome.

Peter

Just to make sure what you are wanting to do?, you want the PIC to run off it's internal 4MHz oscillator, but be able to switch to using an external 32KHz oscillator from within the program?.

You can't switch configuration fuse settings from within a program, only from a programmer.

Why do you want to do this?.
 
:wink:

Why do you want to do this?.

Errrrm Nigel, someone once told me that the point of 32khz was all about saving power :wink: :wink: :roll: :lol:


Peter, take a look at the Datasheet, it tells you how to do what you want......

"14.3 Special Feature: Dual Speed
Oscillator Modes
A software programmable dual speed oscillator mode
is provided when the PIC16F62X is configured in either
ER or INTRC oscillator modes. This feature allows
users to dynamically toggle the oscillator speed
between 4MHz and 37kHz. In ER mode, the 4MHz setting
will vary depending on the size of the external
resistor. Also in ER mode, the 37kHz operation is fixed
and does not vary with resistor size. Applications that
require low current power savings, but cannot tolerate
putting the part into sleep, may use this mode."


Be aware though that the 32khz internal osc may not be as accurate as the external crystal you originally wanted to use, check the specs in the datasheet....

Hope this helps!
 
Matt(Pic progger) said:
:wink:

Why do you want to do this?.

Errrrm Nigel, someone once told me that the point of 32khz was all about saving power :wink: :wink: :roll: :lol:

That's why I asked :lol:

If it was about saving power, I was going to mention the internal oscillators low speed mode - but I wasn't bothering typing it all if it wasn't relevant 8)
 
:wink:

OK, i belive you Nigel..... honset, I do, I do!!!! :lol:

Anyway that aside, I love the 628, it's got some fantastic features...... Although, I have started using the 818 now as my "dogsbody" chip, it's nice to have the ADC's back :wink:
 
OSC Settings in 16f628

Thanks for all of the responses.

I was trying to save power by running @ 32 k, but I also wanted accuracy, hence not using the 37k.

I needed to output sounds, which will only work at 4 mhz correctly.

I did look at the specs further and found they are program only bits.

Howver i've resolved the problem by using another pic(12f series) to run at 32k getting my accuracy and using this to trigger the 16f628 out of sleep.

Therefore I get accuracy and low power consuptions (< 30ua) and 5 ma when it wakes up momentarily.

Thanks for all your inputs and this may help others.

Peter
 
Status
Not open for further replies.

Latest threads

Back
Top