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.

msp430f5418 + launchpad + labview

Other Parts Discussed in Thread: MSP430F5418, MAX232, MSP430G2553, CC2530

Hi, i'm student, now i'm developed an application based on a msp430f5418. This microcontroller is integrated into a device which receives and sends data via radiofrecuency.

This device must communicate with a PC with a LabVIEW application. How I can make that communication? I have a launchpad MSP-EXP430G2  that has an UART interface.

Facts are there examples of this? or maybe, there are some webs which explain how to do this?

Thanks, waiting response

 

  • The 5438 has four USCI modules. That means it can do up to four simultaneous UART transmissions to four different peers. One of them most likely is the RF module.
    ou'll need to set up sort of an access point that has RF on one side and RS232 on the other side. Then you can connect the RS232 side to the PC If there is no serial port, use a cheap USB/RS232 cable. LabView can then open the (real or USB-virtual) COM port and read and write data from/to the MSP.

    Some USB/serial adapters include an USB chip that outputs TTL-level UART signals, followed by a MAX232 or similar level shifter. If so, you can cut-upp the level shifter and directly connect the USB chip the the MSP. Else you'll need to add a level shifter to the MSP, to get RS232 compliant output signals.

    The LaunchPad is not the best idea. Its serial backchannel port is limited to 9600Bd. Also, you still have to connect the 5438 somehow to the LaunchPad chip.

    You could connect the 5438 directly to the LaunchPads RX/TX (and GND!) pins and abuse the programming interface for the UART/USB connection (without an MSP430G2xx on the LaunchPad socket). That's possible, but you then are still limited to 9600Bd.

  •            Hi, finally, I decided to use the launchpad to transmit data to the labview application. I've got a basic connection. the msp430f5418 microcontroller sends or receives a single character(actually, is an modified exaple of msp430x54x: msp430x54x_uscia0_duplex_9600.c).

             But ... I need to transmit and receive a data stack. I need to know how to do that.

            My question is how to develop the program, not the initial register configuration.

            Thank you for any help.

           I paste my codes.

    _____________________________________________________________________________________________________________________________________

    BASIC TX/RX CODE: send a data, recive a data.

    #include "msp430x54x.h"

    char DATA;                                 //Date recived an sent

    void main(void)
    {
      WDTCTL = WDTPW+WDTHOLD;                   // Stop watchdog timer
      P7SEL |= 0x03;                            // Port select XT1

      do
      {
        UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + DCOFFG);
                                                // Clear XT2,XT1,DCO fault flags
        SFRIFG1 &= ~OFIFG;                      // Clear fault flags
        __delay_cycles(100000);                 // Delay for Osc to stabilize
      }while (SFRIFG1&OFIFG);                   // Test oscillator fault flag

      P3SEL |= BIT4+BIT5;                       // P3.4,5 UART option select

      UCA0CTL1 |= UCSWRST;                      // **Put state machine in reset**
      UCA0CTL1 |= UCSSEL_1;                     // CLK = ACLK
      UCA0BR0 = 0x03;                           // 32k/9600 - 3.41
      UCA0BR1 = 0x00;                           //
      UCA0MCTL = 0x06;                          // Modulation
      UCA0CTL1 &= ~UCSWRST;                     // **Initialize USCI state machine**
      UCA0IE |= UCTXIE + UCRXIE;                // Enable USCI_A0 TX/RX interrupt

      __bis_SR_register(LPM3_bits + GIE);       // Enter LPM3 w/ interrupts enabled
      __no_operation();                         // For debugger
    }


    #pragma vector=USCI_A0_VECTOR
    __interrupt void USCI_A0_ISR(void)
    {
      unsigned char tx_char;

        switch(__even_in_range(UCA0IV,4))
      {
        case 0: break;                          // Vector 0 - no interrupt
        case 2:                                 // Vector 2 - RXIFG
         DATA = UCA0RXBUF;                    // RXBUF1 to TXBUF1
          break;
        case 4:                                 // Vector 4 - TXIFG
          __delay_cycles(5000);                 // Add small gap between TX'ed bytes
          UCA0TXBUF = DATA;                  // Transmit character
          break;
        default: break;
      }
    }

     

    _______________________________________________________________________________________________________________________________________

    Tx/Rx Stack data CODE:

     //                 MSP430F5418              
    //              _________________           
    //             |                                 XIN|-    
    //             |                                       | 32KHz
    //             |                            XOUT|-            
    //             |           UCA0TXD/P3.4|------->
    //             |                                       |        9600bd   Launchpad TI-->PC(LabVIEW application)
    //             |           UCA0RXD/P3.5|<-------
    //             |_________________|
    //           
    #include "msp430x54x.h"

    /*========================================================================
                         Global Variables//Constant   
    =========================================================================*/
    #define maximum_vector_tx_size 4       // transmission stack size
    #define maximum_vector_rx_size 4       // reception stack size


    char vector_tx[maximum_vector_tx_size];              //transmission stack
    int index_tx;                          //stack pointer transmission

    char vector_rx[maximum_vector_rx_size];              //reception stack
    int index_rx;                          //stack pointer reception

    char transmit_data=1;
    int ON=1;
    int OFF=0;
    /*========================================================================
                         Main program   
    =========================================================================*/
    void main(void)
    {
      WDTCTL = WDTPW+WDTHOLD;                   // wdt

      P1DIR |= 0x00;                            //P1.1 input 

      P7SEL |= 0x03;                            //  configure XT1
      do                                      
      {
        UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + DCOFFG);                             
        SFRIFG1 &= ~OFIFG;                     
        __delay_cycles(100000);                
      }while (SFRIFG1&OFIFG);                  
                                              
      P3SEL |= BIT4+BIT5;                    //configure P3.4,5 UART.9600bd,1 bit stop, non parity
      UCA0CTL1 |= UCSWRST;                   
      UCA0CTL1 |= UCSSEL_1;                 
      UCA0BR0 = 0x03;                          
      UCA0BR1 = 0x00;                          
      UCA0MCTL = 0x06;                         
      UCA0CTL1 &= ~UCSWRST;                    
      UCA0IE |=  UCRXIE+UCTXIE;                

      __bis_SR_register(LPM3_bits + GIE);

     
      while(1){
       
        if(vector_rx[0]=transmit_data){
          index_tx=0;
          vector_rx[0]=OFF;
        }   
      }
     
    }


    /*=====================================================================
                              USCI_A0 interrupt vector
    =======================================================================*/

    #pragma vector=USCI_A0_VECTOR               //USCI_A0 interrupt
    __interrupt void USCI_A0_ISR(void)
    {
        
        switch(__even_in_range(UCA0IV,4))
        {
        case 0: break;                         // Vector 0 - no interrupt
       
        case 2:                                // Vector 2 - RXIFG
         if(index_rx==3){
            vector_rx[0]=UCA0RXBUF;
            index_rx=0;
            break;
          }
         
         else if(index_rx==2){
            vector_rx[2]=UCA0RXBUF;
            index_rx++;
            break;
          }
         
         else if(index_rx==1){
            vector_rx[1]=UCA0RXBUF;
            index_rx++;
            break;
          }
         
          else if(index_rx==0){
            vector_rx[0]=UCA0RXBUF;
            index_rx++;
            break;
          }
          break;
       
        case 4:                                 // Vector 4 - TXIFG
          __delay_cycles(5000);
          if(index_tx<maximum_vector_tx_size){
            UCA0TXBUF = vector_tx[index_tx];
            index_tx++;        
          }
          break;
       
        default: break;
      }
    }

     

     

     

    Thanks

     

  • hello guys !! i need send data (frecuency) from MSP430G2553 LP (End device) to TIVA C (coordinator) with CC2530 Boosterpack module ... how to do this, I need code example cos' I can't do it. so complicated for me.  

    help please !! 


    thanks. 

**Attention** This is a public forum