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
Содержание BASIC Stamp 2e
Страница 1: ...BASIC Stamp Programming Manual Version 2 0c...
Страница 30: ...Introduction to the BASIC Stamps Page 28 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 34: ...Quick Start Guide Page 32 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 90: ...BUTTON BASIC Stamp Command Reference Page 88 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 118: ...END BASIC Stamp Command Reference Page 116 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 128: ...FREQOUT BASIC Stamp Command Reference Page 126 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 196: ...NAP BASIC Stamp Command Reference Page 194 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 206: ...OWIN BASIC Stamp Command Reference Page 204 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 214: ...OWOUT BASIC Stamp Command Reference Page 212 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 216: ...PAUSE BASIC Stamp Command Reference Page 214 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 226: ...POLLMODE BASIC Stamp Command Reference Page 224 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 232: ...POLLOUT BASIC Stamp Command Reference Page 230 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 236: ...POLLRUN BASIC Stamp Command Reference Page 234 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 240: ...POLLWAIT BASIC Stamp Command Reference Page 238 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 262: ...RCTIME BASIC Stamp Command Reference Page 260 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 274: ...RUN BASIC Stamp Command Reference Page 272 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 310: ...SEROUT BASIC Stamp Command Reference Page 308 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 324: ...STOP BASIC Stamp Command Reference Page 322 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 340: ...ASCII Chart Page 338 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 342: ...Reserved Words Page 340 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 346: ...Conversion Formatters Page 344 BASIC Stamp Programming Manual 2 0b www parallaxinc com...