char readMode_specialFunction(int deviceAddress, int registerAddress)
{
char data;
UCB0I2CSA = (deviceAddress >> 1);
UCB0CTL1 |= UCTR + UCTXSTT;
while((IFG2 & UCB0TXIFG) != UCB0TXIFG);
UCB0TXBUF = registerAddress;
while((IFG2 & UCB0TXIFG) != UCB0TXIFG);
UCB0CTL1 &= ~UCTR;
UCB0CTL1 |= UCTXSTT;
while((IFG2 & UCB0TXIFG) != UCB0TXIFG);
data = UCB0RXBUF;
UCB0CTL1 |= UCTXSTP;
return data;
}
使用IAR編譯程式 |