9.5. INTER-INTEGRATED COMMUNICATION - I
C MODULE 297
serial clock line (SCL). By conﬁguring devices connected to the common I
C line as either a master
device or a slave device, multiple devices can share information using the common bus.
The difference between a master device and a slave device is that a master device initiates
a communication by means of either requesting data from another device or sending data to a
designated device. A master device must also provide a clock signal (SCL).
The MSP430’s universal serial communication interface (USCI) can be programmed to op-
erate in the I
C communication mode. As seen earlier in this chapter, the USCI_Ax ports are
programmed to operate in the UART, IrDA, and SPI communication mode while the USCI_Bx
ports are used for the I
C and SPI serial communication modes.
C communication is initiated by sending an address of a desired destination device connected
C bus.The device address can be either a 7-bit number or a 10-bit number, depending
on the number of devices connected to the bus. Of course, all devices on the same bus must use the
same addressing mode and program accordingly.
One of the reasons the I
C serial communication became popular is its ﬂexibility to allow
multiple master devices to co-exist on a same bus. The MSP430 USCI device allows its I
munication unit to operate either in the standard mode (100 kbps) or in the fast mode (400 kbps).
We now show how a USCI_Bx port is programmed to operate on an I
C bus. To initialize
a USCI_Bx port as an I
C communication port, you must: (1) set the UCSWRST bit in the
UCxCTL1 register to one, (2) conﬁgure the I
C mode of operation by setting UCMODEx bits to
11 and initialize the USCI registers, and (3) set up an actual port with a pull up resistor. As soon as
the UCSWRST bit is cleared, the I
C communication of MSP430 can commence.
Figure 9.7: Data format for both 7-bit and 10-bit addressing modes.