PUB does notload to COG
nicolad76
Posts: 164
Hi,
I have been using COGS forever but always loading PASM.
Today I do not really need PASM (lucky day!!!) so all my routines are in SPIN.
I checked the manual on how to execute SPIN to a cog but I could not get it to work.
What am I doing wrong?
The original file is in attachment.
Pub Main | cN , ok
Setup(11,10,10,21,20,0)
ok := (cN:=CogNew(PPark(bStopDir0,bStopDir1,bDirection,bParkDirection,bStep,lStepPerUnit),@stack))>0
Nothing happens when I use the above code. If I call the PUB
PPark(bStopDir0,bStopDir1,bDirection,bParkDirection,bStep,lStepPerUnit)
Then it get executed. This prove that the PUB itself shold not be an issue.
Thanks!!!!
I have been using COGS forever but always loading PASM.
Today I do not really need PASM (lucky day!!!) so all my routines are in SPIN.
I checked the manual on how to execute SPIN to a cog but I could not get it to work.
What am I doing wrong?
The original file is in attachment.
Pub Main | cN , ok
Setup(11,10,10,21,20,0)
ok := (cN:=CogNew(PPark(bStopDir0,bStopDir1,bDirection,bParkDirection,bStep,lStepPerUnit),@stack))>0
Nothing happens when I use the above code. If I call the PUB
PPark(bStopDir0,bStopDir1,bDirection,bParkDirection,bStep,lStepPerUnit)
Then it get executed. This prove that the PUB itself shold not be an issue.
Thanks!!!!
spin
1K
Comments
-Phil
Each cog has its own copy of the DIRA and OUTA registers. When you execute Setup, that sets up the DIRA register in the main cog. When PPark executes, it's using a different DIRA register that's initialized to zero. You have to move the code from Setup into the beginning of PPark so the proper DIRA register gets initialized.
I moved the DIRA[] into the PUB and it works!!!!
Fixed in les then 5 minutes!!!! This is a great FORUM!!!
Nicola
-Phil