advice on setting internal oscillator

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1106
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 454 times
Been thanked: 507 times
Contact:

advice on setting internal oscillator

Postby Steve001 » Sun Jul 16, 2017 9:27 am

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/DeviceDoc/400001802D.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
Success always occurs in private and failure in full view.

Kenrix2
Flowcode v5 User
Posts: 211
Joined: Tue Feb 19, 2013 9:51 pm
Has thanked: 72 times
Been thanked: 177 times
Contact:

Re: advice on setting internal oscillator

Postby Kenrix2 » Mon Jul 17, 2017 2:33 am

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.
These users thanked the author Kenrix2 for the post (total 2):
Benj (Mon Jul 17, 2017 10:43 am) • Steve001 (Mon Jul 17, 2017 4:50 pm)
Rating: 10%
 

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1106
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 454 times
Been thanked: 507 times
Contact:

Re: advice on setting internal oscillator

Postby Steve001 » Mon Jul 17, 2017 4:52 pm

cheers kenrix2

Think i will try 32mhz

Steve
Success always occurs in private and failure in full view.