Shop OBEX P1 Docs P2 Docs Learn Events
Spin2 cog start/stop - Page 2 — Parallax Forums

Spin2 cog start/stop

2»

Comments

  • AribaAriba Posts: 2,690
    Spin2 has no cognew, it's all done with coginit.
    instead of:
        cog := cognew(@PWM_Asm, @command)
    use:
        cog := coginit(16, @PWM_Asm, @command)
    
    16 means the first free cog is allocated, you can also start a specific cog if you use 0..7 instead of 16.

    There are threads abut the difference between Spin1 and Spin2.
  • That's looking better!
  • That helps alot. I suspected no cognew, but people were still posting code on this thread that uses cognew() - and the conversion table didn't really cover it.
    I became confused.

    I downloaded & read the 4 pages of Tricks, Traps & Differences thread, and some Conversion documentation from Rayman.
    But as I mentioned - assembly language is difficult for me.

    Thank you for the assistance.

  • jonabel1971jonabel1971 Posts: 184
    edited 2020-08-26 18:30
    Question moved to a different thread.

  • AribaAriba Posts: 2,690
    |< is the decode operator and is called DECOD now. But instead of DECOD, you can write:
    Mask          long      1<<0, 1<<1, 1<<2, 1<<3, 1<<4, 1<<5, 1<<6, 1<<7 
                  long      1<<8, 1<<9, 1<<10, 1<<11, 1<<12, 1<<13
                  ...
    
  • Thanks, that let me compile properly.
  • Since the internal clock is set at 20 Mhz, is there a way to use the external multiplier (320 Mhz) & pin I/O - to emulate a rudimentary ALU for faster calculations?

Sign In or Register to comment.