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 CCS Technical Support

Internal Clock Enable

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







Internal Clock Enable
PostPosted: Thu Jan 31, 2008 2:38 pm     Reply with quote

I'm trying to use a 18f4620 to do some stuff (what it is isn't all that important). I'm trying to set the fuses properly so that the internal 8 Mhz oscillator is used. I've looked through the .h file and can't for the life of me find anything in the fuses that enables this clock. Should I just not set a fuse and use setup_oscillator(OSC_8MHZ) or something else??

Also Is there somewhere where all of the fuses (their abbreviations) are documented?? I can figure most of them out, but some are a little cryptic.

Thanks for the help.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jan 31, 2008 3:38 pm     Reply with quote

Quote:

I've looked through the .h file and can't for the life of me find
anything in the fuses that enables this clock.

Either of these two fuse settings shown in bold will do it.
Quote:
WRTC,NOWRTC,WRTB,NOWRTB, INTRC_IO, INTRC, FCMEN,NOFCMEN

Here is a test program that will blink an LED on pin B0.
It sets up the internal oscillator to run at 8 MHz.
Code:

#include <18F4620.h>
#fuses INTRC_IO,NOWDT,BROWNOUT,PUT,NOLVP,NOPBADEN
#use delay(clock=8000000)

//=============================
void main(void)
{

while(1)
  {
   output_high(PIN_B0);
   delay_ms(500);
   output_low(PIN_B0);
   delay_ms(500);
  }

}

Kasper



Joined: 14 Jan 2004
Posts: 88
Location: Aurora, Ontario, Canada

View user's profile Send private message Visit poster's website

PostPosted: Thu Feb 21, 2008 10:48 am     Reply with quote

Now say for arguments sake, that I use version 3.191 of the compiler, and those key words are not recognized, what is the correct procedure to use the internal oscillator? Embarassed
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Feb 21, 2008 11:52 am     Reply with quote

Post your PIC. Is it the 18F4680 ?
Kasper



Joined: 14 Jan 2004
Posts: 88
Location: Aurora, Ontario, Canada

View user's profile Send private message Visit poster's website

PostPosted: Thu Feb 21, 2008 3:38 pm     Reply with quote

sorry.. forgot to mention that it is an old board with an 18F6621 Embarassed
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Feb 21, 2008 3:43 pm     Reply with quote

The 18F6621 doesn't have an internal RC oscillator. Here are the
oscillator options from the data sheet:
Quote:

The PIC18F6525/6621/8525/8621 devices can be
operated in twelve different oscillator modes.
1. LP Low-Power Crystal
2. XT Crystal/Resonator
3. HS High-Speed Crystal/Resonator
4. RC External Resistor/Capacitor
5. EC External Clock
6. ECIO External Clock with I/O pin enabled
7. HS+PLL High-Speed Crystal/Resonator with PLL enabled
8. RCIO External Resistor/Capacitor with I/O pin enabled
9. ECIO+SPLL External Clock with software controlled PLL
10. ECIO+PLL External Clock with PLL and I/O pin enabled
11. HS+SPLL High-Speed Crystal/Resonator with software control
12. RCIO External Resistor/Capacitor with I/O pin enabled
Kasper



Joined: 14 Jan 2004
Posts: 88
Location: Aurora, Ontario, Canada

View user's profile Send private message Visit poster's website

PostPosted: Thu Feb 21, 2008 3:52 pm     Reply with quote

I guess that could explain it :o\

I know it is an older chip, but I figured it would be more or less the same as the 6622, which is the closest datasheet I could find, and it had the internal oscillator.
Time to order new samples. Very Happy
Kasper



Joined: 14 Jan 2004
Posts: 88
Location: Aurora, Ontario, Canada

View user's profile Send private message Visit poster's website

PostPosted: Thu Feb 21, 2008 3:58 pm     Reply with quote

Hmm.. looking at the overview, the 6520 has an internal oscillator, yet looking at the valid fuses for it in PCW, it does not seem like it does. Strange. reason for looking at it, is that I found one in my parts bin Smile. I also found some 6720's.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Feb 21, 2008 4:05 pm     Reply with quote

Download the 18F6520 data sheet.
http://ww1.microchip.com/downloads/en/DeviceDoc/39609b.pdf
Look on page 23 in the Acrobat reader, at this section:
Quote:
2.0 OSCILLATOR
CONFIGURATIONS
2.1 Oscillator Types

There are no internal oscillators. Everything is external.
Kasper



Joined: 14 Jan 2004
Posts: 88
Location: Aurora, Ontario, Canada

View user's profile Send private message Visit poster's website

PostPosted: Fri Feb 22, 2008 7:54 am     Reply with quote

yeah.. i must have been cross eyed looking at the overview page. I ordered some samples of the 6722, which is one of few processors supported by my old compiler, which still has internal oscillator. Thanks Smile
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