This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Msp430 Launchpad UART

Other Parts Discussed in Thread: MSP430G2553

According to the official workshop, the Serial Communication session(Lab 7), the all functions that related to UART transmission are shown below. There are anything but the configuration codes of USCI or USART registers.Aren't the USART and USCI components necessary in UART transimission?

// Function Transmits Character from TXByte
void Transmit()
{
  BitCnt = 0xA;                     		// Load Bit counter, 8data + ST/SP
  while (CCR0 != TAR)               		// Prevent async capture
    CCR0 = TAR;                     		// Current state of TA counter
  CCR0 += Bitime;                   		// Some time till first bit
  TXByte |= 0x100;                  		// Add mark stop bit to TXByte
  TXByte = TXByte << 1;             		// Add space start bit
  CCTL0 =  CCIS0 + OUTMOD0 + CCIE;  		// TXD = mark = idle
  while ( CCTL0 & CCIE );           		// Wait for TX completion
}

// Timer A0 interrupt service routine
#pragma vector=TIMER0_A0_VECTOR
__interrupt void Timer_A (void)
{
  CCR0 += Bitime;                   		// Add Offset to CCR0
  if (CCTL0 & CCIS0)                		// TX on CCI0B?
  {
    if ( BitCnt == 0)
    {
      CCTL0 &= ~ CCIE ;             		// All bits TXed, disable interrupt
    }

    else
    {
      CCTL0 |=  OUTMOD2;            // TX Space
      if (TXByte & 0x01)
      CCTL0 &= ~ OUTMOD2;           // TX Mark
      TXByte = TXByte >> 1;
      BitCnt --;
    }
  }
}

  • That routine is to emulate a uart with the use of TimerA0.
    I don't see the bitime value being set, but I'm guessing 2400 baud.

    It uses OUTMOD2 to set active state and OUTMOD0 for rest state.
    So you can only use a CCR0 Pin for use as a TX-pin in this example.

    So it's a hybrid mode, where the CCR0 is both setting a pin in hardware and also causing software interrupt,
    so you can shift next bit and test it's value for altering next pin state.

     

  • Tony’s explanation is right.

    It should be added, that the LaunchPad originally came with MSP that do not have an USCI and therefore no hardware UART capability.
    The first LaunchPad processor (the MSP430G2553) was introduced quite some time after the LaunchPad.
    Today, AFAIK all LaunchPads are shipped with a G2553. But the tutorial was already there for the older ones. And still works.

**Attention** This is a public forum