Shop OBEX P1 Docs P2 Docs Learn Events
Share Your [Working] Spin2 Snippets, Please :) - Page 4 — Parallax Forums

Share Your [Working] Spin2 Snippets, Please :)

124»

Comments

  • evanhevanh Posts: 15,916
    Cool, shows I've never used it.
  • JonnyMacJonnyMac Posts: 9,104
    edited 2020-04-15 16:19
    For any given X, a duty cycle of 50% produces the highest frequency output when using NCO_DUTY mode.
  • JonnyMacJonnyMac Posts: 9,104
    edited 2020-04-16 00:28
    (deleted)
  • Cluso99Cluso99 Posts: 18,069
    edited 2020-04-17 02:10
    Finally have spin code calling hubexec code working. :)

    It is really simple code that just flashes the P56 LED on the P2EVAL pcb. I had to cull my code back to only the basics to get something working.
    CON
      _clkfreq      = 297_000_000		                    'set clock frequency
      LED_p2eval    = 56                                    ' P2EVAL Blue LED 0=ON
    
    PUB go()
    
        repeat
    '        PINTOGGLE(LED_p2eval)
            PR0 := 10
            CALL(@_HubToggle)                               ' call Toggle LED
            WAITMS(4000)                                    ' 4s        
    
    
    DAT             
                  orgh
    _hubToggle
    '              mov       PR0,#10                         ' spin pasm comms registers
    .loop         drvnot    #LED_p2eval                     ' flash P2EVAL blue led
                  waitx     ##_clkfreq/2                    ' 0.5s
                  djnz      PR0,#.loop
                  RET                                       ' return
    
    Note the two lines commented out to give alternative uses.
Sign In or Register to comment.