PDA

View Full Version : Pic oscillator?



Qacer
- 24th January 2006, 17:40
Hey all,

I was reading the PIC Manual on its internal oscillators and found out that the frequency depends on VDD as well as the external resistor and capacitor. On all of their examples, they are using VDD=5V.

I was wondering if I can still achieve a 4MHz internal oscillator value if I use a voltage of, say, 3.3V. I'm using a PIC12F675 as my first newbie chip.

Thanks!

Dave
- 24th January 2006, 20:54
Qacer, The internal 4 Mhz. oscillator does not use any external capacitor or resistor. The mode you speak of is RCIO or RC. These modes require the external components to for the oscillator. Check the data sheet....

Dave Purola,
N8NTA

Qacer
- 24th January 2006, 21:16
Thanks again, Dave! I'm still immersing myself with the datasheet and PIC manual for midrange microcontrollers.

Qacer
- 31st January 2006, 14:09
By the way, I have another question. I was reading the PIC12F675 data sheet and it states that the following code will calibrate the internal PIC oscillator:

bsf STATUS, RP0 ;Bank 1
call 3FFh ;Get the cal value
movwf OSCCAL ;Calibrate
bcf STATUS, RP0 ;Bank 0

Am I doing the right thing using my BASIC coding?

changed 12F675.inc
__config _INTRC_OSC_CLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF


My next question is: how do I implement the calibration code in BASIC?

Is this right?

OSCVAL equ 3FFh ; assign 3FFh to OSCVAL
call OSCVAL
OSCCAL = OSCVAL ; ??


Thanks!

mister_e
- 31st January 2006, 15:39
just a tip
DEFINE OSCCAL_1K 1
DEFINE OSCCAL_2K 1

Qacer
- 31st January 2006, 16:34
just a tip
DEFINE OSCCAL_1K 1
DEFINE OSCCAL_2K 1


Thanks, mister_e! I knew I saw this somewhere. I started flipping through my manual and found it on page 12. One line is definitely much shorter than a couple. :)