USCI Operation: I2C Mode
21-24
Universal Serial Communication Interface, I2C Mode
Interrupt Vector Assignment
USCI_Ax and USCI_Bx share the same interrupt vectors. In I
2
C mode the
state change interrupt flags UCSTTIFG, UCSTPIFG, UCNACKIFG, UCALIFG
from USCI_Bx and UCAxRXIFG from USCI_Ax are routed to one interrupt
vector. The I
2
C transmit and receive interrupt flags UCBxTXIFG and
UCBxRXIFG from USCI_Bx and UCAxTXIFG from USCI_Ax share another
interrupt vector.
Shared Interrupt Vectors Software Example
The following software example shows an extract of the interrupt service
routine to handle data receive interrupts from USCI_A0 in either UART or SPI
mode and state change interrupts from USCI_B0 in I
2
C mode.
USCIA0_RX_USCIB0_I2C_STATE_ISR
BIT.B #UCA0RXIFG, &IFG2 ; USCI_A0 Receive Interrupt?
JNZ
USCIA0_RX_ISR
USCIB0_I2C_STATE_ISR
; Decode I2C state changes ...
; Decode I2C state changes ...
...
RETI
USCIA0_RX_ISR
; Read UCA0RXBUF ... − clears UCA0RXIFG
...
RETI
The following software example shows an extract of the interrupt service
routine that handles data transmit interrupts from USCI_A0 in either UART or
SPI mode and the data transfer interrupts from USCI_B0 in I
2
C mode.
USCIA0_TX_USCIB0_I2C_DATA_ISR
BIT.B #UCA0TXIFG, &IFG2 ; USCI_A0 Transmit Interrupt?
JNZ
USCIA0_TX_ISR
USCIB0_I2C_DATA_ISR
BIT.B #UCB0RXIFG, &IFG2
JNZ
USCIB0_I2C_RX
USCIB0_I2C_TX
; Write UCB0TXBUF... − clears UCB0TXIFG
...
RETI
USCIB0_I2C_RX
; Read UCB0RXBUF... − clears UCB0RXIFG
...
RETI
USCIA0_TX_ISR
; Write UCA0TXBUF ... − clears UCA0TXIFG
...
RETI
Содержание MSP430x4xx Family
Страница 1: ...MSP430x4xx Family 2007 Mixed Signal Products User s Guide SLAU056G ...
Страница 2: ......
Страница 6: ...vi ...
Страница 114: ...3 76 RISC 16 Bit CPU ...
Страница 304: ...5 20 FLL Clock Module ...
Страница 340: ...7 8 Supply Voltage Supervisor ...
Страница 348: ...8 8 16 Bit Hardware Multiplier ...
Страница 372: ...9 24 32 Bit Hardware Multiplier ...
Страница 400: ...10 28 DMA Controller ...
Страница 428: ...13 10 Basic Timer1 ...
Страница 466: ...15 24 Timer_A ...
Страница 522: ...17 30 USART Peripheral Interface UART Mode ...
Страница 544: ...18 22 USART Peripheral Interface SPI Mode ...
Страница 672: ...23 12 Comparator_A ...
Страница 692: ...24 20 LCD Controller ...
Страница 746: ...26 28 ADC12 ...