BASIC stamp manual v2.2
5: BASIC Stamp Command Reference – I2CIN
BASIC Stamp Syntax and Reference Manual 2.2 • www.parallax.com • Page 217
I2CIN
BS1 BS2 BS2e BS2sx BS2p BS2pe BS2px
I2CIN Pin, SlaveID, { Address { \LowAddress }, } [ InputData ]
Function
Receive data from 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 I2CIN command and both will be set to input
mode by the end of the I2CIN command.
• SlaveID is a variable/constant/expression (0 – 255) indicating the
unique ID of the I
2
C chip.
• Address is an optional variable/constant/expression (0 – 255)
indicating the desired address within the I
2
C chip to receive data
from. The Address argument may be used with the optional
LowAddress argument to indicate a word-sized address value.
• LowAddress is an optional 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.
• InputData is a list of variables and modifiers that tells I2CIN what to
do with incoming data. I2CIN can store data in a variable or array,
interpret numeric text (decimal, binary, or hex) and store the
corresponding value in a variable, wait for a fixed or variable
sequence of bytes, or ignore a specified number of bytes. These
actions can be combined in any order in the InputData list.