27220 Parallax Inc, 27220 Datasheet - Page 196

BOOK STAMPWORKS

27220

Manufacturer Part Number
27220
Description
BOOK STAMPWORKS
Manufacturer
Parallax Inc
Datasheet

Specifications of 27220

Accessory Type
Booklet
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
StampWorks
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Not applicable / Not applicable
Page 186 · StampWorks
the Slave address and the Stop are dependent on the device and the application
process.
What you'll need to do is get the data sheet for the I2C device you want to connect
to. You will find that most data sheets for I2C-compatible parts have very clear
protocol definitions – usually in graphic form – that make implementing the low-level
I2C routines very simple.
The experiment uses the low-level I2C routines to implement the Write_Byte and
Read_Byte routines. These routines are generalized to work with any I2C device,
allowing the slave address, number of address bytes, and the address to read or
write (if required). Note that each routine begins with an I2C Start condition and is
terminated with the Stop condition.
The code in between sends the device
command/type code, the address to deal with and then actually deals with (writes or
reads) the data.
While this takes a few lines of code, it is actually very
straightforward.
The core of the demo program loops through the available addresses of the 24LC32
EEPROM, writing and reading back four distinct bit patterns. If the value read back
does not match the value written, a variable called fails is incremented. The Debug
Terminal window gives current status of the program as shown below. Note that
with 4096 addresses and four writes and reads at each address, this program takes a
bit of time to run through to completion.

Related parts for 27220