5: BASIC Stamp Command Reference – I2COUT
BASIC Stamp Programming Manual 2.0c
•
www.parallaxinc.com
•
Page 143
I2COUT
BS1 BS2 BS2e BS2sx
BS2p
I2COUT
Pin, SlaveID, Address {\LowAddress}, [OutputData]
Function
Send data to a device using the I
2
C protocol.
•
Pin
is a variable/constant/expression (0 or 8) that specifies which
I/O pins to use. I
2
C devices require two I/O pins to communicate.
The Pin argument serves a double purpose; specifying the first pin
(for connection to the chip's SDA pin) and, indirectly, the other
required pin (for connection to the chip's SCL pin). See explanation
below. Both I/O pins will be toggled between output and input
mode during the I2COUT command and both will be set to input
mode by the end of the I2COUT command.
•
SlaveID
is a variable/constant/expression (0 – 255) indicating the
unique ID of the I
2
C chip.
•
Address
is a variable/constant/expression (0 – 255) indicating the
desired address within the I
2
C chip to send data to. The Address
argument may be used with the optional LowAddress argument to
indicate a word-sized address value.
•
LowAddress
is a variable/constant/expression (0 – 255) indicating
the low-byte of the word-sized address within the I
2
C chip to receive
data from. This argument must be used along with the Address
argument.
•
OutputData
is a list of variables, constants, expressions and
formatters that tells I2COUT how to format outgoing data. I2COUT
can transmit individual or repeating bytes, convert values into
decimal, hexadecimal or binary text representations, or transmit
strings of bytes from variable arrays. These actions can be combined
in any order in the OutputData list.
Quick Facts
BS2p
Values for Pin
0 or 8
I/O pin
arrangement
When Pin is 0: When Pin is 8:
0: Serial Data (SDA) pin 8: Serial Data (SDA) pin
1: Serial Clock (SCL) pin 9: Serial Clock (SCL) pin
Transmission
Rate
Approximately 81 kbits/sec (not including overhead).
Special notes
Both the SDA and SCL pins must have 4.7 K
Ω
pull-up resisters.
The I2COUT command does not allow for multiple masters.
The BASIC Stamp cannot operate as an I
2
C slave device.
Table 5.19: I2COUT Quick Facts.
p
2
Summary of Contents for BASIC Stamp 2e
Page 1: ...BASIC Stamp Programming Manual Version 2 0c...
Page 34: ...Quick Start Guide Page 32 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Page 340: ...ASCII Chart Page 338 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Page 342: ...Reserved Words Page 340 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Page 346: ...Conversion Formatters Page 344 BASIC Stamp Programming Manual 2 0b www parallaxinc com...