BASIC stamp manual v2.2

5: BASIC Stamp Command Reference – I2COUT
BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com Page 227
The I2COUT command's OutputData argument is similar to the DEBUG
and SEROUT command's OutputData argument. This means data can be
sent as literal text, ASCII character values, repetitive values, decimal,
hexadecimal and binary translations and string data as in the examples
below. (Assume the 24LC16B EEPROM is being used).
value VAR Byte
value = 65
I2COUT 0, $A0, 0, [value] ' send "A"
I2COUT 0, $A0, 0, [REP value\5] ' send "AAAAA"
I2COUT 0, $A0, 0, [DEC value] ' send "6" and "5"
I2COUT 0, $A0, 0, [HEX value] ' send "4" and "1"
I2COUT 0, $A0, 0, [BIN value] ' send "1000001"
Table 5.36 and Table 5.37 list all the available formatters for the I2COUT
command. See the DEBUG and SEROUT commands for additional
information and examples of their use.
Table 5.36: I2COUT Conversion
Formatters.
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,3
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.
3 The HEX modifier can be used for BCD to Decimal Conversion. See “Hex to BCD
Conversion” on page 97.
S
ENDING AND FORMATTING DATA.