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

PIC 16F88 internal oscillator setup

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







PIC 16F88 internal oscillator setup
PostPosted: Wed Mar 03, 2004 5:22 pm     Reply with quote

'lo people

I have the most recent version of PCM, and am trying to use the PIC16F88's internal 8MHz oscillator. Whether i'm using the wrong #FUSE settings or something, my PIC does NOTHING, despite the fact that it compiles with no errors.

Could someone post a full program listing ( or a link to one ) for a simple program that does something - anything - using the 8MHz internal oscillator on the 16F88. The compiled .hex file would also be useful, if you have it handy ;)

If you're going to post a reply, please try out the program on a 16F88 beforehand.

P.S. - I know a crystal oscillator is more accurate, etc, etc. so don't recommend i use one plz.

Thanks
- JBM
Guest








PostPosted: Wed Mar 03, 2004 10:16 pm     Reply with quote

I am going to disappoint you with my short answer but I don't have time for much more right now. CCS has recently changed things making oscillator setup easier for these type parts.

In your #FUSES use INTRC_IO and set #use delay (8000000)

That's it. The rest is automatic.

Hope that helps.
SteveS



Joined: 27 Oct 2003
Posts: 126

View user's profile Send private message

PostPosted: Thu Mar 04, 2004 8:27 am     Reply with quote

This may further dissapoint you, but I don't deal with the 16F88, but this may still be of use:

On the 18F parts w/ built in osc I had to add:

OSCCON = 0x72; // boost up to 8Mhz

to get it to run at 8Mhz rather than the deafult (I forget what, but it's slower). OSCCON needs to be defined for wherever the register resides on your chip. Who knows, the bits may be different too.

I think newer compilers may have a function do take care of this, check the README file.

-SteveS
bwhiten



Joined: 26 Nov 2003
Posts: 151
Location: Grayson, GA

View user's profile Send private message

PostPosted: Thu Mar 04, 2004 2:11 pm     Reply with quote

This worked fine on the 16F87, same part, just no ADCs. Just a program I wrote to test the internal oscillator function.

Code:
#include "Dongle.h"

void main()
{
   OSCCON = 0x7C;

//
// Wait for MRA inquiry, respond alive, get MRA command
//
   while (TRUE)
   {
   output_a(0x01);
   delay_ms(2000);
   output_a(0x02);
   delay_ms(2000);
   output_a(0x04);
   delay_ms(2000);
   output_a(0x08);
   delay_ms(2000);
   
   }
}



And here'e the include file.

Code:
#include <16F87.h>
#include "stdlib.h"
#byte OSCCON = 0x8F
#use delay(clock=8000000)
#fuses NOWDT, NOLVP, NOMCLR, NOPUT
#use rs232(baud=9600,parity=N,xmit=PIN_B5,rcv=PIN_B2,bits=8)



Forgot to say I'm using v3.178 and it did not have the built-in support for internal oscillators.
JBM
Guest







Thanks ppl!
PostPosted: Thu Mar 04, 2004 2:31 pm     Reply with quote

Thie is just to say that the anonymous guest who left this message

Quote:
I am going to disappoint you with my short answer but I don't have time for much more right now. CCS has recently changed things making oscillator setup easier for these type parts.

In your #FUSES use INTRC_IO and set #use delay (8000000)

That's it. The rest is automatic.

Hope that helps.


has made me very one very happy programmer. Very Happy All my 16F88 circuits run just like they used to under the PICAXE system ( http://www.picaxe.co.uk )

Thanks also to the others who took the time to post stuff here as well Smile

Thanks again
- from one very happy JBM
Guest








PostPosted: Tue Aug 17, 2004 7:08 pm     Reply with quote

The updated CCS compiler has a built in function for working with the internal oscillator, something like:
Code:

#fuses INTRC,...
#use delay(8000000)

void main(){

   // tell pic to use internal crystal
   setup_oscillator(OSC_8MHZ | OSC_INTRC);
}
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