• 大小: 6KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-14
  • 语言: 其他
  • 标签: BQ76940  

资源简介

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


评论

共有 条评论

相关资源