EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

MSP430F1611 SPI.

Started by AmyLe September 10, 2007
Hi everyone,

I'm trying to interface an external ADC with the MSP430F1611's SPI.

I've written the code to initialize the SPI (seen below), but I now
want to test my Init_SPI by writing some data to it and probing it
using the scope to see that I've written data to it.

Eventually, I want to get data from an external ADC using SPI and
store it in memory.

Can anyone point me in the right direction?

Thank you so much! Much appreciated.

- Amy


====================INIT_SPI=========================

void Init_SPI(void)
{
  P3SEL |= 0x3F;		      // Select P3.0,1,2,3,4,5
  P3DIR |= 0x0B;                    // Select P3.1,3 as output
directions
  P3OUT &= ~0x01;
  ME1 |= USPIE0;                    // ENABLE USART0 SPI
  UCTL0 |= CHAR + SYNC + MM;        //  8-bit data, SPI mode
  UTCTL0 |=  CKPH + CKPL + SSEL1;  //  Inv.delay, ACLK
  UBR00 = 0x2A;                     // Baud Rate = 115200
  UBR10 = 0x0;
  UMCTL0 = 0x0;                     // Clear Modulation
  UCTL0 &= ~SWRST;                  // Initialize USART state machine

  //_BIS_SR(LPM3_bits + GIE);         // Enter LPM0 w/interrupt

} //end Init_SPI

===============================================


The 2024 Embedded Online Conference