5: BASIC Stamp Command Reference – I2CIN
BASIC Stamp Programming Manual 2.0c
•
www.parallaxinc.com
•
Page 139
Value VAR BYTE(13)
I2CIN 0, $A1, 0, [Value] 'receive the ASCII value for "V"
I2CIN 0, $A1, 0, [DEC Value] 'receive the number 3.
I2CIN 0, $A1, 0, [HEX Value] 'receive the number $3A.
I2CIN 0, $A1, 0, [BIN Value] 'receive the number %101.
I2CIN 0, $A1, 0, [STR Value\13] 'receive the string "Value: 3A:101"
Tables 5.17 and 5.18 list all the available conversion formatters and special
formatters available to the I2CIN command. See the SERIN command for
additional information and examples of their use.
Conversion
Formatter
Type of Number
Numeric Characters Accepted
Notes
DEC{1..5}
Decimal, optionally limited to 1 –
5 digits
0 through 9
1
SDEC{1..5}
Signed decimal, optionally
limited to 1 – 5 digits
-, 0 through 9
1,2
HEX{1..4}
Hexadecimal, optionally limited
to 1 – 4 digits
0 through 9, A through F
1,3
SHEX{1..4} Signed hexadecimal, optionally
limited to 1 – 4 digits
-, 0 through 9, A through F
1,2,3
IHEX{1..4}
Indicated hexadecimal,
optionally limited to 1 – 4 digits
$, 0 through 9, A through F
1,3,4
ISHEX{1..4}
Signed, indicated hexadecimal,
optionally limited to 1 – 4 digits
-, $, 0 through 9, A through F
1,2,3,4
BIN{1..16}
Binary, optionally limited to
1 – 16 digits
0, 1
1
SBIN{1..16}
Signed binary, optionally limited
to 1 – 16 digits
-, 0, 1
1,2
IBIN{1..16}
Indicated binary, optionally
limited to 1 – 16 digits
%, 0, 1
1,4
ISBIN{1..16}
Signed, indicated binary,
optionally limited to 1 – 16 digits
-, %, 0, 1
1,2,4
1 All numeric conversions will continue to accept new data until receiving either the specified
number of digits (ex: three digits for DEC3) or a non-numeric character.
2 To be recognized as part of a number, the minus sign (-) must immediately precede a
numeric character. The minus sign character occurring in non-numeric text is ignored and
any character (including a space) between a minus and a number causes the minus to be
ignored.
3 The hexadecimal formatters are not case-sensitive; “a” through “f” means the same as “A”
through “F”.
4 Indicated hexadecimal and binary formatters ignore all characters, even valid numerics,
until they receive the appropriate prefix ($ for hexadecimal, % for binary). The indicated
formatters can differentiate between text and hexadecimal (ex: ABC would be interpreted
by HEX as a number but IHEX would ignore it unless expressed as $ABC). Likewise, the
binary version can distinguish the decimal number 10 from the binary number %10. A
prefix occurring in non-numeric text is ignored, and any character (including a space)
between a prefix and a number causes the prefix to be ignored. Indicated, signed
formatters require that the minus sign come before the prefix, as in -$1B45.
Table 5.17: I2CIN Conversion
Formatters.
Содержание 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...