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.
PIC16F1788 Clock?
Moderator: Benj
- 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?
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.
For future reference the INTOSC helper component available from the Tools component toolbar helps to setup internal oscillator options.
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;
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- 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?
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: 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.
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: 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
-
- 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?
It was resolved.
thank you very much.
I am very adorable in FC.
Thank you MATRIX.
thank you very much.
I am very adorable in FC.
Thank you MATRIX.