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

Oscillator settings PIC16F1718

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



Joined: 25 Oct 2004
Posts: 136

View user's profile Send private message

Oscillator settings PIC16F1718
PostPosted: Mon Aug 31, 2015 7:10 am     Reply with quote

Hi friends

I have to migrate from 16F886 to 16F1718 and now I am getting confused with the settings for oscillator.

This doesn't make an error but the speed is 16MHz
Code:
setup_oscillator(OSC_16MHZ | OSC_INTRC | OSC_PLL_ON);

According to the datasheet i made this:
Quote:
setup_oscillator(OSC_8MHZ | OSC_INTRC | OSC_PLL_ON);

So i guessed it should run now on 32MHz, but that's not true !
It is still running on 8MHz.

BTW, at all times I used this :
Code:
 #use delay(clock=8000000)


So I should be able to see a difference in a blinking LED ???

Can anybody see my mistake ???

I hope someone can help me on this.

Best regards
Andreas
Ttelmah



Joined: 11 Mar 2010
Posts: 19520

View user's profile Send private message

PostPosted: Mon Aug 31, 2015 7:25 am     Reply with quote

The joys of some of the modern chips.....

Key problem is: 'OSC_INTRC'.

Look at the oscillator diagram. Figure 6-1.

If you select OSC_INTRC, you are setting the SCS 1:0 bits to 1x. If you look at the diagram, you will see that using this route, you can't access the PLL. The PLL is only available on the branch using 00 (primary oscillator). However the oscillator feeding this can be selected to be the external oscillator, or the internal oscillator, using the 'PRIMUX' bit (primary multiplexer).

So the correct selection for INTRC at 64MHz, is:

setup_oscillator(OSC_16MHZ | OSC_PLL_ON | OSC_NORMAL);
Andreas



Joined: 25 Oct 2004
Posts: 136

View user's profile Send private message

PostPosted: Mon Aug 31, 2015 12:10 pm     Reply with quote

Thank you Ttelmah.

Thanks for your answer, will test it tomorrow.


Best regards
Andreas
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