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

Clock Switching

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







Clock Switching
PostPosted: Fri Dec 09, 2005 6:15 am     Reply with quote

Hallo,

I have an application that needs to switch from the internal to external clock (ECIO).

I have to start out on the internal clock (since my fuses are set to ECIO I imagine this is in clock fail mode) and program some external hardware. Once the external hardware is programmed, a 13.56 MHz clock appears (which is attached to my OSC1 pin).

I'm using a PIC16F767 and CCS Compiler 3.200.

Problem is, when I call setup_oscillator with OSC_NORMAL it then switches over to the 32 KHz internal clock - even though the 13.56 MHz clock is correctly on the OSC1 pin.

Any thoughts as to what is causing the problem.

Code:

#include <16f767.h>
#device ICD=TRUE
#ROM 0x2007 = {0x2763}
#ROM 0x2008 = {0x3FFF}

main()
{
SETUP_ADC_PORTS(NO_ANALOGS);
SETUP_ADC(ADC_OFF);                  // disable A2D
SETUP_COMPARATOR(NC_NC_NC_NC);      // default settings
SETUP_CCP1(CCP_OFF);
SETUP_CCP2(CCP_OFF);

InitHW();                    // Hardware initialisation - subroutine not shown

delay_ms(2000);
setup_oscillator(OSC_NORMAL);

.....
}
Ttelmah
Guest







PostPosted: Fri Dec 09, 2005 9:26 am     Reply with quote

Read the processor's .h file.
Note the constants for 'setup_oscillator'. Pay special attention to 'OSC_TIMER1'.

Best Wishes
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