5: BASIC Stamp Command Reference – I2COUT
BASIC Stamp Programming Manual 2.0c
•
www.parallaxinc.com
•
Page 145
Value VAR BYTE
Value = 65
I2COUT 0, $A0, 0, [Value] 'send the ASCII value for "A"
I2COUT 0, $A0, 0, [REP Value\5] 'send the ASCII value for "A" five times, ie: "AAAAA"
I2COUT 0, $A0, 0, [DEC Value] 'send two characters, "6" and "5"
I2COUT 0, $A0, 0, [HEX Value] 'send two characters, "4" and "1"
I2COUT 0, $A0, 0, [BIN Value] 'send seven characters, "1000001"
Tables 5.20 and 5.21 list all the available conversion formatters and special
formatters available to the I2COUT command. See the DEBUG and
SEROUT commands for additional information and examples of their use.
Conversion
Formatter
Type of Number
Notes
DEC{1..5} Decimal, optionally fixed to 1 – 5 digits
1
SDEC{1..5} Signed decimal, optionally fixed to 1 – 5 digits
1,2
HEX{1..4} Hexadecimal, optionally fixed to 1 – 4 digits
1
SHEX{1..4} Signed hexadecimal, optionally fixed to 1 – 4 digits
1,2
IHEX{1..4} Indicated hexadecimal, optionally fixed to 1 – 4 digits ($ prefix)
1
ISHEX{1..4}
Signed, indicated hexadecimal, optionally fixed to 1 – 4 digits
($ prefix)
1,2
BIN{1..16} Binary, optionally fixed to 1 – 16 digits
1
SBIN{1..16} Signed binary, optionally fixed to 1 – 16 digits
1,2
IBIN{1..16} Indicated binary, optionally fixed to 1 – 16 digits (% prefix)
1
ISBIN{1..16} Signed, indicated binary, optionally fixed to 1 – 16 digits (% prefix)
1,2
1 Fixed-digit formatters like DEC4 will pad the number with leading 0s if necessary; ex:
DEC4 65 sends 0065. If a number is larger than the specified number of digits, the
leading digits will be dropped; ex: DEC4 56422 sends 6422.
2 Signed modifiers work under two's complement rules.
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 I
2
C protocol has a well-defined standard for the information passed at
the start of each transmission. First of all, any information sent must be
transmitted in units of 1 byte (8-bits). The first byte, we call the SlaveID, is
an 8-bit pattern whose upper 7-bits contain the unique ID of the device
Table 5.20: I2COUT Conversion
Formatters.
T
HE
I
2
C
PROTOCOL FORMAT
.
Table 5.21: I2COUT Special
Formatters.
Содержание 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...