Multiple Cogs with PASM - Structure of pasm code
Jkane
Posts: 113
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
I was just curious before i start making large changes.
regards
Jeff
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
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