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.

msp430g2553内部SPI驱动TLV5618问题

Other Parts Discussed in Thread: MSP430G2553, TLV5616

关于SPI 的问题,我用msp430g2553进行端口模拟可以驱动TLV5618,但用内部SPI 驱动时就出问题了,内部SPI一次最多可以传输8bit,要发送16bit数据,怎么实现?下面的写法有什么问题吗?

P1OUT |= CS;        

P1OUT &= ~CS;        

IFG2 &= ~UCA0TXIFG;           

UCA0TXBUF = data >>8;                    //high 8 bits               

 while (!(IFG2 & UCA0TXIFG));        

UCA0TXBUF = data & 0xff;                //low 8 bits        

while (!(IFG2 & UCA0RXIFG));           //等待接收完毕,表明16位数据都移入了TLV5616          

 while(UCA0STAT&UCBUSY);        

 P1OUT |= CS;