EasyManuals Logo

Texas Instruments MSP430 User Manual

Texas Instruments MSP430
413 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #306 background imageLoading...
Page #306 background image
306
}
void I2C_USCI_set_address(unsigned char address)
{
UCB0CTL1 |= UCSWRST;
UCB0I2CSA = address;
UCB0CTL1 &= ~UCSWRST;
}
unsigned char I2C_USCI_read_byte(unsigned char address)
{
while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= (UCTR | UCTXSTT);
while(!(IFG2 & UCB0TXIFG));
UCB0TXBUF = address;
while(!(IFG2 & UCB0TXIFG));
UCB0CTL1 &= ~UCTR;
UCB0CTL1 |= UCTXSTT;
IFG2 &= ~UCB0TXIFG;
while(UCB0CTL1 & UCTXSTT);
UCB0CTL1 |= UCTXSTP;
return UCB0RXBUF;
}
unsigned char I2C_USCI_read_word(unsigned char address,unsigned char *value,
unsigned char length)
{
unsigned char i = 0;
while (UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= (UCTR | UCTXSTT);
while (!(IFG2 & UCB0TXIFG));
IFG2 &= ~UCB0TXIFG;
if(UCB0STAT & UCNACKIFG)
{
return UCB0STAT;
}
UCB0TXBUF = address;
while (!(IFG2 & UCB0TXIFG));
if(UCB0STAT & UCNACKIFG)
{
return UCB0STAT;
}
UCB0CTL1 &= ~UCTR;

Table of Contents

Other manuals for Texas Instruments MSP430

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments MSP430 and is the answer not in the manual?

Texas Instruments MSP430 Specifications

General IconGeneral
BrandTexas Instruments
ModelMSP430
CategoryMicrocontrollers
LanguageEnglish

Related product manuals