cognew(spin-method, stack-pointer) ?
Steve Nelick
Posts: 25
When you use the cognew instruction, does the spin-method have to be a local method? When I wrote:
· cognew(OBJ2.SomeMethod, @Stack)
the program compiled, but the program did not work!
To get my program to work I had to add a local method:
· cognew(Method1, @Stack)
PRI Method1
· OBJ2.SomeMethod·
·
· cognew(OBJ2.SomeMethod, @Stack)
the program compiled, but the program did not work!
To get my program to work I had to add a local method:
· cognew(Method1, @Stack)
PRI Method1
· OBJ2.SomeMethod·
·
Comments
In regards to starting new Spin cogs, only peer level methods may be launched in adherence of the OO concept of encapsulation.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
________
{{ TestCognew.spin }}
OBJ
OBJ2 : "TestCognewObj"
PUB Main
outa[noparse][[/noparse]16]~~
dira[noparse][[/noparse]16]~~
OBJ2.Start
repeat
!outa[noparse][[/noparse]16]
waitcnt(12_000_000 + cnt)
________
{{ TestCognewObj.spin }}
VAR
long Stack[noparse][[/noparse]10]
PUB Start
cognew(SomeMethod, @Stack)
PUB SomeMethod | n
repeat
n++
________