PIC16F1788 Clock?

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

Moderator: Benj

Post Reply
seokgi
Posts: 164
Joined: Fri Jan 13, 2012 4:21 am
Location: South KOREA
Has thanked: 18 times
Been thanked: 16 times
Contact:

PIC16F1788 Clock?

Post by seokgi »

Hello!
I am trying to program using PIC16F1788. But the clock seems to be out of place. I've tried a couple of things, but it does not seem to work.
Can you help me? I send my test program.

Thank you.

seokgi
Posts: 164
Joined: Fri Jan 13, 2012 4:21 am
Location: South KOREA
Has thanked: 18 times
Been thanked: 16 times
Contact:

Re: PIC16F1788 Clock?

Post by seokgi »

My program
Attachments
test.fcfx
(11.6 KiB) Downloaded 209 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: PIC16F1788 Clock?

Post by Benj »

Hello.

It looks like you might need this line of C code at the start of your program to configure the internal oscillator to 32MHz.

Code: Select all

OSCCON = 0xF0;
For future reference the INTOSC helper component available from the Tools component toolbar helps to setup internal oscillator options.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: PIC16F1788 Clock?

Post by medelec35 »

Hi seokgi,
Your code is missing a C Code block with an OSCCON value at the very start of your program.
The OSCCON=0xXX value sets the speed of internal oscillator.
Without the OSCCON value set, the internal oscillator will run at the default value.
Looking at the datasheet on page 86,its 500KHz:
Internal osc.png
(49.71 KiB) Downloaded 1475 times
That's why your hardware is not running correctly.
The easiest way to obtain the correct value is on your flowchart, go to tools and Add IntOsc Helper to your panel.
Right-click the INT OSC Icon on the panel and select properties.
Change the Oscillator Speed to 32000000
The Code will contain the word OSCCON and the value along with a semicolon.
Click on the generated value so it's all highlighted.
Right-click Copy.
Add a C code block to the very top of Main so it's always the first thing that's accessed.
Within the C Code block, right-click and select paste.
Now recompile and see if the clock is running at the correct speed.

Edit:
Whoops, Ben beat me to it, but as it took a little while for me to type, will leave the post in.
Martin

seokgi
Posts: 164
Joined: Fri Jan 13, 2012 4:21 am
Location: South KOREA
Has thanked: 18 times
Been thanked: 16 times
Contact:

Re: PIC16F1788 Clock?

Post by seokgi »

It was resolved.
thank you very much.
I am very adorable in FC.

Thank you MATRIX.

Post Reply