EmbeddedRelated.com
Forums

MSP430F169 UART problem

Started by lewis November 14, 2005
Hi
i have a simple pgm for UART Rcv/transmit .I am able to transmit 
data (checked on the oscilloscope). I have short cktd the Tx/Rx pins 
but am not able to recieve any Rx interrupts  . I have pasted the 
code below.

Please advice.
Thanking you.
Lewis

///////////////////////////////////////////////////////
void CfgUART(void)
{
 // P3DIR |= BIT5; //



  P3SEL = BIT4 +BIT5;                         // P3.4,5 = USART0 
  P3DIR &= ~BIT5 ;                      //Rx Pin Inpute direction
  P3DIR |= BIT4 ;                      //Rx Pin Inpute direction
  U0CTL |= CHAR+SWRST;                        // 8-bit character, 
  UTCTL0 |= SSEL1 + SSEL0;                      // UCLK = SMCLK
  UBR00 = 0x53;                         // 9200 baud from smclk0K
  UBR10 = 0x00;                         //
  UMCTL0 = 0x00;                        // No modulation
  ME1 |= (UTXE0 + URXE0);                 // Enabled USART0 TXD/RXD
  U0CTL &= ~SWRST;                      
  IE1 |= UTXIE0 + URXIE0;                        // Enable USART0 RX 
  IFG2 &= ~UTXIFG0;                     // Clear inital flag on POR
  
}

#pragma vector = UART0RX_VECTOR
__interrupt void Usart0_Rx(void)
{
 cDestAddr[0] = RXBUF0;
}
//////////////////////////////////////////////////////////////




Beginning Microcontrollers with the MSP430

Hi Lewis,

have you enabled the GIE bit in the status register? It is fundamental 
to have Rx and Tx interrupts working. And you should clear the UTXIFG0 
flag BEFORE enabling Rx and Tx interrupts, otherwise a Tx interrupt will 
occur as soon as you enable it.

Regards,
Adriano.


lewis wrote:
> Hi
> i have a simple pgm for UART Rcv/transmit .I am able to transmit 
> data (checked on the oscilloscope). I have short cktd the Tx/Rx pins 
> but am not able to recieve any Rx interrupts  . I have pasted the 
> code below.
> 
> Please advice.
> Thanking you.
> Lewis
> 
> ///////////////////////////////////////////////////////
> void CfgUART(void)
> {
>  // P3DIR |= BIT5; //
> 
> 
> 
>   P3SEL = BIT4 +BIT5;                         // P3.4,5 = USART0 
>   P3DIR &= ~BIT5 ;                      //Rx Pin Inpute direction
>   P3DIR |= BIT4 ;                      //Rx Pin Inpute direction
>   U0CTL |= CHAR+SWRST;                        // 8-bit character, 
>   UTCTL0 |= SSEL1 + SSEL0;                      // UCLK = SMCLK
>   UBR00 = 0x53;                         // 9200 baud from smclk0K
>   UBR10 = 0x00;                         //
>   UMCTL0 = 0x00;                        // No modulation
>   ME1 |= (UTXE0 + URXE0);                 // Enabled USART0 TXD/RXD
>   U0CTL &= ~SWRST;                      
>   IE1 |= UTXIE0 + URXIE0;                        // Enable USART0 RX 
>   IFG2 &= ~UTXIFG0;                     // Clear inital flag on POR
>   
> }
> 
> #pragma vector = UART0RX_VECTOR
> __interrupt void Usart0_Rx(void)
> {
>  cDestAddr[0] = RXBUF0;
> }
> //////////////////////////////////////////////////////////////
> 
> 
> 
> 
> 
> 
> .
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
>