Shop OBEX P1 Docs P2 Docs Learn Events
SPIN inner workings — Parallax Forums

SPIN inner workings

El PaisaEl Paisa Posts: 375
edited 2006-04-27 18:46 in Propeller 1
I am trying to grasp some of the concepts of SPIN.

When Parallax will be able to release more documentation about SPIN?.

For instance, in one of the examples which consist·in blink two leds five times using two COGS

The program specifies a stack for each COG.

Also specifies:
VAR
· long· stack0[noparse][[/noparse]20]·················· 'Sets up a stack space for a Cog(processor)
· long· stack1[noparse][[/noparse]20]·················· 'Sets up a stack space for a second Cog(processor)
·········································· 'long stack0[noparse][[/noparse]20]: Allocates 20 longs for the stack.
········································· ·'long stack1[noparse][[/noparse]20]: Allocates 20 longs for the stack.

Why 20 longs per stack per cog?

Only one·pin is·used five times for each COG.

What determines the depth of the stack?
When·the depth of the stack be bytes, nibles, words, longs?

You have to excuse me if I am lost in some of these concepts.


·

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-04-27 18:46
    As we've stated before, our plan is to release initial documentation on the day we start shipping chips. We're working our guts out, I promise.

    On your question regarding stack space, that will depend on what the cog in question is doing. Phil Pilgrim wrote a neat little spin program that keeps track of an object's stack and determines actual usage (displayed on LEDs). I have found this handy for decreasing stack size to what is needed; too much is a waste, too little may cause unreliable operation.

    Stack space must be declared as an array of longs because it is used to hold intermediate results of computations which are always longs.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
Sign In or Register to comment.