資源簡介
TI BQ76940的驅動代碼 76930 76920 都能用,芯片本身定位廉價方案 實際使用采集誤差會比凌特的差點 但是價格在那 硬件上采樣電容1uf 比較合理

代碼片段和文件信息
/*
?*?main.c
?*
?*?This?module?demonstrates?operation?of?CRC?with?the?bq769x0?family
?*?AFE?devices?using?a?MSP430G2553?
?*
?*?Copyright?(C)?2015?Texas?Instruments?Incorporated?-?http://www.ti.com/?
?*?
?*?
?*??Redistribution?and?use?in?source?and?binary?forms?with?or?without?
?*??modification?are?permitted?provided?that?the?following?conditions?
?*??are?met:
?*
?*????Redistributions?of?source?code?must?retain?the?above?copyright?
?*????notice?this?list?of?conditions?and?the?following?disclaimer.
?*
?*????Redistributions?in?binary?form?must?reproduce?the?above?copyright
?*????notice?this?list?of?conditions?and?the?following?disclaimer?in?the?
?*????documentation?and/or?other?materials?provided?with?the???
?*????distribution.
?*
?*????Neither?the?name?of?Texas?Instruments?Incorporated?nor?the?names?of
?*????its?contributors?may?be?used?to?endorse?or?promote?products?derived
?*????from?this?software?without?specific?prior?written?permission.
?*
?*??THIS?SOFTWARE?IS?PROVIDED?BY?THE?COPYRIGHT?HOLDERS?AND?CONTRIBUTORS?
?*??“AS?IS“?AND?ANY?EXPRESS?OR?IMPLIED?WARRANTIES?INCLUDING?BUT?NOT?
?*??LIMITED?TO?THE?IMPLIED?WARRANTIES?OF?MERCHANTABILITY?AND?FITNESS?FOR
?*??A?PARTICULAR?PURPOSE?ARE?DISCLAIMED.?IN?NO?EVENT?SHALL?THE?COPYRIGHT?
?*??OWNER?OR?CONTRIBUTORS?BE?LIABLE?FOR?ANY?DIRECT?INDIRECT?INCIDENTAL?
?*??SPECIAL?EXEMPLARY?OR?CONSEQUENTIAL?DAMAGES?(INCLUDING?BUT?NOT?
?*??LIMITED?TO?PROCUREMENT?OF?SUBSTITUTE?GOODS?OR?SERVICES;?LOSS?OF?USE
?*??DATA?OR?PROFITS;?OR?BUSINESS?INTERRUPTION)?HOWEVER?CAUSED?AND?ON?ANY
?*??THEORY?OF?LIABILITY?WHETHER?IN?CONTRACT?STRICT?LIABILITY?OR?TORT?
?*??(INCLUDING?NEGLIGENCE?OR?OTHERWISE)?ARISING?IN?ANY?WAY?OUT?OF?THE?USE?
?*??OF?THIS?SOFTWARE?EVEN?IF?ADVISED?OF?THE?POSSIBILITY?OF?SUCH?DAMAGE.
?*
*/
#include?
#include?
#include?
#include?
#include?“main.h“
#include?“bq76940.h“
#define?IIC_TIME_OUT 10
RegisterGroup?Registers;
const?unsigned?int?OVPThreshold?=?4300;
const?unsigned?int?UVPThreshold?=?2500;
const?unsigned?char?SCDDelay?=?SCD_DELAY_100us;
const?unsigned?char?SCDThresh?=?SCD_THRESH_89mV_44mV;
const?unsigned?char?OCDDelay?=?OCD_DELAY_320ms;
const?unsigned?char?OCDThresh?=?OCD_THRESH_22mV_11mV;
const?unsigned?char?OVDelay?=?OV_DELAY_2s;
const?unsigned?char?UVDelay?=?UV_DELAY_8s;
unsigned?int?CellVoltage[15];
float?batt_current?=?0.0f;
float?ts_temp[3];
float?batt_volt?=?0.0f;
float?Gain?=?0;
int?iGain?=?0;
#if?1
extern?I2C_HandleTypeDef?hi2c2;
HAL_StatusTypeDef?I2CWriteRegisterByte(unsigned?char?I2CSlaveAddress?unsigned?char?Register?unsigned?char?Data)
{
unsigned?char?DataBuffer[2];
unsigned?int?SentByte?=?0;
DataBuffer[0]?=?Register;
DataBuffer[1]?=?Data;
return(HAL_I2C_Master_Transmit(&hi2c2I2CSlaveAddress?DataBuffer?2?IIC_TIME_OUT));
}
HAL_StatusTypeDef?I2CWriteRegisterByteWithCRC(unsigned?char?I2CSlaveAddress?unsigned?char?Register?unsigned?char?D
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????13922??2019-04-24?21:50??bq76940.c
?????文件???????9966??2019-04-24?19:41??bq76940.h
-----------?---------??----------?-----??----
????????????????23888????????????????????2
- 上一篇:stm32 spi方式讀寫EEPROM
- 下一篇:真正能搜星的Wince6.0模擬器
評論
共有 條評論