PDA

View Full Version : RCFAST, CLKFREQ and _CLKFREQ



ericball
07-06-2009, 11:57 PM
The Prop Manual specifies RCFAST having a nominal clock rate of 12MHz with a range between 8MHz and 20MHz. Is CLKFREQ (i.e. LONG[0]) set to any particular value? Can CLKFREQ be set via _CLKFREQ?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Composite NTSC sprite driver: http://forums.parallax.com/showthread.php?p=800114
NTSC & PAL templates: http://forums.parallax.com/showthread.php?p=803904

localroger
07-07-2009, 12:05 AM
eric, according to the manual clkfreq is set by your choice of clock mode, pll setting, and so on; _clkfreq is just a constant used by your program you can set to anything. clkfreq can change if you change the clock mode in midstream (as the prop certainly lets you do) but _clkfreq will always reflect the original settings set when your program started. clkfreq will change when you prefrom a clkmode or clkset command.

It looks to me like you will get the "nominal" setting if the clock mode is rcfast regardless of the real clock speed.

Mike Green
07-07-2009, 12:19 AM
The only hardware mode changed by the compiler / bootloader is the clock mode. _CLKFREQ/CLKFREQ is just the long at location zero. The compiler sets it to whatever you specify as _CLKFREQ and it gets changed if you call CLKSET from your program. CLKSET also changes the byte at location 4 which is used for _CLKMODE/CLKMODE and then that new value is used to change the actual clock mode.

CLKFREQ is used by convention by programs and objects to adjust for different clock speeds. If you set _CLKMODE and _CLKFREQ or _XINFREQ properly, everything should work out. RCFAST and RCSLOW are not accurate and are temperature sensitive as well, so CLKFREQ is not useful there.

ericball
07-07-2009, 01:47 AM
Thanks. Reading through the Prop Manual again, it certainly looked like _CLKFREQ could be used to set CLKFREQ even for RCFAST.

And yes, I know that RCFAST isn't a known frequency and is temperature sensitive. But, I'm hoping it's stable enough for my evil plans. If the user can set _CLKFREQ then the program can use that value as a "best guess". If the output isn't quite right, the user updates _CLKFREQ and reloads.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Composite NTSC sprite driver: http://forums.parallax.com/showthread.php?p=800114
NTSC & PAL templates: http://forums.parallax.com/showthread.php?p=803904