Shop OBEX P1 Docs P2 Docs Learn Events
Debug with it's own cog? — Parallax Forums

Debug with it's own cog?

In a lot of my programs I'll start a second SPIN cog and run all the debug stuff in it's own method.
I've thought that that means the main cog SPIN program isn't slowed down by the debug stuff...
Is that correct?
Thanks,
Mike

Comments

  • JonnyMacJonnyMac Posts: 9,567

    I used to do that, too, and still do when I want nice formatting on the output terminal (e.g., PST). If your background cog is simply displaying global variables being used by your main cog, then it shouldn't have any impact on the speed of your main cog.

  • Generally whatever is happening in one cog does not slow down or speed up another. The Propeller is specifically designed to avoid this sort of "scary action at a distance".

    The only exception is when using locks or other forms of explicit synchronization, which relates back to debugging: The debugger uses a lock bit to arbitrate access to the serial port. If one cog is hogging this debugger lock (by constantly printing debug messages) then other cogs will wait on that lock whenever they want to print a message.

Sign In or Register to comment.