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

External Oscillator not working.

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







External Oscillator not working.
PostPosted: Tue Dec 29, 2009 1:08 am     Reply with quote

Hi. I have been using internal oscillator all the time.
Now, I try to use the externally connected oscillator.
However, the either the hardware or software configuration seems to be failing.
The IC has some kind of "switch oscillator" ability.
Trying the MPLAB simulator to see if anything was wrong, I found that
OSCCON register was set to use 1Mhz Internal Osicllator.

Here is the code
Code:

//Main.c
#include<18F65J90.h>
#include<def_18F65J90.h>

#fuses HS

#use delay(clock = 32768)

//Cumulative Volume Counter

   int32 k_factor;
void main(void){
   int8 buffer;
   
   while(1);      
}

The oscillator is wired this way
Code:

OSC2----------------||------
            |              |     
          [   ]            |----------
            |              |         |
OSC1----------------||------         |
                                    GND
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Tue Dec 29, 2009 1:19 am     Reply with quote

You can't use the HS fuse with the 32,768Hz crystal.

Read the datasheet for the part again closely in the oscillator section.

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
SugarD
Guest







I looked at the data sheet and still can't figure out why
PostPosted: Tue Dec 29, 2009 1:52 am     Reply with quote

and it doesn't work with EC_io fuse either
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

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

PostPosted: Tue Dec 29, 2009 3:52 am     Reply with quote

I haven't read it in detail but apparently, the 18F65J90 doesn't have an LP mode. So you can't use 32768Hz crystals as the main oscillator.

Are you looking for RTC capability? Use an HS crystal as the main clock, and use a 32kHz crystal as the secondary oscillator.

Alternatively, start the processor using the INTRC fuse, then switch clock sources to T1OSC.

Deriving the clock from T1OSC comes down to using a power managed mode, so you would *have* to first start the processor in one mode, then switch to the 32kHz crystal.

Chapters 2 and 3 from the datasheet will be able to help you out better. Razz

Rohit
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Tue Dec 29, 2009 11:42 am     Reply with quote

Yea, I didn't look at the datasheet at all either.

but "HS + 32KHz Xtal == No Worky" in my book.

Definitely read the datasheet. What Rohit said is valid and the way a lot of PIC's work.

I recently did a PIC18F46J11 project with 32KHz on T1OSC and it worked great. The new IDLE vs. Sleep modes are awesome.

Cheers,

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
mkuang



Joined: 14 Dec 2007
Posts: 257

View user's profile Send private message Send e-mail

PostPosted: Mon Jan 04, 2010 10:44 am     Reply with quote

Does it work if you change the HS to XT ?
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