Shop OBEX P1 Docs P2 Docs Learn Events
Multiple Cogs with PASM - Structure of pasm code — Parallax Forums

Multiple Cogs with PASM - Structure of pasm code

JkaneJkane Posts: 113
edited 2014-05-22 09:52 in Propeller 1
Hello,

I have a questions

what is the structure for multiple cogs when using pasm

for example two pasm routines, 1 for each cog.

DAT (only one DAT)
ORG 0 'Begin at Cog Ram addr 0
head_interface
..... code (main and subroutines)
......variables
..... res
ORG 0 'Begin at Cog Ram addr 0
cog_33Mhz_clock
..... code (main and subroutine)
......variables
..... res


Spin code would be to start cogs
flag_HI := true
    flag_33MHZ  := true
    
    cog_head_interface := cognew(@head_interface, @flag_HI) + 1
   
  ' let Head Interface cog start
  
   ' waitcnt(cnt + (clkfreq / 1000))
    cog_33Mhz_clock  := cognew(@cog_33Mhz_clock, @flag_33MHZ) + 1
    ' let 33MHz cog start
  
    waitcnt(cnt + (clkfreq / 1000))
  ' wait for cog to stop
    repeat
    while (flag_HI == true)


I was just curious before i start making large changes.

regards

Jeff

Comments

  • JkaneJkane Posts: 113
    edited 2014-05-22 09:52
    ok,

    got it, sorry, local variables vs global variables

    all is well.

    ORG 0 'Begin at Cog Ram addr 0
    head_interface
    ..... code (main and subroutines using local labels (:label vs label)
    ......local variables
    .....local res
    ORG 0 'Begin at Cog Ram addr 0
    cog_33Mhz_clock
    ..... code (main and subroutine (main and subroutines using local labels (:label vs label)
    .....local .variables
    ..... local res



    regards

    Jeff
Sign In or Register to comment.