eUSCI_A Operation – UART Mode
920
SLAU356I – March 2015 – Revised June 2019
Copyright © 2015–2019, Texas Instruments Incorporated
Enhanced Universal Serial Communication Interface (eUSCI) – UART Mode
UCTXIFG is set after a Hard Reset or when UCSWRST = 1. UCTXIE is reset after a Hard Reset or when
UCSWRST = 1.
24.3.15.2 eUSCI_A Receive Interrupt Operation
The UCRXIFG interrupt flag is set each time a character is received and loaded into UCAxRXBUF. An
interrupt request is generated if UCRXIE is set. UCRXIFG and UCRXIE are reset by a Hard Reset signal
or when UCSWRST = 1. UCRXIFG is automatically reset when UCAxRXBUF is read.
Additional interrupt control features include:
•
When UCAxRXEIE = 0, erroneous characters do not set UCRXIFG.
•
When UCDORM = 1, nonaddress characters do not set UCRXIFG in multiprocessor modes. In plain
UART mode, no characters set UCRXIFG.
•
When UCBRKIE = 1, a break condition sets the UCBRK bit and the UCRXIFG flag.
24.3.15.3 eUSCI_A Receive Interrupt Operation
describes the UART state change interrupt flags.
Table 24-6. UART State Change Interrupt Flags
Interrupt Flag
Interrupt Condition
UCSTTIFG
START byte received interrupt. This flag is set when the UART module receives a START byte.
UCTXCPTIFG
Transmit complete interrupt. This flag is set, after the complete UART byte in the internal shift register
including STOP bit got shifted out and UCAxTXBUF is empty.
24.3.15.4 UCAxIV, Interrupt Vector Generator
The eUSCI_A interrupt flags are prioritized and combined to source a single interrupt vector. The interrupt
vector register UCAxIV is used to determine which flag requested an interrupt. The highest-priority
enabled interrupt generates a number in the UCAxIV register that can be evaluated or added to the
program counter to automatically enter the appropriate software routine. Disabled interrupts do not affect
the UCAxIV value.
Read access of the UCAxIV register automatically resets the highest-pending Interrupt condition and flag.
Write access of the UCAxIV register clears all pending Interrupt conditions and flags. If another interrupt
flag is set, another interrupt is generated immediately after servicing the initial interrupt.
shows the recommended use of UCAxIV. The UCAxIV value is added to the PC to
automatically jump to the appropriate routine. The following example is given for eUSCI_A0.
Example 24-1. UCAxIV Software Example
#pragma vector = USCI_A0_VECTOR __interrupt void USCI_A0_ISR(void) {
switch(__even_in_range(UCA0IV,18)) {
case 0x00:
// Vector 0: No interrupts
break;
case 0x02: ...
// Vector 2: UCRXIFG
break;
case 0x04: ...
// Vector 4: UCTXIFG
break;
case 0x06: ...
// Vector 6: UCSTTIFG
break;
case 0x08: ...
// Vector 8: UCTXCPTIFG
break;
default: break;
}
}