USCI Operation: I2C Mode
21-17
Universal Serial Communication Interface, I2C Mode
I
2
C Master Receiver Mode
After initialization, master receiver mode is initiated by writing the desired
slave address to the UCBxI2CSA register, selecting the size of the slave
address with the UCSLA10 bit, clearing UCTR for receiver mode, and setting
UCTXSTT to generate a START condition.
The USCI module checks if the bus is available, generates the START
condition, and transmits the slave address. As soon as the slave
acknowledges the address the UCTXSTT bit is cleared.
After the acknowledge of the address from the slave the first data byte from
the slave is received and acknowledged and the UCBxRXIFG flag is set. Data
is received from the slave as long as UCTXSTP or UCTXSTT is not set. If
UCBxRXBUF is not read the master holds the bus during reception of the last
data bit and until the UCBxRXBUF is read.
If the slave does not acknowledge the transmitted address the
not-acknowledge interrupt flag UCNACKIFG is set. The master must react
with either a STOP condition or a repeated START condition.
Setting the UCTXSTP bit will generate a STOP condition. After setting
UCTXSTP, a NACK followed by a STOP condition is generated after reception
of the data from the slave, or immediately if the USCI module is currently
waiting for UCBxRXBUF to be read.
If a master wants to receive a single byte only, the UCTXSTP bit must be set
while the byte is being received. For this case, the UCTXSTT may be polled
to determine when it is cleared:
BIS.B #UCTXSTT,&UCB0CTL1 ;Transmit START cond.
POLL_STT
BIT.B #UCTXSTT,&UCB0CTL1 ;Poll UCTXSTT bit
JC
POLL_STT
;When cleared,
BIS.B #UCTXSTP,&UCB0CTL1 ;transmit STOP cond.
Setting UCTXSTT will generate a repeated START condition. In this case,
UCTR may be set or cleared to configure transmitter or receiver, and a different
slave address may be written into UCBxI2CSA if desired.
Figure 21−13 illustrates the I
2
C master receiver operation.
Note: Consecutive Master Transactions Without Repeated Start
When performing multiple consecutive I
2
C master transactions without the
repeated start feature, the current transaction must be completed before the
next one is initiated. This can be done by ensuring that the transmit stop
condition flag UCTXSTP is cleared before the next I
2
C transaction is initiated
with setting UCTXSTT = 1. Otherwise, the current transaction might be
affected.
Summary of Contents for MSP430x4xx Family
Page 1: ...MSP430x4xx Family 2007 Mixed Signal Products User s Guide SLAU056G ...
Page 2: ......
Page 6: ...vi ...
Page 114: ...3 76 RISC 16 Bit CPU ...
Page 304: ...5 20 FLL Clock Module ...
Page 340: ...7 8 Supply Voltage Supervisor ...
Page 348: ...8 8 16 Bit Hardware Multiplier ...
Page 372: ...9 24 32 Bit Hardware Multiplier ...
Page 400: ...10 28 DMA Controller ...
Page 428: ...13 10 Basic Timer1 ...
Page 466: ...15 24 Timer_A ...
Page 522: ...17 30 USART Peripheral Interface UART Mode ...
Page 544: ...18 22 USART Peripheral Interface SPI Mode ...
Page 672: ...23 12 Comparator_A ...
Page 692: ...24 20 LCD Controller ...
Page 746: ...26 28 ADC12 ...