Download Parallax Propeller Manual v1.0 - Personal Websites PDF

TitleParallax Propeller Manual v1.0 - Personal Websites
LanguageEnglish
File Size4.6 MB
Total Pages438
Document Text Contents
Page 1

Propeller Manual
Version 1.01

Page 2

WARRANTY
Parallax Inc. warrants its products against defects in materials and workmanship for a period of 90 days from receipt of product.
If you discover a defect, Parallax Inc. will, at its option, repair or replace the merchandise, or refund the purchase price. Before
returning the product to Parallax, call for a Return Merchandise Authorization (RMA) number. Write the RMA number on the
outside of the box used to return the merchandise to Parallax. Please enclose the following along with the returned merchandise:
your name, telephone number, shipping address, and a description of the problem. Parallax will return your product or its
replacement using the same shipping method used to ship the product to Parallax.

14-DAY MONEY BACK GUARANTEE
If, within 14 days of having received your product, you find that it does not suit your needs, you may return it for a full refund.
Parallax Inc. will refund the purchase price of the product, excluding shipping/handling costs. This guarantee is void if the
product has been altered or damaged. See the Warranty section above for instructions on returning a product to Parallax.

COPYRIGHTS AND TRADEMARKS

This documentation is copyright © 2006 by Parallax Inc. By downloading or obtaining a printed copy of this documentation or
software you agree that it is to be used exclusively with Parallax products. Any other uses are not permitted and may represent a
violation of Parallax copyrights, legally punishable according to Federal copyright or intellectual property laws. Any duplication
of this documentation for commercial uses is expressly prohibited by Parallax Inc. Duplication for educational use is permitted,
subject to the following Conditions of Duplication: Parallax Inc. grants the user a conditional right to download, duplicate, and
distribute this text without Parallax's permission. This right is based on the following conditions: the text, or any portion thereof,
may not be duplicated for commercial use; it may be duplicated only for educational purposes when used solely in conjunction
with Parallax products, and the user may recover from the student only the cost of duplication.

This text is available in printed format from Parallax Inc. Because we print the text in volume, the consumer price is often less
than typical retail duplication charges.

Parallax, Propeller Spin, and the Parallax and Propeller Hat logos are trademarks of Parallax Inc. BASIC Stamp, Stamps in
Class, Boe-Bot, SumoBot, Toddler, and SX-Key are registered trademarks of Parallax, Inc. If you decide to use any trademarks
of Parallax Inc. on your web page or in printed material, you must state that (trademark) is a (registered) trademark of Parallax
Inc.” upon the first appearance of the trademark name in each printed document or web page. Other brand and product names
herein are trademarks or registered trademarks of their respective holders.

ISBN 1-928982-38-7

Page 219

4: Spin Language Reference – FRQA, FRQB

Propeller Manual v1.0 · Page 219

FRQA, FRQB
Counter A and Counter B frequency registers.

((PUB ┆ PRI))
FRQA
((PUB ┆ PRI))
FRQB
Returns: Current value of Counter A or Counter B Frequency Register, if used as a source
variable.


Explanation
FRQA and FRQB are two of six registers (CTRA, CTRB, FRQA, FRQB, PHSA, and PHSB) that affect the
behavior of a cog’s Counter Modules. Each cog has two identical counter modules (A and B)
that can perform many repetitive tasks. The FRQA register contains the value that is
accumulated into the PHSA register. The FRQB register contains the value that is accumulated
into the PHSB register. See CTRA, CTRB on page 204 for more information.

Using FRQA and FRQB
FRQA and FRQB can be read/written just like any other register or pre-defined variable. For
example:

FRQA := $00001AFF

The above code sets FRQA to $00001AFF. Depending on the CTRMODE field of the CTRA
register, this value in FRQA may be added into the PHSA register at a frequency determined by
the System Clock and the primary and/or secondary I/O pins. See CTRA, CTRB on page 204 for
more information.

Page 220

IF – Spin Language Reference

Page 220 · Propeller Manual v1.0

IF
Test condition(s) and execute a block of code if valid (positive logic).

((PUB ┆ PRI))
IF Condition(s)
IfStatement(s)
ELSEIF Condition(s)
ElseIfStatement(s) …
ELSEIFNOT Condition(s)
ElseIfNotStatement(s) …
ELSE
ElseStatement(s)


• Condition(s) is one or more Boolean expressions to test.
• IfStatement(s) is a block of one or more lines of code to execute when the IF’s

Condition(s) is true.
• ElseIfStatement(s) is an optional block of one or more lines of code to execute when all

the previous Condition(s) are invalid and the ELSEIF’s Condition(s) is true.
• ElseIfNotStatement(s) is an optional block of one or more lines of code to execute when

all the previous Condition(s) are invalid and the ELSEIFNOT’s Condition(s) is false.
• ElseStatement(s) is an optional block of one or more lines of code to execute when all

the previous Condition(s) are invalid.


Explanation
IF is one of the three major conditional commands (IF, IFNOT, and CASE) that conditionally
executes a block of code. IF can optionally be combined with one or more ELSEIF
commands, one or more ELSEIFNOT commands, and/or an ELSE command to form
sophisticated conditional structures.

IF tests Condition(s) and, if true, executes IfStatement(s). If Condition(s) is false, the
following optional ELSEIF Condition(s), and/or ELSEIFNOT Condition(s), are tested, in order,
until a valid condition line is found, then the associated ElseIfStatement(s), or
ElseIfNotStatement(s), block is executed. The optional ElseStatement(s) block is executed if
no previous valid condition lines are found.

A “valid” condition is one that evaluates to TRUE for a positive conditional statement (IF or
ELSEIF) or evaluates to FALSE for a negative conditional statement (ELSEIFNOT).

