Shop OBEX P1 Docs P2 Docs Learn Events
I don't understand how waitcnt works — Parallax Forums

I don't understand how waitcnt works

sheonbankssheonbanks Posts: 10
edited 2007-12-09 06:13 in Propeller 1
I'm reading the ConstantBlinkRate.spin code. It states"
"For a 1 Hz on/off signal, replace both instances of clkfrq/2 with 2_500_000"

which would result in:
waitcnt(2_500_00 + CNT)

If the system clock is 80mHz where does the 1 Hz come from. I don't understand the correlation. Mathematically, given then various terms, I don't understand how you have a number(such as 2_500_000) in mHz producing a 1 Hz blink count?

Comments

  • BTXBTX Posts: 674
    edited 2007-12-09 00:21
    I have not near me that code, but......

    What about the:·· _clkmode·····and the··· _xinfreq·······values ?, in the CON block of the code.....

    Why do you afirm that the system clock is 80 Mhz ?? maybe it is only 5Mhz.

    Look close at the _clkmode·and the _xinfreq please. smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Regards.

    Alberto.
  • sheonbankssheonbanks Posts: 10
    edited 2007-12-09 00:26
    the code is using pll16x
  • deSilvadeSilva Posts: 2,967
    edited 2007-12-09 02:54
    Tutorial said...

    Timing with clkfreq vs. Timing with Constants
    Let’s say that a constant value is used in place of clkfreq to make the program work a certain way at
    one particular system clock frequency. What happens when the Propeller system clock frequency
    changes?
    * Save a copy of the ConstantBlinkRate object as BlinkRatesWithConstants.spin.
    * Make sure the PLL multiplier is set to pll1x so that the system clock runs at 5 MHz.
    * For a 1 Hz on/off signal, replace both instances of clkfrq/2 with 2_500_000.
    * Load the object into the Propeller chip’s RAM and verify that the LED blinks at 1 Hz.
    * Next, change the PLL multiplier to pll2x. Load the modified object into
  • rjo_rjo_ Posts: 1,825
    edited 2007-12-09 06:13
    Did that answer your question?

    Rich
Sign In or Register to comment.