Shop OBEX P1 Docs P2 Docs Learn Events
Propeller C launching cogs for the c beginners. — Parallax Forums

Propeller C launching cogs for the c beginners.

This is a c program to blink seperate pins as well as send on/off data and display it on the debug screen. It displays which cogs are launched then the status of each cog.
There are two ways to launch a cog in Prop C. I only found one to work.

Comments

  • A couple of things:
    cog=cogstart(blinkfunction,NULL,stack,sizeof(stack)); //this will not work
    cog2=cogstart(blinkfunction2,NULL,stack,sizeof(stack)); //this will not work
    

    You are using the same stack for both, you need separate stack othwise they will conflict with each other. Your code is actually running because the functions are not using the stack but as soon as you use a local variable you'll have problems.

    The cog variables are defined as int * (pointers) while cogstart returns an int. You need to define them as int then the assignment is correct.

    Other than that, I don't see any obvious error, I'm using cogstart in my programs much like you do and I don't have problems.
    What exaclty is that is not working ?
  • Thanks for the help I will try that
Sign In or Register to comment.