Shop OBEX P1 Docs P2 Docs Learn Events
Control Phase on NCO - Page 2 — Parallax Forums

Control Phase on NCO

2»

Comments

  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2006-07-19 18:20
    Chip,

    Your code works well, but I want to add, that you must put an RC filter off of the pin in order for it to look like what you would expect.

    Here is a demo (modified from your original) that just sweeps the Sine Phase on one of the pins. It uses the same "phase" object.

    [b]CON[/b]
    
      [b]_clkmode[/b] = [b]xtal[/b]1 + [b]pll[/b]16x
      [b]_xinfreq[/b] = 5_000_000
    
      Hz = $8000_0000 / 125_000
      Deg = $8000_0000 / 180
    
    [b]VAR[/b]
      [b]long[/b]  freq, offset
    
    [b]OBJ[/b]
      phase : "phase"
    
    [b]PUB[/b] start
    
      'start phase
      phase.start(0, 1, @freq)
    
      '(phase object continuously reads freq and offset)
      freq    := 1000 * Hz
      offset  := 0
      
      
      [b]repeat[/b]
        offset += Deg/100          'Increment Phase by .01 Deg
    
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
    501 x 749 - 116K
  • MrPittsMrPitts Posts: 2
    edited 2006-07-20 17:39
    Wow Guys!! You are all awesome. My originial question was probably a bit misleading from the intended need, however, Chip, Beua and rokicki put me on the right path. You all rock! Thanks for all the valuable information.

    I love the propeller! What an awesome chip. I see no limit to its potential. It's really got me jazzed about embedded applications again. Parallax has restored my faith.

    Best regards,

    Ron
Sign In or Register to comment.