Log in

View Full Version : basic question about OSCCON and HS_OSC



dsicon
- 8th December 2012, 16:33
this is probably a pretty dumb question, but i have gotten rusty on PBP
i have a design with the 16F819 chip and it was using INT OSC at 8MHz

now i have a 20MHz resonator

when i changed the DEFINE from
INTRC_OSC_NOCLKOUT
to
HS_OSC

it got me wondering what exactly happens with the OSCCON register ?
is it now ignored?
i looked at the data sheet and perhaps missed it but i could not see where it says anything about this the operations of the internal oscillator when an external xtal is used
(i did determine by other means that the chip is running at 20MHz)

is the int osc shut down or gated out entirely ?
do any of the OSCCON bits now matter ?

also with a 20MHz resonator (w/ internal caps) when i probe either pin with a scope it kills the oscillation, this is not hugely surprising but it got me wondering about whether for a resonator i should be using XT_OSC rather than HS_OSC
as far as i know the HS is not for speed per se but rather for a drive level more appropriate for a higher freq xtal

and lastly in the M16F81X.INC file i notice
EC_OSC
what is that ? i don't recall that one
thanks

mackrackit
- 9th December 2012, 08:55
this is probably a pretty dumb question,

As they say, there are no dumb questions.


when i changed the DEFINE from
INTRC_OSC_NOCLKOUT
to
HS_OSC

it got me wondering what exactly happens with the OSCCON register ?
is it now ignored?
i looked at the data sheet and perhaps missed it but i could not see where it says anything about this the operations of the internal oscillator when an external xtal is used
(i did determine by other means that the chip is running at 20MHz)
is the int osc shut down or gated out entirely ?
do any of the OSCCON bits now matter ?

Take a look at FIGURE 4-6 in the data sheet. The internal OSC is always running, the WDT works from it. The OSCCON is not ignored when HS is selected, just the internal OSC is not used as the main clock. The OSCCON bits do not matter when anything but the internal OSC is used.


also with a 20MHz resonator (w/ internal caps) when i probe either pin with a scope it kills the oscillation, this is not hugely surprising but it got me wondering about whether for a resonator i should be using XT_OSC rather than HS_OSC
as far as i know the HS is not for speed per se but rather for a drive level more appropriate for a higher freq xtal
HS is the correct selection with resonators.


and lastly in the M16F81X.INC file i notice
EC_OSC
what is that ? i don't recall that one
thanks
EC is for when an external clock source is used. Look at section 4.3 in the data sheet.

mister_e
- 9th December 2012, 09:22
Tip: To prevent killing the OSC with your probe, you want to use a 10x (or more) probe, and monitor the OSC2/CLKO pin.

dsicon
- 9th December 2012, 19:39
Tip: To prevent killing the OSC with your probe, you want to use a 10x (or more) probe, and monitor the OSC2/CLKO pin.
Hi Steve
i do know about those 2 issues, pretty sure it was 10x probe, will double check and use a better scope too, if it actually was 10x that worries me a little about the drive level, will let you know

dsicon
- 9th December 2012, 19:43
Hi Dave and thank

re EC, got it, rings a bell now, told you i got rusty

re OSCCON i pretty much got it now but in your reply don't you say something contradictory ?
you say 'OSCCON is not ignored ... '
and you also say 'OSCCON bits do not matter ...'
?

mackrackit
- 10th December 2012, 04:46
It is not ignored as far as the chip is concerned, the register is set either by you or by default, if you do not use the register then it does not matter how it is set.