View previous topic :: View next topic |
Author |
Message |
elcom
Joined: 15 Sep 2003 Posts: 4
|
Setting Up Internal Oscilator Block for PIC16F87 |
Posted: Mon Sep 15, 2003 7:18 am |
|
|
Hi,
I would like to ask, if anybody know how to setup Internal Oscillator Block in the PIC16F87. Shall I have to use direct SFR programming, or it is possible to do using implemented �C� commands. I need to use internal clock 8 MHZ. In case of use direct SFR programming what is the best way to do it?
Thank you very much in advance,
Ioannis |
|
|
john cutler
Joined: 06 Sep 2003 Posts: 82 Location: Hot Tub, California
|
|
Posted: Mon Sep 15, 2003 9:26 am |
|
|
I found that the CCS header for the 16F88 was missing the internal osc settings. I wrote CCS and the person there replied saying that this would be corrected in the next compiler release. Meanwhile, I used assy SFR bit setting to accomplish this. Seems to work fine.
Download the data sheet pdf from Microchip's site. It's pretty self explanatory.
jc |
|
|
elcom
Joined: 15 Sep 2003 Posts: 4
|
|
Posted: Mon Sep 15, 2003 9:53 am |
|
|
Could you please send send me some line of your code just to see how you have done it.
thank you in advance
rgds
ioannis |
|
|
john cutler
Joined: 06 Sep 2003 Posts: 82 Location: Hot Tub, California
|
|
Posted: Mon Sep 15, 2003 1:04 pm |
|
|
Well, what I did was to set the CCS #fuses directive the way I wanted (except for oscillator)
#fuses HS, NOWDT, NOLVP, NOMCLR
then I compiled the code and looked at the .lst output file on the bottom at the configuration fuses. (The compiler added other options as well)
the configuration word was listed with a value of 3702
If you look at page 129 or the .pdf, you'll see a description of the config words - the address is 0x2007 which is above the normal memory. Your can access it with a #rom statement at the beginning of your code.
bits 4, 1 and 0 of config word 1 control oscillator selection.
for my purposes, I ended up with
#rom 0x2007 = {3711}
which gave me internal osc with clk ouput on pin A6
I hope this helps.
jc |
|
|
elcom
Joined: 15 Sep 2003 Posts: 4
|
|
Posted: Mon Sep 15, 2003 1:07 pm |
|
|
Thank you!
I'm going to impleent is right now.
regards
Ioannis |
|
|
john cutler
Joined: 06 Sep 2003 Posts: 82 Location: Hot Tub, California
|
|
Posted: Mon Sep 15, 2003 4:51 pm |
|
|
Well, I just checked and CCS posted a new version of the compiler 3.177 which insludes an udpataed header file for the 16F87/88. Now, INTRC and INTRC_IO are listed.
Try it out.
jc |
|
|
elcom
Joined: 15 Sep 2003 Posts: 4
|
|
Posted: Tue Sep 16, 2003 12:22 am |
|
|
I saw it also. But in any case I tested your solution, whitch is working.
Thanks
Ioannis |
|
|
troy Guest
|
|
Posted: Tue Jan 27, 2004 12:54 pm |
|
|
Thanks
#rom also works for disabling the Fail-Safe Clock Monitor and the Internal External Switch Over mode
#rom 2007 {0x00} |
|
|
|