Shop OBEX P1 Docs P2 Docs Learn Events
Active cogs map — Parallax Forums

Active cogs map

WombaxWombax Posts: 19
edited 2011-03-07 15:37 in Propeller 1
Hello,
Is there any register or variable that allow to know directly which cogs are active ?
If not, is there any simple way to store the cogs status (on/off) without having to write a dedicated piece of program ?

Thank you,
Wombax.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-03-05 06:59
    There is no accessible register or variable that allows you to know directly which cogs are active. The only way to do this is to keep track of it yourself. Whenever you do a COGNEW, it returns the cog number used (or -1 if no cog was available). You can use this to keep a byte table of what cogs have been started. When your program explicitly stops a cog, you can clear the corresponding byte. If any running cog stops itself or allows itself to stop, it clears the byte. Obviously, if you're using existing objects that do a COGNEW, you'll have to modify them to update this byte array.
  • WombaxWombax Posts: 19
    edited 2011-03-07 12:23
    Thank you Mike.
    W.
  • AriAri Posts: 63
    edited 2011-03-07 15:20
    This is a real shame....I wish Parallax was more open with their schematic for the Propeller, as it would allow for such a program to be written. I see no reason that ViewPort couldn't show this activity. I would be happy to investigate it more, if Parallax would make their specifications more available.

    P.S. I am not sure that Parallax does or does not make this data available? I have yet to find it, as my concerns with Propeller are more about max theoretical electrical specs. I am really into power supplies (analog geek)
  • Dave HeinDave Hein Posts: 6,347
    edited 2011-03-07 15:37
    In most cases a cog map is not really needed. You either have enough cogs or you don't. If it is important to know which cogs are running you can do what Mike suggests and maintain a map that keeps track of COGNEWs and COGSTOPs. If this can't be done, a simple routine can be written to build a map by doing COGNEWs of a dummy routine until a -1 is returned, and then stopping all the cogs that are running the dummy routine.
Sign In or Register to comment.