LTC具温度电压和电流测量功能的多节电池电量测量芯片.docx
- 文档编号:8958041
- 上传时间:2023-02-02
- 格式:DOCX
- 页数:29
- 大小:67.27KB
LTC具温度电压和电流测量功能的多节电池电量测量芯片.docx
《LTC具温度电压和电流测量功能的多节电池电量测量芯片.docx》由会员分享,可在线阅读,更多相关《LTC具温度电压和电流测量功能的多节电池电量测量芯片.docx(29页珍藏版)》请在冰豆网上搜索。
LTC具温度电压和电流测量功能的多节电池电量测量芯片
LTC2943-具温度、电压和电流测量功能的多节电池电量测量芯片
特点
可测量累积的电池充电和放电电量
3.6V至20V工作范围可适合多种电池应用
14位ADC负责测量电池电压、电流和温度
1%电压、电流和充电准确度±50mV检测电压范围
高压侧检测
适合任何电池化学组成和容量的通用测量
I2C/SMBus接口
可配置警报输出/充电完成输入
静态电流小于120卩A
小外形8引脚3mmx3mmDFN圭寸装
典型应用
描述
LTC?
2943可测量便携式产品应用中的电池充电状态、电池电压、电池电流及其自身温度。
其具有宽输
入电压范围,因而可与高达20V的多节电池配合使用。
一个精准的库仑计量器负责对流经位于电池正
端子和负载或充电器之间的一个检测电阻器电流进行积分运算。
电池电压、电流和温度利用一个内
部14位无延迟增量累加(NoLatency△史)ADC来测量。
测量结果被存储于可通过内置I2C/SMBus接
口进行存取的内部寄存器中。
LTC2943具有针对所有4种测量物理量的可编程高门限和低门限。
如果超过了某个编程门限,则该器
件将采用SMBus警报协议或通过在内部状态寄存器中设定一个标记来传送警报信号。
LTC2943仅需采
用单个低阻值检测电阻器以设定测量电流范围。
应用
电动工具
电动自行车
便携式医疗设备
视频摄像机
程序:
#include
#include
#include"Linduino.h"
#include"LT_I2C.h"
#include"UserInterface.h"
#include"QuikEval_EEPROM.h"
#include"LTC2943.h"
#include
//FunctionDeclaration
voidprint_title();//Printthetitleblock
voidprint_prompt();//PrintthePrompt
voidstore_alert_settings();//Storethealertsettingsto
theEEPROM
int8_trestore_alert_settings();//Readthealertsettingsfrom
EEPROM
#defineAUTOMATIC_MODE_DISPLAY_DELAY1000//!
delaybetweenreadingsinautomaticmode #defineSCAN_MODE_DISPLAY_DELAY10000//! constfloatresistor=.100;//! < resistorvalueondemoboard //Errorstring constcharack_error[]="Error: NoAcknowledge.CheckI2CAddress.";//! //Globalvariables staticint8_tdemo_board_connected;//! boardisconnected staticuint8_talert_code=0;//! fromALERTregister.Sharedbetweenloop()andrestore_alert_settings() //! InitializeLinduino voidsetup() { chardemo_name[]="DC1812";//! DemoBoardNamestoredinQuikEvalEEPROM quikeval_I2C_init();//! ConfiguretheEEPROMI2Cportfor100kHz quikeval_I2C_connect();//! ConnectstomainI2Cport Serial.begin(115200);//! InitializetheserialporttothePC print_title(); demo_board_connected=discover_demo_board(demo_name);if(demo_board_connected) { print_prompt(); } else { demo_board_connected=true; Serial.println("DidnotreadIDString,attemptingtoproceedanyway...\nPleaseensureI2ClinesofLinduinoareconnectedtotheLTCdevice"); } } //! RepeatsLinduinoloop voidloop(){ int8_tack=0;indicator //! I2Cacknowledge staticuint8_tuser_command;command //! Theuserinput staticuint8_tmAh_or_Coulombs=0; staticuint8_tcelcius_or_kelvin=0; staticuint16_tprescalar_mode=LTC2943_PRESCALAR_M_4096; staticuint16_tprescalarValue=4096; staticuint16_talcc_mode=LTC2943_ALERT_MODE; if(demo_board_connected)thedemoboardisnotconnected //! Donothingif { if(Serial.available())serialisnotavailable //! Donothingif user_command=read_int();command //! Readuserinput if(user_command! ='m') Serial.println(user_command);Serial.println(); ack=0; switch(user_command)appropriatesubmenu //! Printsthe case1: ack|=menu_1_automatic_mode(mAh_or_Coulombs,celcius_or_kelvin,prescalar_mode,prescalarValue,alcc_mode);//! AutomaticMode break; case2: ack|=menu_2_scan_mode(mAh_or_Coulombs,celcius_or_kelvin,prescalar_mode,prescalarValue,alcc_mode);//! ScanMode break; case3: ack|=menu_3_manual_mode(mAh_or_Coulombs,celcius_or_kelvin,prescalar_mode,prescalarValue,alcc_mode);//! ManualMode break; case4: ack|=menu_4_sleep_mode(mAh_or_Coulombs,prescalar_mode,prescalarValue,alcc_mode);//! SleepMode break; case5: ack|=menu_5_shutdown_mode(); //! ShutdownMode break; case6: ack|=menu_6_settings(&mAh_or_Coulombs,&celcius_or_kelvin,&prescalar_mode,&prescalarValue,&alcc_mode);//! SettingsMode break; } if(ack! =0)//! Ifackisnotrecievedprintanerror. Serial.println(ack_error); Serial.print(F("*************************"print_prompt(); } } } //FunctionDefinitions //! Printthetitleblock voidprint_title() { Serial.println(F("\n*****************************************************************")); Serial.print(F("*DC1812ADemonstrationProgram*\n")); Serial.print(F("* *\n")); Serial.print(F("*ThisprogramcommunicateswiththeLTC2943MulticellCoulomb*\n")); Serial.print(F("*CounterfoundontheDC1812Ademoboard.*\n")); Serial.print(F("*Setthebaudrateto115200andselectthenewlineterminator.*\n")); Serial.print(F("* *\n")); Serial.print(F("**************************************************** *************\rH\\・ //! PrintthePrompt voidprint_prompt() { Serial.print(F("\n1-AutomaticMode\n")); Serial.print(F("2-ScanMode\n")); Serial.print(F("3-ManualMode\n")); Serial.print(F("4-SleepMode\n")); Serial.print(F("5-ShutdownMode\n")); Serial.print(F("6-Settings\n")); Serial.print(F("Enteracommand: ")); } //! AutomaticMode. int8_tmenu_1_automatic_mode(int8_tmAh_or_Coulombs,int8_tcelcius_or_kelvin,uint16_tprescalar_mode,uint16_tprescalarValue,uint16_talcc_mode) //! @returnReturnsthestateoftheacknowledgebitaftertheI2Caddresswrite.0=acknowledge,1=noacknowledge. { int8_tLTC2943_mode; int8_tack=0; LTC2943_mode=LTC2943_AUTOMATIC_MODE|prescalar_mode|alcc_mode;//! SetthecontrolregisteroftheLTC2943toautomaticmodeaswellassetprescalarandAL#/CC#pinvalues. Serial.println(); ack|=LTC2943_write(LTC2943_I2C_ADDRESS,LTC2943_CONTROL_REG,LTC2943_mode);//! WritesthesetmodetotheLTC2943controlregister do uint8_tstatus_code,hightemp_code,lowtemp_code; uint16_tcharge_code,current_code,voltage_code,temperature_code; ack|=LTC2943_read_16_bits(LTC2943_I2C_ADDRESS,LTC2943_ACCUM_CHARGE_MSB_REG,&charge_code);//! ReadMSBandLSBAccumulatedChargeRegistersfor16bitchargecode ack|=LTC2943_read_16_bits(LTC2943_I2C_ADDRESS,LTC2943_VOLTAGE_MSB_REG,&voltage_code);//! ReadMSBandLSBVoltageRegistersfor16bitvoltagecode ack|=LTC2943_read_16_bits(LTC2943_I2C_ADDRESS,LTC2943_CURRENT_MSB_REG,¤t_code);//! ReadMSBand LSBCurrentRegistersfor16bitcurrentcode ack|=LTC2943_read_16_bits(LTC2943_I2C_ADDRESS,LTC2943_TEMPERATURE_MSB_REG,&temperature_code);//! ReadMSBandLSBTemperatureRegistersfor16bittemperaturecode ack|=LTC2943_read(LTC2943_I2C_ADDRESS,LTC2943_STATUS_REG,&status_code);//! ReadStatusRegisterfor8bitstatuscode floatcharge,current,voltage,temperature; if(mAh_or_Coulombs) { charge=LTC2943_code_to_coulombs(charge_code,resistor,prescalarValue);//! ConvertchargecodetoCoulombsifCoulombunitsaredesired. Serial.print("Coulombs: "); Serial.print(charge,4); Serial.print(F("C\n")); } else { charge=LTC2943_code_to_mAh(charge_code,resistor,prescalarValue);//! ConvertchargecodetomAhifmAhunitsaredesired. Serial.print("mAh: "); Serial.print(charge,4); Serial.print(F("mAh\n")); } current=LTC2943_code_to_current(current_code,resistor); //! ConvertcurrentcodetoAmperes voltage=LTC2943_code_to_voltage(voltage_code); //! ConvertvoltagecodetoVolts Serial.print(F("Current")); Serial.print(current,4); Serial.print(F("A\n")); Serial.print(F("Voltage")); Serial.print(voltage,4); Serial.print(F("V\n"));if(celcius_or_kelvin){ temperature=LTC2943_code_to_kelvin_temperature(temperature_code);//! Converttemperaturecodetokelvin Serial.print(F("Temperature")); Serial.print(temperature,4); Serial.print(F("K\n")); } else temperature=LTC2943_code_to_celcius_temperature(temperature_code);//! Converttemperaturecodetocelcius Serial.print(F("Temperature")); Serial.print(temperature,4); Serial.print(F("C\n")); } checkAlerts(status_code); //! CheckstatuscodeforAlerts.IfanAlerthasbeenset,printoutappropriatemessageintheSerialPrompt. Serial.print(F("m-MainMenu\n\n")); Serial.flush();delay(AUTOMATIC_MODE_DISPLAY_DELAY); //! Delayfor1sbeforenextpolling } while(Serial.available()==false||(ack)); //! ifSerialisnotavailableandanNACKhasnotbeenrecieved,keeppollingtheregisters. read_int();//clearstheSerial.available return(ack); } //! ScanMode int8_tmenu_2_scan_mode(int8_tmAh_or_Coulombs,int8_tcelcius_or_kelvin,uint16_tprescalar_mode,uint16_tprescalarValue,uint16_talcc_mode) //! @returnReturnsthestateoftheacknowledgebitaftertheI2Caddresswrite.0=acknowledge,1=noacknowledge int8_tLTC2943_mode; int8_tack=0; LTC2943_mode=LTC2943_SCAN_MODE|prescalar_mode|alcc_mode; //! SetthecontrolmodeoftheLTC2943toscanmodeaswellassetprescalarandAL#/CC#pinvalues. Serial.println(); ack|=LTC2943_write(LTC2943_I2C_ADDRESS,LTC2943_CONTROL_REG,LTC2943_mode);//! WritesthesetmodetotheLTC2943 controlregister do uint8_tstatus_code; uint16_tcharge_code,current_code,voltage_code,temperature_code; ack|=LTC2943_read_16_bits(LTC2943_I2C_ADDRESS,LTC2943_ACCUM_CHARGE_MSB_REG,&charge_code);//! ReadMSB andLSBAccumulatedChargeRegistersfor16bitchargecode ack|=LTC2943_read_16_bits(LTC2943_I2C_ADDRESS,LTC2943_VOLTAGE_MSB_REG,&voltage_code);//! ReadMSB andLSBVoltageRegistersfor16bitvoltagecode ack|=LTC2943_read_16_bits(LTC2943_I2C_ADDRESS,LTC2943_CURRENT_MSB_REG,¤t_code);//! ReadMSB andLSBCurrentRegistersfor16bitcurrentcode ack|=LTC2943_read_16_bits(LTC2943_I2C_ADDRESS,LTC2943_TEMPERATURE_MSB_REG,&temperature_code);//! ReadMSBandLSBTemperatureRegistersfor16bittemperaturecode ack|=LTC2943_read(LTC2943_I2C_ADDRESS,LTC2943_STATUS_REG,&status_code);//! ReadStatusRegistersfor8bitstatuscode floatcharge,current,voltage,temperature; if(mAh_or_Coulombs) { charge=LTC2943_code_to_coulombs(charge_code,resistor,prescalarValue);//! Convertchargecode toCoulombsifCoulombunitsaredesired. Serial.print("Coulombs: "); Serial.print(charge,4); Serial.print(F("C\n")); } else { charg
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- LTC 温度 电压 电流 测量 功能 节电 电量 芯片