I2COUT - BASIC Stamp Command Reference
Page 144
•
BASIC Stamp Programming Manual 2.0b
•
www.parallaxinc.com
Explanation
The I
2
C protocol is a form of synchronous serial communication developed
by Phillips Semiconductors. It only requires two I/O pins and both pins
can be shared between multiple I
2
C devices. The I2COUT command
allows the BASIC Stamp to send data to an I
2
C device.
The following is an example of the I2COUT command:
I2COUT 0, $A0, 5, [100]
This code will transmit a "write" command to an I
2
C device (connected to
I/O pins 0 and 1), followed by an address of 5 and finally will transmit the
number 100.
The above example will write a byte of data to location 5 of a 24LC16B
EEPROM from Microchip. Figure 5.9 shows the proper wiring for this
example to work. The SlaveID argument ($A0) is both the ID of the chip
and the command to write to the chip; the 0 means write. The Address
argument (5) is the EEPROM location to write to.
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).
A
SIMPLE
I2COUT
EXAMPLE
.
S
ENDING AND FORMATTING DATA
.
Figure 5.9: Example Circuit for the
I2COUT command and a 24LC16B
EEPROM. Note: The 4.7 K
Ω
Ω
resisters are required for the
I2COUT command to function
properly.
Vss
P1
Vdd
4.7 k
Ω
P0
24LC16B
(DIP)
4.7 k
Ω
SDA
SCL
1
2
3
4
8
7
6
5
Summary of Contents for BASIC Stamp 1
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...