hi
i just wanted to know if the below program was right to perform SPI communication between MSP430fg4618 and AD7823ADC (no offence for not using a TI adc...had this in hand)
#include "msp430fg4618.h"
void main(void)
{
char data;
WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer
P3SEL |= 0x0A; // P3.3 for CLK and P3.1 for DATA
P3DIR |= 0x01; // P3.0 output FOR /CS
UCB0CTL0 |= UCMST+UCSYNC+UCMSB; // MASTER, SYNCHRONOUS, MSB FIRST
UCB0CTL1 |= UCSSEL_1; // AMCLK
UCB0BR0 = 0x02;
UCB0BR1 = 0;
UCB0CTL1 &= ~UCSWRST;
while(1)
{
P3OUT &= ~0x01; // Enable AD7823, /CS reset
UCB0TXBUF = 0x00; // write Dummy BYTE to start SPI
while (!(IFG2 & UCB0RXIFG)); // RXBUF ready?
data = UCB0RXBUF;
P3OUT |= 0x01; // Disable AD7823, /CS set
}
}