Shop OBEX P1 Docs P2 Docs Learn Events
Is clock speed constant?? — Parallax Forums

Is clock speed constant??

krazyideaskrazyideas Posts: 119
edited 2008-10-24 22:25 in Propeller 1
Hello

I'm useing a 5 MHz crystal with

_clkmode······= xtal1 + pll16x·
_xinfreq······· = 5_000_000

and I just want to know if I can use clock cycles for referance to timing some time sensitive intervols in my program?
I was sure I could but then I started reading a bunch of stuff in the manule till I became unsure.

Thanks

Ps useing this clock cycle ( 80MHz I do belive) 384_000_000 clocks·is about 8 seconds is it not???

Comments

  • Brian218Brian218 Posts: 92
    edited 2008-10-22 04:47
    Hi Krazyideas,

    Yes, you can; check out page 184 (CNT) of the manual; it explains how to synchronize an event.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    This post is a work of art. Variations in spelling and grammar are intentional, artistic endeavors that add value to all of mankind.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-10-22 04:51
    The system clock is indeed usable for timing intervals and it is constant, as stable as the crystal used. Look at the datasheet for the crystal used to see the accuracy and the sensitivity to temperature.

    For larger time periods (like seconds) the CLKFREQ function returns the number of clocks in one second. Eight seconds would be CLKFREQ * 8

    The advantage of using CLKFREQ is that it's adjusted when _clkmode and _xinfreq are changed.
  • krazyideaskrazyideas Posts: 119
    edited 2008-10-22 04:57
    Thank you very much
  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2008-10-24 22:14
    Wouldn't the error of the crystal be multiplied by 16 like the clock speed?
    I'm not an expert in PLL's but it seems like there would be some linear relationship between crystal error and clock speed?
    Jim-
  • Paul BakerPaul Baker Posts: 6,351
    edited 2008-10-24 22:25
    The tolerance of crystals is measured in parts per million (ppm). Taking the worst tolerance for a 5MHz crystal availible crystal from digikey (50 ppm), the maximum error would be·+/- 4kHz for 80 MHz. This is insignificant for practically all applications.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.

    Post Edited (Paul Baker (Parallax)) : 10/24/2008 10:37:16 PM GMT
Sign In or Register to comment.