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 #285 background imageLoading...
Page #285 background image
285
// function to send I2C address with R/W bit
unsigned char i2c_usi_mst_send_address(unsigned char addr, unsigned char r_w)
{
addr <<= 1;
if(r_w)
{
addr |= 0x01;
}
return(i2c_usi_mst_send_byte(addr));
}
// USI I2C ISR function
#pragma vector=USI_VECTOR
__interrupt void USI_ISR (void)
{
if(USICTL1 & USISTTIFG)
{
// do something if necessary
// clear flag
USICTL1 &= ~USISTTIFG;
}
if(USICTL1 & USIIFG)
{
// USI counter interrupt flag
usi_cnt_flag = TRUE;
// clear flag
USICTL1 &= ~USIIFG;
}
//__bic_SR_register_on_exit(LPM0_bits);
}
PCF8574.h
#include "I2C.h"
#define PCF8574_address 0x20
unsigned char PCF8574_read(void);
void PCF8574_write(unsigned char data_byte);
PCF8574.c
#include "PCF8574.h"
unsigned char PCF8574_read(void)
{
unsigned char port_byte = 0x00;
i2c_usi_mst_gen_start();
i2c_usi_mst_send_address(PCF8574_address, rd);

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