View previous topic :: View next topic |
Author |
Message |
JBM Guest
|
PIC 16F88 internal oscillator setup |
Posted: Wed Mar 03, 2004 5:22 pm |
|
|
'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
|
|
Posted: Wed Mar 03, 2004 10:16 pm |
|
|
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
|
|
Posted: Thu Mar 04, 2004 8:27 am |
|
|
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
|
|
Posted: Thu Mar 04, 2004 2:11 pm |
|
|
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! |
Posted: Thu Mar 04, 2004 2:31 pm |
|
|
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. 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
Thanks again
- from one very happy JBM |
|
|
Guest
|
|
Posted: Tue Aug 17, 2004 7:08 pm |
|
|
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);
}
|
|
|
|
|