Have spin main wait until a newcog pasm is finished.
Jkane
Posts: 113
Hello,
I have some pasm code, one main routine and about 10 subroutines, all is working fine,
in my main pasm routine i exit with
/CODE
mov ctra, #0
cogid cog_label
cogstop cog_label
CODE/
in my spin code i have:
/CODE
pst.Start(115_200)
waitcnt((clkfreq*4) + cnt)
pst.Str(String(" ",pst#NL))
pst.Str(String("Starting Head firing",pst#NL))
cog := cognew(@Head_interface,0) 'launch new cog for pasm
'do nothing while the cog is working, then continue
pst.Str(String("Stopping Head firing",pst#NL))
PUB Stop''Stops the Cog and the PID controller
if Cog
pst.Str(String("Stopping Head firing",pst#NL))
cogstop(Cog~ - 1)
/CODE
What I am trying to do is =====>
In the spin code, I want to do nothing until the cog (pasm exits), then continue
but as expected, the pst.string "stopping" displays right after the start, which makes sense
but i want the newcog to act as a subroutine, block the current cog while the other cogs executes, then continue
regards
Jeff
I have some pasm code, one main routine and about 10 subroutines, all is working fine,
in my main pasm routine i exit with
/CODE
mov ctra, #0
cogid cog_label
cogstop cog_label
CODE/
in my spin code i have:
/CODE
pst.Start(115_200)
waitcnt((clkfreq*4) + cnt)
pst.Str(String(" ",pst#NL))
pst.Str(String("Starting Head firing",pst#NL))
cog := cognew(@Head_interface,0) 'launch new cog for pasm
'do nothing while the cog is working, then continue
pst.Str(String("Stopping Head firing",pst#NL))
PUB Stop''Stops the Cog and the PID controller
if Cog
pst.Str(String("Stopping Head firing",pst#NL))
cogstop(Cog~ - 1)
/CODE
What I am trying to do is =====>
In the spin code, I want to do nothing until the cog (pasm exits), then continue
but as expected, the pst.string "stopping" displays right after the start, which makes sense
but i want the newcog to act as a subroutine, block the current cog while the other cogs executes, then continue
regards
Jeff
Comments
It would also be helpful if you posted your entire program.
-Phil
should read
-Phil
Before you have the cog commit hari-kari, write zero to this variable
The only thing the cog variable is telling you is that you did in fact launch the cog -- you don't need this to shut-down as that's being done in PASM.
thanks,
makes sense, I'll set it up tomorrow,
regards
Jeff
works very well, thanks
Jeff
Yes, I did try it with the A port and it works fine.