Shop OBEX P1 Docs P2 Docs Learn Events
Newbie question about starting new cogs — Parallax Forums

Newbie question about starting new cogs

billiam2536billiam2536 Posts: 28
edited 2009-12-15 07:50 in Propeller 1
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 if your interested in the project. Maybe go to the bottom of the page wink.gif

Comments

  • ElectricAyeElectricAye Posts: 4,561
    edited 2009-12-15 03:27
    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

    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

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

    http://forums.parallax.com/showthread.php?p=574524

    Post Edited (ElectricAye) : 12/15/2009 3:33:14 AM GMT
  • Michael O'BrienMichael O'Brien Posts: 55
    edited 2009-12-15 07:50
    Hi,
    ·· 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)
    

    /michael·
Sign In or Register to comment.