BASIC Stamp Architecture – Constants and Expressions
Page 56
•
BASIC Stamp Programming Manual 2.0b
•
www.parallaxinc.com
The BS2e, BS2sx and BS2p have some additional RAM called Scratch Pad
RAM. The BS2e and BS2sx have are 64 bytes of Scratch Pad RAM (0 – 63)
and the BS2p has 128 bytes of Scratch Pad RAM (0 – 127). Scratch Pad
RAM can only be accessed with the GET and PUT commands (see the GET
and PUT command descriptions for more information) and cannot have
variable names assigned to it.
The highest location in Scratch Pad RAM (location 63 on the BS2e and
BS2sx, location 127 on the BS2p) is read-only, and always contains the
number of the currently running program slot. This can be handy for
programs that need to know which program slot they exist in.
Suppose you’re working on a program called “Three Cheers” that flashes
LEDs, makes hooting sounds, and activates a motor that crashes cymbals
together, all in sets of three. A portion of your PBASIC program might
contain something like:
FOR Counter = 1 TO 3
GOSUB MakeCheers
NEXT
...
FOR Counter = 1 TO 3
GOSUB BlinkLEDs
NEXT
...
FOR Counter = 1 TO 3
GOSUB CrashCymbals
NEXT
The numbers 1 and 3 in the code above are called constants. They are
constants because, while the program is running, nothing can happen to
change those numbers. This distinguishes constants from variables, which
can change while the program is running.
PBASIC allows you to use several numbering systems. By default, it
assumes that numbers are in decimal (base 10), our everyday system of
numbers. But you can also use binary and hexadecimal (hex) numbers by
identifying them with prefixes. And PBASIC will automatically convert
quoted text into the corresponding ASCII code(s). For example:
99 decimal
%1010 binary
$FE hex
“A” ASCII code for A (65)
C
ONSTANTS AND
C
OMPILE
-
TIME
E
XPRESSIONS
.
1
2
e
2
sx
2
p
2
1
2
e
2
sx
2
p
2
e
2
sx
2
p
2
S
CRATCH
P
AD
RAM.
Содержание BASIC Stamp 2e
Страница 1: ...BASIC Stamp Programming Manual Version 2 0c...
Страница 30: ...Introduction to the BASIC Stamps Page 28 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 34: ...Quick Start Guide Page 32 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 90: ...BUTTON BASIC Stamp Command Reference Page 88 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 118: ...END BASIC Stamp Command Reference Page 116 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 128: ...FREQOUT BASIC Stamp Command Reference Page 126 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 196: ...NAP BASIC Stamp Command Reference Page 194 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 206: ...OWIN BASIC Stamp Command Reference Page 204 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 214: ...OWOUT BASIC Stamp Command Reference Page 212 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 216: ...PAUSE BASIC Stamp Command Reference Page 214 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 226: ...POLLMODE BASIC Stamp Command Reference Page 224 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 232: ...POLLOUT BASIC Stamp Command Reference Page 230 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 236: ...POLLRUN BASIC Stamp Command Reference Page 234 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 240: ...POLLWAIT BASIC Stamp Command Reference Page 238 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 262: ...RCTIME BASIC Stamp Command Reference Page 260 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 274: ...RUN BASIC Stamp Command Reference Page 272 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 310: ...SEROUT BASIC Stamp Command Reference Page 308 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 324: ...STOP BASIC Stamp Command Reference Page 322 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 340: ...ASCII Chart Page 338 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 342: ...Reserved Words Page 340 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 346: ...Conversion Formatters Page 344 BASIC Stamp Programming Manual 2 0b www parallaxinc com...