Propeller Manual

Table Of Contents
2: Spin Language Reference – DAT
Propeller Manual v1.1 · Page 103
Delay res 1
Time res 1
When a Propeller Application initially boots up, only Spin code is executed. At any time,
however, that Spin code can choose to launch assembly code into a cog of its own. The
COGNEW (page 78) and COGINIT (page 76) commands are used for this purpose. The following
Spin code example launches the
Toggle assembly code shown above. )
PUB Main
cognew(@Toggle, 0) 'Launch Toggle code
The COGNEW instruction, above, tells the Propeller chip to launch the Toggle assembly code
into a new cog. The Propeller then finds an available cog, copies the code from the
DAT block
starting at
Toggle into the cog’s RAM, and then starts the cog which begins executing code
from Cog RAM location 0.
A
DAT block may contain multiple Propeller Assembly programs, or multiple DAT blocks may
each contain individual assembly programs, but in both cases, each assembly program should
begin with an
ORG directive (page 328) to reset the assembly pointer properly.
Dual Commands
The Spin and Propeller Assembly languages share a number of like-named commands, called
dual commands. These dual commands perform similar tasks but each has a different syntax
structure that resembles the language in which it is written; Spin vs. Propeller Assembly.
Any dual commands that are used in a
DAT block are considered to be assembly instructions.
Conversely, any dual commands that are used in
PUB and PRI blocks are considered to be Spin
commands.