I got the cognew blues!
I have only used cognew indirectly using other objects.
I wanted to blink a pin in the background,
but the code below does not work.
When I uncomment the method blinkled it works,
but the method does not work when I run it with cognew.
I wanted to blink a pin in the background,
but the code below does not work.
When I uncomment the method blinkled it works,
but the method does not work when I run it with cognew.
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
VAR
long pin
long high,low
long blinkstack[noparse][[/noparse]32]
PUB startledcog
low := 7
high := 7
pin := low
dira[noparse][[/noparse]low..high]~~
high++
'blinkled
cognew(Blinkled, @blinkstack)
PUB Blinkled
repeat
repeat until pin == high
!outa[noparse][[/noparse]pin]
pin++
waitcnt(55_00000 + cnt)
pin:=low

Comments
dira[noparse][[/noparse]pin]~~
with every repeat loop in the BlinkLed PUB then it should work.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't click on this.....
Use the Propeller icon!!
You had better not start ANOTHER PropII thread.
was something to do with cognew and I was looking in the wrong
place all afternoon.
I must say that I would have never thought of this exept that I, too, have run into this problem multiple times, mainly forgetting the dira all together!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't click on this.....
Use the Propeller icon!!
You had better not start ANOTHER PropII thread.
-Phil
here is the scenerio:
Top file runs in cog 0, and that calls the cog start method in "Object A"
"Object A" in it's init, starts cog1 with an infinite loop.
Later on, Top file needs "Method Z" from "Object A". Method Z is not used by the infinite loop in cog 1.
I am just about positive that the infinite loop will not prevent this from happenening. If this the case, does it run "Method 1" in cog 0, or would it run it in cog 1, interrupting the loop?
I really hope that made sense to everyone. If not, I can try to re-phrase it.
Yes, you can call your MethodeZ in the sub-objectA. It will run in Cog0, if called from the Top object. You can the same methode also call from your "infinite cog1 Loop", then it will run in cog1. It's the Spin interpreter in a cog that decides in which cog a methode is executed and not the methode, or the object.
Hope this helps
Andy