5: BASIC Stamp Command Reference – SEROUT
BASIC Stamp Programming Manual 2.0c
•
www.parallaxinc.com
•
Page 301
Special Formatter
Action
?
Displays "symbol = x' + carriage return; where x is a number.
Default format is decimal, but may be combined with
conversion formatters (ex: BIN ? x to display "x =
binary_number").
ASC ?
Displays "symbol = 'x'" + carriage return; where x is an ASCII
character.
STR ByteArray {\L}
Send character string from an array. The optional \L
argument can be used to limit the output to L characters,
otherwise, characters will be sent up to the first byte equal to
0 or the end of RAM space is reached.
REP Byte \L
Send a string consisting of Byte repeated L times
(ex: REP "X"\10 sends "XXXXXXXXXX").
The string formatter is useful for transmitting a string of characters from a
byte array variable. A string of characters is a set of characters that are
arranged or accessed in a certain order. The characters "ABC" could be
stored in a string with the "A" first, followed by the "B" and then followed
by the "C." A byte array is a similar concept to a string; it contains data
that is arranged in a certain order. Each of the elements in an array is the
same size. The string "ABC" could be stored in a byte array containing
three bytes (elements). See the “Defining Arrays” section in Chapter 4 for
more information on arrays.
Here is an example that transmits five bytes (from a byte array) through
I/O pin 1 at 9600 bps, N81/inverted:
SerString VAR BYTE(5) ' Make a 5-byte array.
SerString(0) = "H"
SerString(1) = "E"
SerString(2) = "L"
SerString(3) = "L"
SerString(4) = "O"
SEROUT 1, 16468, [ STR SerString\5 ] ' Send 5-byte string.
Note that we use the optional \L argument of STR. If we didn't specify
this, the BASIC Stamp would try to keep sending characters until it found
a byte equal to 0. Since we didn't specify a last byte of 0 in the array, we
chose to tell it explicitly to only send 5 characters.
Parity is a simple error-checking feature. When the SEROUT command's
Baudmode is set for even parity it counts the number of 1s in the outgoing
byte and uses the parity bit to make that number even. For instance, if it is
Table 5.86: BS2, BS2e, BS2sx and
BS2p Special Formatters.
T
HE
STR (
STRING
)
FORMATTER
.
U
SING PARITY AND HANDLING PARITY
ERRORS
.
Содержание 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...