Page 1 of 1

advice on setting internal oscillator

Posted: Sun Jul 16, 2017 9:27 am
by Steve001
morning all

using a 16F18875 an i am not sure how to set the internal oscillator

http://www.microchip.com/wwwproducts/en/pic16f18875

data sheet

http://ww1.microchip.com/downloads/en/D ... 01802D.pdf

i believe i need to use OSCCON1 ? in C code box

looking at section 6.2.2 & 6.3.1 i am not sure of what setting(s) to apply

looking at 20mhz clock speed to start with

Steve

Re: advice on setting internal oscillator

Posted: Mon Jul 17, 2017 2:33 am
by Kenrix2
I don't see an option for 20MHz. How about 16MHz with no PLL or divisions?

Step 1) Select HFINTOSC 32MHz and Ext OSC Off in Project Options/Configure.

Step 2) Change the HFINTOSC from 32MHz to 16MHz by adding this in a C Code box:

Code: Select all

OSCFRQ=0b00000101;
One way to check it is to enable Clockout in Configure and multiply your measurement by 4.

I have not tested any of this so, I could be wrong. Also, there seem to be some typo's in the Configure for bits 6-4 of CONFIG1. One selection appears to be missing and others might be in the wrong place. HFINTOSC 32MHz looks to be correct though.

Re: advice on setting internal oscillator

Posted: Mon Jul 17, 2017 4:52 pm
by Steve001
cheers kenrix2

Think i will try 32mhz

Steve