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.

Compiler/MSP430F1611: MSP430 SPI

Part Number: MSP430F1611

Tool/software: TI C/C++ Compiler

Hi,

I am using MSPF1611 and I want to communicate it using SPI communication and it working well using the PIN no. P3.1, P3.2, and P3.3, now my problem is how I can use PIN no. 5.1, 5.2 and 5.3 instead of P3.x.

I changed the "  P3SEL = 0x00E;" to "  P5EL = 0x00E;" but it dos't work.

How to do this?????

The complete code is:

#include <msp430.h>
char MST_Data = 0x39;

unsigned int j;
unsigned int i;
int main(void)
{
 

  WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
 // P3DIR =0x001;
  
  P3SEL = 0x00E;                            // Setup P3 for SPI mode
 
  
  
  //P5SEL =0x00E;
  
  
  // U0CTL =         (0x0070u)     /* USART 0 Control */
  // CHAR  =         (0x10)        /* Data 0:7-bits / 1:8-bits */
  // SYNC  =         (0x04)        /* UART / SPI mode */
  // MM    =         (0x02)        /* Master Mode off/on */
  
  U0CTL = CHAR + SYNC + MM + SWRST;         // 8-bit, SPI, Master
  
  
  U0TCTL = CKPH + SSEL1 + STC;              // Polarity, SMCLK, 3-wire
  
  
  // U0BR0  =      (0x0074u)  /* USART 0 Baud Rate 0 */
 // U0BR0 = 0x064;                            // SPICLK = SMCLK/2
  
  // U0BR1  =      (0x0075u)  /* USART 0 Baud Rate 1 */
  U0BR1 = 0x000;
  
 // UMCTL0  =        U0MCTL    /* USART 0 Modulation Control */  reg name
  U0MCTL = 0x000;

  
  
// ME1 =      (0x0004u)  /* Module Enable 1 */
  ME1 = USPIE0;                             // Module enable
  U0CTL &= ~SWRST;                          // SPI enable
  
    IE1 |= URXIE0;                            // Recieve interrupt enable
  __enable_interrupt();                     // Enable interrupts

  //TXBUF0 = 0x00;
  
  i = 50000;                                // Delay
  do (i--);
  while (i != 0);

  {
 
   TXBUF0 = MST_Data;                      // Transmit first character
    LPM0;                                   // CPU off
 
    }
   
    
    
    
} // End Main

#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=USART0RX_VECTOR

__interrupt void SPI0_rx (void)
#elif defined(__GNUC__)

void __attribute__ ((interrupt(USART0RX_VECTOR))) SPI0_rx (void)
#else
#error Compiler not supported!
#endif
{

  
    j = 5000;                                // Delay
  do (j--);
  while (j != 0);
  
TXBUF0 = MST_Data;
  
  /*
     j = 10000;                                // Delay
  do (j--);
  while (j != 0);
  
  TXBUF0 =0x34;
  
     j = 10000;                                // Delay
  do (j--);
  while (j != 0);
  
  TXBUF0 =0x56;
  
  
     j = 10000;                                // Delay
  do (j--);
  while (j != 0);
  
  TXBUF0 =0x78;
  
  
     j = 10000;                                // Delay
  do (j--);
  while (j != 0);
  
  TXBUF0 =0x9A;

  
  */
  
  
  
  //TXBUF0 =0xab;

  
 
 // TXBUF0 =0xbb;
  
  //P3OUT =0x00;
}

**Attention** This is a public forum