Shop OBEX P1 Docs P2 Docs Learn Events
10 mhz signal with ctra — Parallax Forums

10 mhz signal with ctra

tholbertontholberton Posts: 41
edited 2012-06-06 05:09 in Propeller 1
I'm trying to drive a 10mhz signal with a counter, and i'm not really getting a response with:
mov dira,#1
movi ctra,counter_control
movs ctra,#1
I've read about the frgx and phsx, but I don't understand what that has to do with the output of hte signal.
Can anyone explain this to me? I feel like such a newb right now

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2012-06-06 02:10
    tholberton wrote: »
    I'm trying to drive a 10mhz signal with a counter, and i'm not really getting a response with:
    mov dira,#1
    movi ctra,counter_control
    movs ctra,#1
    

    You're nearly there. First issue is, you setup dira for pin 0 (mask, |< 0) but tell the counter to use pin 1 (number). Then you need to give the counter something to work with, i.e. something which can be added to phsx in order to affect the output pin(s). Try this:
    mov     dira, #1             ' pin 0 (mask)
    movs    ctra, #0             ' pin 0 (number)
    movi    ctra, #%0_00100_000  ' NCO
    movi    frqa, #%00100000_0   ' clkfreq/8, frqx defaults to 0
    
    waitpeq $, #0
    
  • LeonLeon Posts: 7,620
    edited 2012-06-06 02:15
    Why do you need such a slow signal?
  • tholbertontholberton Posts: 41
    edited 2012-06-06 02:18
    SWEET. that worked. thank you! so how does frqa determine the clk frequency? also, I realized I didn't specify that variable.
    counter_control     long %0_00010_011_00000000_000000_000_000001
    
    cause I thought it would feed the pll into pin a
  • tholbertontholberton Posts: 41
    edited 2012-06-06 02:19
    @Leon - 10mhz or max 20 to use as an ext clock for a camera.
  • tholbertontholberton Posts: 41
    edited 2012-06-06 02:30
    ohhh, I get it now. I just read the prop datasheet section on freqx. it makes an addition to the phsx register. so it's eight clock cycles because the addition goes like:
    001
    010
    011
    100 - toggled on
    101
    110
    111
    001 - toggled off

    right?
  • kuronekokuroneko Posts: 3,623
    edited 2012-06-06 02:35
    tholberton wrote: »
    SWEET. that worked. thank you! so how does frqa determine the clk frequency?
    The NCO part is like clkfreq/(232/frqx). For PLL usage keep this between 4..8MHz, it then gets multiplied by 16 and scaled back by the PLL divider.
  • tholbertontholberton Posts: 41
    edited 2012-06-06 02:50
    okay, thanks. that last digit was suppose to be 000 actually. thanks though, it all just clicked for me right now.
  • LeonLeon Posts: 7,620
    edited 2012-06-06 04:05
    Is it really .01 Hz? I find that hard to believe!
  • tonyp12tonyp12 Posts: 1,951
    edited 2012-06-06 05:06
    M vs m, He probably should stated 10MHz
  • g3cwig3cwi Posts: 262
    edited 2012-06-06 05:09
    Leon wrote: »
    Is it really .01 Hz? I find that hard to believe!

    I see what you did there.

    Though 0.01Hz might be quite useful in time-lapse applications.
Sign In or Register to comment.