Other Parts Discussed in Thread: MSP430F5418A
Hi there,
I'm using MSP430F5418A UART to communicate with PC. The problem I encountered is the program couldn't enter RX ISR, so I couldn't receive data transfered from
PC. Before using UART, I configured relevant registers and enabled RX interrupt. Then I run the program, but I couldn't get any data. Please help me.
The following is part of my program:
UCA1CTL1 |= UCSWRST; // **Put state machine in reset**
UCA1CTL1 |= UCSSEL_1; // CLK = ACLK
UCA1BR0 = 0x03; // 32kHz/9600=3.41 (see User's Guide)
UCA1BR1 = 0x00;
UCA1MCTL = UCBRS_3+UCBRF_0; // Modulation UCBRSx=3, UCBRFx=0
UCA1CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
UCA1IE |= UCRXIE; // Enable USCI_A1 RX interrupt
__bis_SR_register(GIE); // interrupts enabled
__no_operation();
UART ISR:
#pragma vector=USCI_A1_VECTOR
__interrupt void USCI_A1_ISR(void)
{
int i;
switch(__even_in_range(UCA1IV,4))
{
case 0:break; // Vector 0 - no interrupt
case 2: // Vector 2 - RXIFG
for(i=10;i>=0;i--)
{
rx_buffer[i] = UCA1RXBUF;
decode();
}
break;
case 4: // Vector 4 - TXIFG
for(i=0;i<=10;i++)
{
UCA1TXBUF = tx_buffer[i];
}
break;
default: break;
}
}
Is there something wrong with my configuration?
Thank you
Best regards
Nick