Shop OBEX P1 Docs P2 Docs Learn Events
How do I "suspend" a cog - or is it worth it. — Parallax Forums

How do I "suspend" a cog - or is it worth it.

bdickensbdickens Posts: 110
edited 2008-10-21 23:07 in Propeller 1
I have a situation where a cog is running ping. But about 50% of the time, I don't need it. So I was considering adding a method and suspending the cog until it is needed again. Looking at the posts, there doesn't seem consensus that it's even worth doing. Doesn't seem to draw much additional power and the code overhead might make it pretty pointless.

So is there an efficient way to suspend a cog (without a stop/start) ? Is the savings in power significant ?
Thanks

Comments

  • KeezinatorKeezinator Posts: 21
    edited 2008-10-21 21:09
    The wait instructions put your cog in a lower power consumption state. Seems like the simplest. If waitcnt does not work for you, you could use the waiteq and set the pin you are waiting for in the right state from another cog.

    Haven't tested it, so let me know your milage smile.gif
  • Beau SchwabeBeau Schwabe Posts: 6,562
    edited 2008-10-21 21:12
    bdickens,

    This sounds like something that can be placed in in-line code.· What I mean is that a dedicated cog may not be necessary if·can be shared within one cog that also·performs other·tasks.· This situation usually lends itself to the main·"parent cog", but certainly is not confined to that position.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Earl FosterEarl Foster Posts: 185
    edited 2008-10-21 22:36
    Can you use the·WAITCNT command·on a per cog basis? or is it global?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    WWW.HAPB.NET

    "Don't ask yourself what the world needs - ask yourself what makes you come alive, and then go do it." - H.T.Whitman
  • Mike GreenMike Green Posts: 23,101
    edited 2008-10-21 23:07
    WAITCNT suspends the current cog (the one executing the WAITCNT) until the specified system clock value is equal to the system clock (CNT).
Sign In or Register to comment.