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 #296 background imageLoading...
Page #296 background image
296
{
return UCB0STAT;
}
UCB0TXBUF = value;
while(!(IFG2 & UCB0TXIFG));
if(UCB0STAT & UCNACKIFG)
{
return UCB0STAT;
}
UCB0CTL1 |= UCTXSTP;
IFG2 &= ~UCB0TXIFG;
return 0;
}
BH1750.h
#include <msp430.h>
#include "delay.h"
#include "HW_I2C.h"
#define BH1750_addr 0x23
#define power_down 0x00
#define power_up 0x01
#define reset 0x07
#define cont_H_res_mode1 0x10
#define cont_H_res_mode2 0x11
#define cont_L_res_mode 0x13
#define one_time_H_res_mode1 0x20
#define one_time_H_res_mode2 0x21
#define one_time_L_res_mode 0x23
void BH1750_init(void);
void BH1750_write(unsigned char cmd);
unsigned int BH1750_read_word(void);
unsigned int get_lux_value(unsigned char mode, unsigned int delay_time);
BH1750.c
#include "BH1750.h"
void BH1750_init(void)
{
I2C_USCI_init(BH1750_addr);
delay_ms(10);
BH1750_write(power_down);
}
void BH1750_write(unsigned char cmd)

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