Page 437

Index

Propeller Manual v1.0 · Page 437

| (local variable separator), 313
|, |= (Bitwise OR), 270
|| (Absolute Value), 261
|< (Bitwise Decode), 265
~ (Sign-Extend 7 or Post-Clear), 262
~~ (Sign-Extend 15 or Post-Set), 263
~>, ~>= (Shift Arithmetic Right), 264
+ (Positive), 256
+ + (Increment, pre- or post-), 257
+, += (Add), 255
<#, <#= (Limit Maximum), 261
<-, <-= (Bitwise Rotate Left), 267
<, <= (Boolean Is Less Than), 276
<<, <<= (Bitwise Shift Left), 266
<>, <>= (Boolean Is Not Equal), 275
= (Constant Assignment), 254
=<, =<= (Boolean Is Equal or Less), 277
= =, = = = (Boolean Is Equal), 275
=>, =>= (Boolean Is Equal or Greater), 277
->, ->= (Bitwise Rotate Right), 268
>, >= (Boolean Is Greater Than), 276
>| (Bitwise Encode), 266
><, ><= (Bitwise Reverse), 268
>>, >>= (Bitwise Shift Right), 267
AND, AND= (Boolean AND), 272
NOT (Boolean), 274
OR, OR= (Boolean OR), 273

Symbols (spin), 312–13
Symbols (table), 312–13
Symbols:, 208, 215, 247, 310, 312
Synchronized delay, 323
Synchronized Delay Timing (figure), 325
Syntax definitions (asm), 348
Syntax definitions (spin), 160
System Clock, 22, 133, 175, 177, 183
System Clock frequency, 175
System Clock speed (spec), 16
System Clock Tick vs. Time (table), 175
System Counter, 23, 27, 94, 184

T
Tables

Bitwise AND Truth Table, 269
Bitwise NOT Truth Table, 272
Bitwise OR Truth Table, 270
Bitwise XOR Truth Table, 271

CLK Register Structure, 28
Clock Mode Setting Constants, 180, 181
Conditions, Assembly, 369
Counter Modes, 207
CTRA and CTRB Registers, 205
Effects, Assembly, 371
Example Data in Memory, 209
Math/Logic Operators, 250
Operator Precedence Levels, 251
Pin Descriptions, 15
PLLDIV Field, 205
Propeller Assembly Instructions, 350–51
Registers, Cog, 397
Reserved Words, 419
Sharing Examples, 27
Shortcut Keys – By Key, 80–84
Shortcut Keys – Categorical, 75–79
Special Purpose Registers, 23, 305
Specifications, 16
Symbols, 312–13
System Clock Ticks vs. Time, 175
VCFG Register, 317
VSCL Register, 320

TEST (asm), 409
Text Bigger (menu), 47
Text Smaller (menu), 47
Time, calculating, 325
Timing, 27
TJNZ (asm), 410
TJZ (asm), 410–11
TO (spin), 293, 295
Toggle, 94
Top Object File, 88, 89, 113, 114
Top Object, Setting (figure), 115
TRUE, 202
TRUNC, 146
TRUNC (spin), 314
Truth tables

Bitwise AND, 269
Bitwise NOT, 272
Bitwise OR, 270
Bitwise XOR, 271

TV, 139
Two Cogs, Running (figure), 108

Page 438

Index

Page 438 · Propeller Manual v1.0

U
Unary / binary, 251
Unary operators (asm), 346
Unary operators (spin), 156
Underscore, _, 312
Underscores as delimiters, 98
Undo (menu), 46
Unicode-encoded, 35
UNTIL (spin), 294, 297
Update Status (menu), 47

V
Value representations, 159
VAR (spin), 315–16
VAR block, 107
Variable Assignment ‘:=’, 255
Variable block, 99, 315
Variable declarations, 166, 237, 315, 332
Variable scope, 316
Variable type

Byte, 16, 165
Long, 16, 236
Word, 16, 331

VCFG, 23, 305
VCFG (asm), 397
VCFG (spin), 317–19
VCFG Register (table), 317
Version number, 174
Video Configuration register, 23, 317
Video Scale register, 23, 320
View Character Chart… (menu), 48
View Info… (menu), 47
View modes, 41, 61
View Modes (figure), 62
Viewing Multiple Objects (figure), 42, 43
VSCL, 23, 305
VSCL (asm), 397
VSCL (spin), 320–21
VSCL Register (table), 320

W
Wait, 94
WAITCNT (asm), 411

WAITCNT (spin), 322–25
Waiting for transitions, 327
WAITPEQ (asm), 412
WAITPEQ (spin), 326–27
WAITPNE (asm), 413
WAITPNE (spin), 328
WAITVID (asm), 414
WAITVID (spin), 329–30
Warranty, 2
WC (asm), 371
WHILE (spin), 294, 297
Whole Words (find), 50
Word

Aligned, 209
Memory type, 16, 331
Reading/writing, 333, 396, 416
Variable declaration, 331

WORD (spin), 331–34
WORDFILL (spin), 335
WORDMOVE (spin), 336
Work and library folders, 141
Work and Library Folders (figure), 141
Work folder, 52, 53, 141
WR (asm), 371
WRBYTE (asm), 414–15
WRLONG (asm), 415
WRWORD (asm), 416
WZ (asm), 371

X
XI (pin), 15
XI capacitance, 29
XINPUT, 29, 30, 180, 202, 203
XO (pin), 15
XOR (asm), 417
XOR, Bitwise ‘^’, ‘^=’, 271
XOUT resistance, 29
XTAL1, 29, 180, 202, 203
XTAL2, 29, 180, 202, 203
XTAL3, 29, 180, 202, 203

Z
Zero-terminated strings, 309

Similer Documents