PDA

View Full Version : External Ocilator PIC16f690 Help



jzprice
- 27th March 2009, 01:26
I have been tring to use an external oscillator for PIC16F690 for 6 hours and have not had much luck.

I connected a 20mhz cystal to OSCL1 and OSCL2 with 22uF ceramic caps but that did not drop the frequency of a HPWM signal.

I know that I have to use the OSCCON = %01100000. But I'm not sure of the values, and I think I have to write to the CONFIG reg which is 16bits. i don't know how to write to that. could someone give instructions for a person new to PBP and microcontrollers?


-thanks

Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/41262E.pdf PG(50 & 197)

nemesis
- 27th March 2009, 04:01
Please post some code. Your configuration fuses need to be set use an external osc. Did you define the osc speed? If you do not it is assumed you are using 4 Mhz.



DEFINE OSC 20


The lowest HPWM Frequency as per the manual states for 20 Mhz:

1221Hz for 14-bit core and 18CXXX
or
19531Hz for 17CXXX

Here is a great thread on Configuration Fuses (http://www.picbasic.co.uk/forum/archive/index.php/t-543.html).

Hope this helps. With some code to see more people can help out.

Nemesis

Archangel
- 27th March 2009, 05:30
Hello jzprice,
in your MPASM Suite directory, you will find a file named P16F690.inc file, near the bottom of that file is a list of every Config option available.
In your PBP directory you will find a file Called 16F690.inc. This file has the <b>default</b> config statement. You may alter that statement or simply add a semicolon to make it into a comment. You may then insert the config statement into your code, every time (recommended). In your example you would change __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF <br>to<br>__config _HS_OSC & _WDT_ON & _MCLRE_ON & _CP_OFF
and as nemisis stated use the DEFINE as shown in his post.

Gusse
- 27th March 2009, 06:31
I connected a 20mhz cystal to OSCL1 and OSCL2 with 22uF ceramic caps but that did not drop the frequency of a HPWM signal.

I hope this is just a typo, right capacitor range is in pF.

BR,
-Gusse-

nemesis
- 27th March 2009, 15:49
Gusse is right. I thought it is something like 12pf needed for 20 Mhz crystal. Why not just slap in a 20 Mhz resonator with the capacitor built in.

Archangel
- 27th March 2009, 16:10
I hope this is just a typo, right capacitor range is in pF.

BR,
-Gusse-

Nice catch !