Clock Speed

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

Moderator: Benj

Post Reply
billduck
Posts: 162
Joined: Thu Jul 01, 2010 1:57 am
Has thanked: 23 times
Been thanked: 16 times
Contact:

Clock Speed

Post 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 236 times

billduck
Posts: 162
Joined: Thu Jul 01, 2010 1:57 am
Has thanked: 23 times
Been thanked: 16 times
Contact:

Re: Clock Speed

Post 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.

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times

Re: Clock Speed

Post by kersing »

billduck wrote:Hardware:UNO R3 PDIP
Clock speeds are fixed for hardware with fixed crystal oscillators like the arduino boards.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

billduck
Posts: 162
Joined: Thu Jul 01, 2010 1:57 am
Has thanked: 23 times
Been thanked: 16 times
Contact:

Re: Clock Speed

Post 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.

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: Clock Speed

Post 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

Post Reply