The following constants are pre-defined by the compiler, and are available in both Spin and Propeller Assembly.
Constants (Pre-defined in Spin and Propeller Assembly) | ||||
---|---|---|---|---|
Constant |
Definition |
Value (Decimal) |
Value (Hexadecimal) |
Value (Binary) |
TRUE |
Logical true |
-1 |
$FFFFFFFF |
%11111111111111111111111111111111 |
FALSE |
Logical false |
0 |
$00000000 |
%00000000000000000000000000000000 |
POSX |
Maximum positive integer |
2,147,483,647 |
$7FFFFFFF |
%01111111111111111111111111111111 |
NEGX |
Maximum negative integer |
-2,147,483,648 |
$80000000 |
%10000000000000000000000000000000 |
PI |
Floating-point value for PI |
≈ 3.141593 |
$40490FDB |
%01000000010010010000111111011011 |
RCFAST |
Internal fast oscillator |
1 |
$00000001 |
%00000000000000000000000000000001 |
RCSLOW |
Internal slow oscillator |
2 |
$00000002 |
%00000000000000000000000000000010 |
XINPUT |
External clock/oscillator |
4 |
$00000004 |
%00000000000000000000000000000100 |
XTAL1 |
External low-speed crystal |
8 |
$00000008 |
%00000000000000000000000000001000 |
XTAL2 |
External medium-speed crystal |
16 |
$00000010 |
%00000000000000000000000000010000 |
XTAL3 |
External high-speed crystal |
32 |
$00000020 |
%00000000000000000000000000100000 |
PLL1X |
External frequency times 1 |
64 |
$00000040 |
%00000000000000000000000001000000 |
PLL2X |
External frequency times |
128 |
$00000080 |
%00000000000000000000000010000000 |
PLL4X |
External frequency times 4 |
256 |
$00000100 |
%00000000000000000000000100000000 |
PLL8X |
External frequency times 8 |
512 |
$00000200 |
%00000000000000000000001000000000 |
PLL16X |
External frequency times 16 |
1024 |
$00000400 |
%00000000000000000000010000000000 |
TRUE and FALSE are usually used for Boolean comparison purposes:
if (X = TRUE) or (Y = FALSE) <code to execute if total condition is true>
POSX and NEGX are typically used for comparison purposes or as a flag for a specific event:
if Z > NEGX <code to execute if Z hasn't reached smallest negative>
—or—
PUB FindListItem(Item) : Index
Index := NEGX 'Default to "not found" response <code to find Item in list> if <item found> Index := <items index>
PI can be used for floating-point calculations, either floating-point constants or floating-point variable values using the FloatMath and FloatString object.
RCFAST through PLL16X are described in the Clock Mode Settings Constants table.
Note that they are enumerated constants and are not equivalent to the corresponding CLK register value. See the CLK Register Table for information regarding how each constant relates to the CLK register bits.
Propeller Help Version 1.1
Copyright © Parallax Inc.
5/13/2009