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.
“Light thinks it travels faster than anything but it is wrong. No matter how fast light travels, it finds the darkness has always got there first, and is waiting for it.”
“You only live twice:
Once when you are born
And once when you look death in the face”

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 ?
    VT-100 Terminal and Graphics Card for the RC2014 Z80 Computer
  • Thanks for the help I will try that
    “Light thinks it travels faster than anything but it is wrong. No matter how fast light travels, it finds the darkness has always got there first, and is waiting for it.”
    “You only live twice:
    Once when you are born
    And once when you look death in the face”
Sign In or Register to comment.