Here is my code,thank you!
... I2CSendPtr = 1; I2CSendBuffer[1] = address; I2CSendBuffer[0] = data; ... __bis_SR_register(LPM0_bits + GIE); ... //First Entry Interrupt #pragma vector = USCIAB0TX_VECTOR __interrupt void USCIAB0TX_ISR(void) { if (UCB0TXIFG & IFG2) // TX { UCB0TXBUF = I2CSendBuffer[I2CSendPtr]; // Load TX buffer I2CSendPtr--; ////When Entry Interrupt first,the (IFG2 & UCB0TXIFG) have became 0 automatically in this step!I did nothing! if (I2CSendPtr < 0) { while (!(IFG2 & UCB0TXIFG)); // wait for tx complete IE2 &= ~UCB0TXIE; // disable interrupts. IFG2 &= ~UCB0TXIFG; // Clear USCI_B0 TX int flag __bic_SR_register_on_exit(LPM0_bits); // Exit LPM0 } } else if (UCB0RXIFG & IFG2) // RX { I2CRecvBuffer = UCB0RXBUF; // store received data in buffer __bic_SR_register_on_exit(LPM0_bits); // Exit LPM0 } }