Parallax BASIC Stamp 2e Programming Manual page 201

Table of Contents

Advertisement

R
ECEIVING FORMATTED DATA
Table 5.45: OWIN Special
Formatters.
5: BASIC Stamp Command Reference – OWIN
FirstBit
VAR
SecondBit VAR
OWIN 0, 6, [FirstBit, SecondBit]
In the code above, we chose the value "6" for Mode. This sets Bit transfer
and Back-End Reset modes. Also, we could have chosen to make the
FirstBit and SecondBit variables each a byte in size, but they still would
only have received one bit each in the OWIN command (due to the Mode
we chose).
The OWIN command's InputData argument is similar to the SERIN
.
command's InputData argument.
ASCII character values, decimal, hexadecimal and binary translations and
string data as in the examples below. (Assume a 1-wire device is used and
that it transmits the string, "Value: 3A:101" every time it receives a Front-
End Reset pulse).
Value
VAR
OWIN 0, 1, [Value]
OWIN 0, 1, [DEC Value]
OWIN 0, 1, [HEX Value]
OWIN 0, 1, [BIN Value]
OWIN 0, 1, [STR Value\13]
Tables 5.45 and 5.46 list all the available special formatters and conversion
formatters available to the OWIN command. See the SERIN command for
additional information and examples of their use.
Special Formatter
STR ByteArray \L {\E}
WAITSTR ByteArray {\L}
SKIP Length
BIT
BIT
This means data can be received as
BYTE(13)
'receive the ASCII value for "V"
'receive the number 3.
'receive the number $3A.
'receive the number %101.
'receive the string "Value: 3A:101"
Input a character string of length L into an array. If specified, an
end character E causes the string input to end before reaching
length L. Remaining bytes are filled with 0s (zeros).
Wait for a sequence of bytes matching a string stored in an array
variable, optionally limited to L characters. If the optional L
argument is left off, the end of the array-string must be marked
by a byte containing a zero (0).
Ignore Length bytes of characters.
BASIC Stamp Programming Manual 2.0c • www.parallaxinc.com • Page 199
Action

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the BASIC Stamp 2e and is the answer not in the manual?

Table of Contents