FlexProp P1 Clock Frequency "C"
in Propeller 1
How does one change the Clock Mode and Frequency for the P1 in FlexPropC.
The FlexProp help file says...
Its been awhile since I have messed with spin but the propeller manual says....
I have tried multiple pieces of code but can't get anything to compile.
The FlexProp help file says...
P1 Clock Frequency
In C code, the P1 clock frequency defaults to 80 MHz, assuming a 5 MHz crystal and xtal1 + pll16x clock mode. This is a common configuration. You may override it with the builtin clkset function, which works the same as the Spin clkset builtin.
Its been awhile since I have messed with spin but the propeller manual says....
clkset(%01101100, 4_000_000) 'Set to XTAL1 + PLL2x
I have tried multiple pieces of code but can't get anything to compile.
Comments
#define clkset(a, b) _clkset(a, b)
Seems it has to be placed after int main.
int main(){ clkset(a, b) }
I was trying to set it before.
#include <simpletools.h> int counts = 0; int Mode = 111; //XTAL1 + PLL16X int MHZ = 80000000; int main(){ clkset(Mode , MHZ); // Set system mode and clock. while(1){ print("%c" , 16); // Clear PST print("Count = %d\n", counts); pause(100); counts = counts + 1; } }
So you only need to set it if you don't want the default.
This even applies to FlexSpin.
I know this but I am trying to overclock the prop and was having problems using the clkset(mode, frequency) function. I figured once I was able to get the code to compile I would be good but I am still having issues. I am hesitant to ask overclocking questions in this thread because I started a similar one 9 months ago for simpletools.