CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Setting Up Internal Oscilator Block for PIC16F87

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
elcom



Joined: 15 Sep 2003
Posts: 4

View user's profile Send private message

Setting Up Internal Oscilator Block for PIC16F87
PostPosted: Mon Sep 15, 2003 7:18 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Sep 15, 2003 9:26 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Sep 15, 2003 9:53 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Sep 15, 2003 1:04 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Sep 15, 2003 1:07 pm     Reply with quote

Thank you!
I'm going to impleent is right now.
regards
Ioannis
john cutler



Joined: 06 Sep 2003
Posts: 82
Location: Hot Tub, California

View user's profile Send private message

PostPosted: Mon Sep 15, 2003 4:51 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Sep 16, 2003 12:22 am     Reply with quote

I saw it also. But in any case I tested your solution, whitch is working.
Thanks
Ioannis
troy
Guest







PostPosted: Tue Jan 27, 2004 12:54 pm     Reply with quote

Thanks
#rom also works for disabling the Fail-Safe Clock Monitor and the Internal External Switch Over mode
#rom 2007 {0x00}
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group