Parallax BASIC Stamp 2e Programming Manual page 146

Table of Contents

Advertisement

I2COUT - BASIC Stamp Command Reference
Explanation
2
The I
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
allows the BASIC Stamp to send data to an I
The following is an example of the I2COUT command:
I2COUT 0, $A0, 5, [100]
This code will transmit a "write" command to an I
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).
Page 144 • BASIC Stamp Programming Manual 2.0b • www.parallaxinc.com
2
C devices.
SDA
P0
SCL
P1
Vdd
1
8
2
7
3
6
4
5
24LC16B
(DIP)
Vss
The I2COUT command
2
C device.
2
C device (connected to
4.7 k
4.7 k
A
I2COUT
SIMPLE
EXAMPLE
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.
S
ENDING AND FORMATTING DATA
.
.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the BASIC Stamp 2e and is the answer not in the manual?

Table of Contents