Page 1 of 1

FC7 PIC10F322 – Oscillator Error

Posted: Mon Jun 11, 2018 12:30 pm
by viki2000
Hi,

I have just seen your recent Vlog 7 about uC32 PWM on FC8:
http://www.matrixtsl.com/blog/flowcode- ... -with-pwm/
and being inspired by it I wanted to try a simple test with that code with PIC10F322 and PWM in FC7.
The PIC10F322 Datasheet Oscillator Module - page 24:
http://ww1.microchip.com/downloads/en/D ... 01585D.pdf
says that it is possible 16MHz clock with internal oscillator and of course I have test that in the past and it works up to 16MHz.
The FC7 does not let me 16MHz. It says 8MHz is max. allowed.
Can you help to correct that error?
Flowcode7_PIC10F322_OSC_Error.jpg
Flowcode7_PIC10F322_OSC_Error.jpg (49.08 KiB) Viewed 8422 times

Re: FC7 PIC10F322 – Oscillator Error

Posted: Mon Jun 11, 2018 1:17 pm
by hackinblack
The Osc speed selection dropdown does stop at a maximum of 8Mhz,which is wrong for this chip.
it's capable of 20Mhz clocked PWM. But your settings for the osc type are wrong..
you have ' EC on CLKIN pin ' selected...not the internal HS osc.
I changed some of the settings and added a C-block for the clock selection,from an XC-8 example)
here
http://e101.webs.com/pic10f322-sample-io-code
but it is still fixed at 8Mhz :(

Re: FC7 PIC10F322 – Oscillator Error

Posted: Mon Jun 11, 2018 2:17 pm
by LeighM
Thanks.
Please try this updated file, drop into your Flowcode7 installation \FCD\PIC directory

Re: FC7 PIC10F322 – Oscillator Error

Posted: Mon Jun 11, 2018 2:24 pm
by medelec35
Hi Viki,
Whilst waiting for Matrix to change the maximum speed,
If it's urgent you can modify maximum speed within fcdx file.

For 64 bit windows 10F322.fcdx can be found in:

Code: Select all

C:\Program Files (x86)\Flowcode 7\FCD\PIC\
32 bit windows

Code: Select all

C:\Program Files\Flowcode 7\FCD\PIC\
At the top of 10F322.fcdx you will see:

Code: Select all

<root>
<device name='10F322' product='PIC' family='10F' bits='8' >
    <clock max_speed='8000000' master_divider='4' default='8000000' />
Just change the speed, overwrite the original 10F322.fcdx then you can use the Reload option:
16MHz.png
(36.13 KiB) Downloaded 2828 times
Martin

Edit:
Although Leigh has posted the fix,
I will leave this in case anyone has a similar with other target devices.

Re: FC7 PIC10F322 – Oscillator Error

Posted: Tue Jun 12, 2018 7:36 am
by viki2000
Thank you LeighM and medelec35 for the solution. It works now indeed with 16MHz.
As hackinblack is right with the 20MHz observation when it comes to External Clock (EC) – datasheet page 168, TABLE 24-6, would that imply that we have to change the “10F322.fcdx” to 20MHz?

Code: Select all

<root>
<device name='10F322' product='PIC' family='10F' bits='8' >
    <clock max_speed='20000000' master_divider='4' default='8000000' />
@hackinblack
Your observation is definitely right. I noticed mistake by myself that after I asked the question, but it did not matter too much at that point. Later I changed too the Oscillator Selection bit to Internal oscillator.
One good additional question here would be if we really need that C code in the beginning, where we initialize the oscillator?

Code: Select all

#define _XTAL_FREQ 16000000
#pragma config FOSC = INTOSC

Re: FC7 PIC10F322 – Oscillator Error

Posted: Fri Jun 15, 2018 1:16 pm
by viki2000
Are my last 2 questions above improper or not interesting somehow?

Re: FC7 PIC10F322 – Oscillator Error

Posted: Fri Jun 15, 2018 1:47 pm
by LeighM
It’s difficult to be an expert on every PIC chip, and people only tend to answer if they are fairly sure of the answer.
The datasheet seems to indicate that the maximum clock is 16MHz, despite the PWM table including 20MHz.
You are free to edit the FCD file for this device to extend the max frequency to 20MHz, but whether the clock in can be driven at that rate I don’t know.

edit: Ben has just pointed me in the direction of page 158, I didn't get that far earlier :lol:

Re: FC7 PIC10F322 – Oscillator Error

Posted: Fri Jun 15, 2018 2:45 pm
by Benj
Hello,

No FCD file editing should be required.

If VDD <= 2.5V max clock = 16MHz
If VDD > 2.5V max clock = 20MHz

The clock speed in the project options can be selected from the drop down list or the value can be typed in directly. e.g. for values not in the list.
2018-06-15 14_42_31-Project Options.png
(10.67 KiB) Downloaded 2783 times
Just been chatting to Leigh and here are the 10F FCDs complete with the correct max clock settings.
PIC.zip
(15.44 KiB) Downloaded 220 times

Re: FC7 PIC10F322 – Oscillator Error

Posted: Mon Jun 18, 2018 8:25 am
by viki2000
Thank you for the corrected files.