Page 1 of 1

Clock Speed

Posted: Sat Nov 18, 2017 8:47 pm
by billduck
In previous versions of FC, one could change the clock speed. Not V7. The reason I want to do this is that I use Timer1 and overflow interrupt to
have a minute variable be relatively accurate during a day, for a solar tracking application. I use a real time clock to update the time daily, to be dead on.
By using a clock speed of 15,999,522 HZ , the minutes are close to accurate over a 24 hour period. I have included the program. Is there way to change the clock speed. It is hard coded to 16 mega Hz.

Hardware:UNO R3 PDIP
PostToMatrix_re ClockSpeed.fcfx
(9.41 KiB) Downloaded 246 times

Re: Clock Speed

Posted: Sat Nov 18, 2017 8:57 pm
by billduck
I note that when the target chip is changed to the ATMEGA 328P, which is what the UNO uses, (instead of the UNO R3 PDIP) , then you can change the clock speed.

Re: Clock Speed

Posted: Sat Nov 18, 2017 9:13 pm
by kersing
billduck wrote:Hardware:UNO R3 PDIP
Clock speeds are fixed for hardware with fixed crystal oscillators like the arduino boards.

Re: Clock Speed

Posted: Sat Nov 18, 2017 9:16 pm
by billduck
I was able to key in a value in previous versoins of FC. I assume I accomplished what I intended.
Seems logical though. I am assuming that since I can change the clock speed when I use ATMEGA328P, that this is incorrect also.

Re: Clock Speed

Posted: Mon Nov 20, 2017 11:42 am
by Benj
Hi billduck,

For the Arduino devices we lock the clock speed as most users won't ever want to change it.

You can override the clock speed yourself by going into the "Flowcode 7\FCD\AVR" directory

Copy the file "Arduino Uno R3 PDIP.fcdx" to your desktop.

Open the file on your desktop using a text editor such as notepad.

Right near the top of the file is this section.

Code: Select all

    <clock max_speed="16000000"
           master_divider="1"
           fixed="16000000" />
Change the fixed value to match the clock speed setting you require.

For example:

Code: Select all

fixed="15999522"
Save the file and copy back in to the "Flowcode 7\FCD\AVR" directory