BASIC Stamp Architecture – Memory Organization
Page 48
•
BASIC Stamp Programming Manual 2.0b
•
www.parallaxinc.com
circuit connected the I/O pin to ground, the corresponding bit of INS
would be low. If a pin was set to an output mode and the pin's state was
set to a high level (within OUTS), the corresponding bit of INS would be
high. If, however, that same pin was externally connected directly to
ground, the corresponding bit of INS would be low; since we're reading
the state of the pin itself and the BASIC Stamp cannot override a pin that is
driven to ground or 5 volts externally. Note: The last example is an error,
is a direct short and can cause damage to the BASIC Stamp! Do not
intentionally connect output pins directly to an external power source or
you risk destroying your BASIC Stamp.
To summarize: DIRS determines whether a pin’s state is set by external
circuitry (input, 0) or by the state of OUTS (output, 1). INS always matches
the actual states of the I/O pins, whether they are inputs or outputs. OUTS
holds bits that will only appear on pins whose DIRS bits are set to output.
In programming the BASIC Stamp, it’s often more convenient to deal with
individual bytes, nibbles or bits of INS, OUTS and DIRS rather than the
entire 16-bit words. PBASIC has built-in names for these elements, shown
in Table 4.2.
Here's an example of what is described in Table 4.2. The INS register is 16-
bits (corresponding to I/O pins 0 though 15). The INS register consists of
two bytes, called INL (the Low byte) and INH (the High byte). INL
corresponds to I/O pins 0 through 7 and INH corresponds to I/O pins 8
though 15. INS can also be though of as containing four nibbles, INA,
INB, INC and IND. INA is I/O pins 0 though 3, INB is I/O pins 4 though
7, etc. In addition, each of the bits of INS can be accessed directly using
the names IN0, IN1, IN2… IN5.
The same naming scheme holds true for the OUTS and DIRS variables as
well.
As Table 4.2 shows, the BASIC Stamp's memory is organized into 16
words of 16 bits each. The first three words are used for I/O. The
remaining 13 words are available for use as general-purpose variables.
Just like the I/O variables, the general-purpose variables have predefined
names: W0 through W12 and B0 through B25. B0 is the low byte of W0; B1
is the high byte of W0; and so on through W12 (B24=low byte, B25=high
P
REDEFINED
"F
IXED
" V
ARIABLES
.
S
UMMARY OF THE FUNCTION OF
DIRS, INS
AND
OUTS.
Содержание BASIC Stamp 1
Страница 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...