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 #284 background imageLoading...
Page #284 background image
284
USISRL = data_byte;
USICNT = (USICNT & 0xE0) + 8;
// wait until USIIFG is set
i2c_usi_mst_wait_usi_cnt_flag();
// check NACK/ACK
SET_SDA_AS_INPUT();
USICNT = (USICNT & 0xE0) + 1;
// wait for USIIFG is set
i2c_usi_mst_wait_usi_cnt_flag();
if(USISRL & 0x01)
{
// NACK received returns FALSE
return FALSE;
}
return TRUE;
}
// function to read a byte
unsigned char i2c_usi_mst_read_byte(void)
{
SET_SDA_AS_INPUT();
USICNT = (USICNT & 0xE0) + 8;
// wait for USIIFG is set
i2c_usi_mst_wait_usi_cnt_flag();
return USISRL;
}
// function to send (N)ACK bit
void i2c_usi_mst_send_n_ack(unsigned char ack)
{
// send (N)ack bit
SET_SDA_AS_OUTPUT();
if(ack)
{
USISRL = 0x00;
}
else
{
USISRL = 0xFF;
}
USICNT = (USICNT & 0xE0) + 1;
// wait until USIIFG is set
i2c_usi_mst_wait_usi_cnt_flag();
// set SDA as input
SET_SDA_AS_INPUT();
}

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