Launching into a new cog
Penguin-fach
Posts: 11
As a newbie to the Propeller I would really appreciate it if someone would clarify something for me.
I have an application where an LCD will update a virtual date display in response to pulses: one day increment per pulse. The pulses are generated by another method. For my test code I have a top method that for the purposes of the test will generate the pulses using a timing loop. There are two other objects; one controls the LCD and the other performs the date calculations and assembles the displayed text.
My question is how best to launch the date display into another cog? Am I correct in understanding that once a method is launched into a new cog that this method has to have a repeat loop. If I were to launch a method into a new cog and that method only runs once what happens to the newly launched cog once the method ends and what happens to any associated data?
I have an application where an LCD will update a virtual date display in response to pulses: one day increment per pulse. The pulses are generated by another method. For my test code I have a top method that for the purposes of the test will generate the pulses using a timing loop. There are two other objects; one controls the LCD and the other performs the date calculations and assembles the displayed text.
My question is how best to launch the date display into another cog? Am I correct in understanding that once a method is launched into a new cog that this method has to have a repeat loop. If I were to launch a method into a new cog and that method only runs once what happens to the newly launched cog once the method ends and what happens to any associated data?
Comments
Here's a tiny demo for launching a new cog.
If you post your code we could help more.
I would avoid using "coginit" unless you really know what you're doing. (I personally have never used it.)
As I said in my other post, I haven't use coginit. I don't think the cog pauses without a loop; I believe it stops and you'd have to relaunch it. (I'm not sure about this, in most cases you want a loop to keep the cog alive.)
Each cog has its own I/O registers, so you have to initialize them using the cog that will use the I/O pins. This is particularly true for I/O pins used as outputs.
Regards, Simon