Shop OBEX P1 Docs P2 Docs Learn Events
RCFAST, CLKFREQ and _CLKFREQ — Parallax Forums

RCFAST, CLKFREQ and _CLKFREQ

ericballericball Posts: 774
edited 2009-07-06 18:47 in Propeller 1
The Prop Manual specifies RCFAST having a nominal clock rate of 12MHz with a range between 8MHz and 20MHz.· Is CLKFREQ (i.e. LONG[noparse][[/noparse]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

Comments

  • localrogerlocalroger Posts: 3,452
    edited 2009-07-06 17:05
    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 GreenMike Green Posts: 23,101
    edited 2009-07-06 17:19
    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.
  • ericballericball Posts: 774
    edited 2009-07-06 18:47
    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
Sign In or Register to comment.