EmbeddedRelated.com
Forums

USART0- Receiver

Started by msp430 March 10, 2008
Hello,
i am Ravi beginner of MSP430 family controller(MSP430F1611). i am using
one downloaded code from TI website for interrupt based Receiver program.
i am debugging this program can't receive any charector from receiver
buffer. so please clarify anybody this group. herewith i am attached those
code.


#include  <msp430x16x.h>

void main(void)
{
  WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
  P3SEL |= 0x30;													// P3.4,5 = USART0 TXD/RXD
  P3DIR |= 0x10;
  
  ME1 |= UTXE0 + URXE0;                     // Enable USART0 TXD/RXD
  UCTL0 |= CHAR;                            // 8-bit character
  UTCTL0 |= SSEL0;                          // UCLK = ACLK
  UBR00 = 0x03;                             // 32k/9600 - 3.41
  UBR10 = 0x00;                             //
  UMCTL0 = 0x4A;                            // Modulation
  UCTL0 &= ~SWRST;                          // Initialize USART state
machine
  IE1 |= URXIE0;                            // Enable USART0 RX interrupt
 
  _BIS_SR(LPM3_bits + GIE);                 // Enter LPM3 w/ interrupt
}

#pragma vector=UART0RX_VECTOR
__interrupt void usart0_rx (void)
{
  while (!(IFG1 & UTXIFG0));                // USART0 TX buffer ready?
  TXBUF0 = RXBUF0;                          // RXBUF0 to TXBUF0
}




On Mar 10, 8:18 am, "msp430" <sravifo...@gmail.com> wrote:
> Hello, > i am Ravi beginner of MSP430 family controller(MSP430F1611). i am using > one downloaded code from TI website for interrupt based Receiver program. > i am debugging this program can't receive any charector from receiver > buffer. so please clarify anybody this group. herewith i am attached those > code. > > #include <msp430x16x.h> > > void main(void) > { > WDTCTL = WDTPW + WDTHOLD; // Stop WDT > P3SEL |= 0x30; // P3.4,5 = USART0 TXD/RXD > P3DIR |= 0x10; > > ME1 |= UTXE0 + URXE0; // Enable USART0 TXD/RXD > UCTL0 |= CHAR; // 8-bit character > UTCTL0 |= SSEL0; // UCLK = ACLK > UBR00 = 0x03; // 32k/9600 - 3.41 > UBR10 = 0x00; // > UMCTL0 = 0x4A; // Modulation > UCTL0 &= ~SWRST; // Initialize USART state > machine > IE1 |= URXIE0; // Enable USART0 RX interrupt > > _BIS_SR(LPM3_bits + GIE); // Enter LPM3 w/ interrupt > > } > > #pragma vector=UART0RX_VECTOR > __interrupt void usart0_rx (void) > { > while (!(IFG1 & UTXIFG0)); // USART0 TX buffer ready? > TXBUF0 = RXBUF0; // RXBUF0 to TXBUF0 > > }
I suspect that the // 32k/9600 - 3.41 statement is not giving you a good enough frequency. I mean not close enough to 9600baud. Try 1200 if you can. Also I bet TI has an application not that should address this issue. george