Datasheet

www.ti.com
USCI Operation: SPI Mode
16.3.8.2 SPI Receive Interrupt Operation
The UCxRXIFG interrupt flag is set each time a character is received and loaded into UCxRXBUF. An
interrupt request is generated if UCxRXIE and GIE are also set. UCxRXIFG and UCxRXIE are reset by a
system reset PUC signal or when UCSWRST = 1. UCxRXIFG is automatically reset when UCxRXBUF is
read.
16.3.8.3 USCI Interrupt Usage
USCI_Ax and USCI_Bx share the same interrupt vectors. The receive interrupt flags UCAxRXIFG and
UCBxRXIFG are routed to one interrupt vector, the transmit interrupt flags UCAxTXIFG and UCBxTXIFG
share another interrupt vector.
Example 16-1 shows an extract of an interrupt service routine to handle data receive interrupts from
USCI_A0 in either UART or SPI mode and USCI_B0 in SPI mode.
Example 16-1. Shared Receive Interrupt Vectors Software Example
USCIA0_RX_USCIB0_RX_ISR
BIT.B #UCA0RXIFG, &IFG2 ; USCI_A0 Receive Interrupt?
JNZ USCIA0_RX_ISR
USCIB0_RX_ISR?
; Read UCB0RXBUF (clears UCB0RXIFG)
...
RETI
USCIA0_RX_ISR
; Read UCA0RXBUF (clears UCA0RXIFG)
...
RETI
Example 16-2 shows an extract of an interrupt service routine to handle data transmit interrupts from
USCI_A0 in either UART or SPI mode and USCI_B0 in SPI mode.
Example 16-2. Shared Transmit Interrupt Vectors Software Example
USCIA0_TX_USCIB0_TX_ISR
BIT.B #UCA0TXIFG, &IFG2 ; USCI_A0 Transmit Interrupt?
JNZ USCIA0_TX_ISR
USCIB0_TX_ISR
; Write UCB0TXBUF (clears UCB0TXIFG)
...
RETI
USCIA0_TX_ISR
; Write UCA0TXBUF (clears UCA0TXIFG)
...
RETI
443
SLAU144JDecember 2004Revised July 2013 Universal Serial Communication Interface, SPI Mode
Submit Documentation Feedback
Copyright © 2004–2013, Texas Instruments Incorporated