View Full Version : Newbie question about starting new cogs

12-15-2009, 10:07 AM
I have several objects that need to be operated all at the same time. How do I simply load the other objects, from within the top object, into new cogs and let them do there thing?

Working on getting money for autopilot project. Come check out my site (http://theguidingpropeller.blogspot.com) if your interested in the project. Maybe go to the bottom of the page http://forums.parallax.com/images/smilies/wink.gif

12-15-2009, 10:27 AM
You can read about Methods and Cogs on page 67 of the PE labs book:

www.parallax.com/Portals/0/Downloads/docs/prod/prop/PELabsFunBook-v1.1.pdf (http://www.parallax.com/Portals/0/Downloads/docs/prod/prop/PELabsFunBook-v1.1.pdf)

Information about using Objects follows the aforementioned section.

Also, you can read about the Cognew command in the Propeller Manual

www.parallax.com/Portals/0/Downloads/docs/prod/prop/WebPM-v1.1.pdf (http://www.parallax.com/Portals/0/Downloads/docs/prod/prop/WebPM-v1.1.pdf)

Also, you can take a look at Example 3 on this:


Post Edited (ElectricAye) : 12/15/2009 3:33:14 AM GMT

Michael O'Brien
12-15-2009, 02:50 PM
·· The following code snippet gets all 8 cogs running methods in the·current object

PUB Main
' Load all other 7 processors on-chip first
cognew(Process(1, COG1_INIT, COG1_STATE, 0), @regStack1)
cognew(Process(2, COG2_INIT, COG2_STATE, 0), @regStack2)
cognew(Process(3, COG3_INIT, COG3_STATE, 1), @regStack3)
cognew(Process(4, COG4_INIT, COG4_STATE, 1), @regStack4)
cognew(Process(5, COG5_INIT, COG5_STATE, 0), @regStack5)
cognew(Process(6, COG6_INIT, COG6_STATE, 0), @regStack6)
cognew(ProcessEdgeCog(7, COG7_INIT, COG7_STATE, COG7_IN,COG7_OUT, 0), @regStack7)
' load current processor 0 last
ProcessEdgeCog(0, COG0_INIT, COG0_STATE, COG0_IN,COG0_OUT,0)