UCTXIFG is automatically
reset if a character is written to UCxTXBUF.
就是说向发送寄存器送字节后,UCXIFG会自动清零.
为什么我第一次写入后,没有自动清零呢?还是1.
用的LAUNCHPAD仿真看到的...
UCA0CTLW0 |= UCSWRST; // **Put state machine in reset**
UCA0CTLW0 |= UCMST+UCSYNC+UCCKPL+UCMSB+UCSSEL_3; // 3-pin, 8-bit SPI master Clock polarity high, MSB , SMCLK=DCO
UCA0BR0 = 0x02; // /2 baud
UCA0BR1 = 0; //
UCA0MCTLW = 0; // No modulation
UCA0STATW|=UCLISTEN; //Receive the transmitted;
UCA0CTLW0 &= ~UCSWRST; // **Initialize USCI state machine**
//UCA0IE |= UCTXIE; // Enable USCI_A0 TX interrupt We will use no interruption.
P1SEL1 |= BIT5;
P2SEL1 |= BIT0 + BIT1;
void spiw(unsigned char word)
{
while((UCA0IFG&UCTXIFG)==0);
UCA0TXBUF=word;
};
执行到这,写入第一个...但UCTIFG没有自动请0..