User manual

GHI Electronics,LLC Embedded Master User Manual
Hardware and Software Library
spi.Write(data);
Thread.Sleep(Timeout.Infinite);
}
}
}
Reference
Microsoft.SPOT.Hardware.SPI
11.4. I2C
A good way to access multiple devices is through using I2C. Using only 2 open-drain wires
SCL (Serial Clock) and SDA (Serial Data), a master can access many slaves using their
address. When a master needs to send data on the bus, it sends out a 7-bit address of
the slave it wants to communicate with. The address is followed by a 1bit flag indicating if
the transfer is read or write. If the transfer was for read, the master will clock SCK 8 times
for the slave to send data on SDA. On the other hand, if the transfer was write, then the
master will clock out SCK while it is driving SDA with data.
PIN# TFT# Name Description
14 14 I2C_SCL I2C Serial Clock (Open Drain)
15 14 I2C_SDA I2C Serial Data (Open Drain)
Embedded Master supports one I2C port which is I2C0 on the LPC2478 chip.
Example
// create two bytes of data
byte [ ]data = new byte[2];
data[0] = 0x30;
data[1] = 0x55;
// Setup, address 0x50, clock rate 100
I2CDevice.Configuration config = new I2CDevice.Configuration(0x50, 100);
I2CDevice i2c = new I2CDevice(config);
// create transactions
I2CDevice.I2CTransaction [ ] trans = new I2CDevice.I2CTransaction[1];
trans[0] = i2c.CreateWriteTransaction(data);
// execute
i2c.Execute(trans, 100);
Rev. 2.06 TFT Page 63 of 102 www.ghielectronics.com