Shop OBEX P1 Docs P2 Docs Learn Events
COG Consolidation... — Parallax Forums

COG Consolidation...

Kaos KiddKaos Kidd Posts: 614
edited 2006-05-08 22:40 in Propeller 1
Interesting thing to note: Cogs go fast!
The attached program doesn't work, and the reason at this point (I can't debug the code yet!):··Not enough cogs.

I only use two objects: TV_Terminal.spin and Keyboard.spin
..Keyboard.spin, which has both a SPIN and ASSEBLY cog...
..TV_Terminal.spin, which has SPIN and it starts the following objects
....TV.SPIN, which·has both·SPIN cog and an ASSEMBLY cog...
....GRAPHICS.SPIN, which has both a SPIN and ASSEMBLY cog...

GRAPHICS.SPIN·(2 Cogs) + TV.SPIN (2 Cogs) + KEYBOARD.SPIN (2 Cogs) + TV_Terminal (1 Cog) = 7 cogs for Objects
When my program runs, only the PUB Start (and it's called code) runs, nothing else because I'm out of cogs!

Ok, this·limits what can be done with the existing OBJECTS...
Ideas anyone?




▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Just tossing my two bits worth into the bit bucket


KK

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-05-08 19:49
    When you're using objects like Graphics, et. al, the only additional cog requirement is for their assembly section; the Spin code is run in main memory and in effect becomes part of Cog 0 (launching cog).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • CJCJ Posts: 470
    edited 2006-05-08 20:12
    so basically you just call the startup methods rather than cognew them?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Who says you have to have knowledge to use it?

    I've killed a fly with my bare mind.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-05-08 20:19
    Yes; if you look into the Graphics.spin object, for example, you'll see that start method takes care of launching the assembly portion into its own cog -- the Spin methods in that object are folded into the main program and are available to it (as are any other Spin methods from other objects).

    KK: I just looked at your archive and I believe it should be using just four cogs: main, tv, graphics, keyboard.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax

    Post Edited (Jon Williams (Parallax)) : 5/8/2006 8:22:49 PM GMT
  • Kaos KiddKaos Kidd Posts: 614
    edited 2006-05-08 20:44
    Thanks Jon, what you said makes sence.
    When I get Home I'm going to DL it into the Propeller and give it a whirl...
    What did you think of the app?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Just tossing my two bits worth into the bit bucket


    KK
    ·
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-05-08 22:40
    I was only looking for possible problems, not judging it's beauty or lack thereof.... wink.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
Sign In or Register to comment.