122-32000 Parallax Inc, 122-32000 Datasheet - Page 140

MANUAL PROPELLER

122-32000

Manufacturer Part Number
122-32000
Description
MANUAL PROPELLER
Manufacturer
Parallax Inc
Datasheets

Specifications of 122-32000

Accessory Type
Manual
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With/related Products
Propeller Education (PE) Kit
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Propeller Programming Tutorial
900 * 45 + 401 = 40,901
In hexadecimal it's = $9FC5
Counting by fives:
5, 10, 15, 20, 25, 30
Look at what we just achieved! Using just a few lines of our own code plus two existing
library objects and three resistors (on the Propeller Demo Board) we converted numeric
values to text strings and generated a TV-compatible signal to display that text in real time on
a standard TV! In fact, while you are reading this, a cog is keeping busy constantly
generating an NTSC signal at 60 frames per second that the TV can lock onto.
The TV_Terminal object provides a great display for debugging purposes.
Since the
Propeller has many processors and can run quite fast, a real-time display such as a TV
monitor (CRT or LCD) used for debugging purposes goes a long way toward developing
optimal source code. We recommend using this technique along with the usual debugging
techniques to speed up development time.
Let’s look at some important parts of our code now. The first new item in our code is the
that appears in Main’s declaration line. Don’t be fooled, this may look like a return
| Temp
variable declaration, but it is not. The pipe symbol ‘
’ indicates we are declaring local
|
variables next. So,
declares that
Temp
is a long-sized local variable for
.
| Temp
Main
Next we have two very important statements,
and
.
These two
Num.Init
TV.Start(12)
statements initialize the Numbers object and start the TV_Terminal object (on pins 12, 13 and
14), respectively. Each of these objects requires some kind of initialization before using it.
Numbers requires that its
method is called to initialize some internal registers.
Init
TV_Terminal requires that its
method is called to configure the proper output pins and
Start
to start two more cogs to generate the display signals. Objects typically indicate these
requirements in their documentation, but it is common that they include an
or a
Init
Start
method if they require some initial setup before use.
The next line performs some arithmetic and sets our local variable,
, to the result. We’ll
Temp
use this result soon.
The next three statements create the first line of text on the TV display:
. The
method outputs a zero-terminated string to the display.
9 * 45 + 401 = 40,901
TV.Str
Its parameter,
is new to us.
is a directive that creates a
string("900 * 45 + 401 = ")
STRING
zero-terminated string of characters (multiple bytes of character data followed by a zero;
sometimes called a z-string) and returns the address of that string. Most methods that deal
with strings require just the address of the starting character and for the string to end with a
byte equal to zero.
method’s parameter requires exactly that, the address of a zero-
TV.Str
Page 140 · Propeller Manual v1.0

Related parts for 122-32000