最新LTC2943具温度电压和电流测量功能的多节电池电量测量芯片Word下载.docx

上传人:b****1 文档编号:758310 上传时间:2023-04-29 格式:DOCX 页数:38 大小:84.09KB
下载 相关 举报
最新LTC2943具温度电压和电流测量功能的多节电池电量测量芯片Word下载.docx_第1页
第1页 / 共38页
最新LTC2943具温度电压和电流测量功能的多节电池电量测量芯片Word下载.docx_第2页
第2页 / 共38页
最新LTC2943具温度电压和电流测量功能的多节电池电量测量芯片Word下载.docx_第3页
第3页 / 共38页
最新LTC2943具温度电压和电流测量功能的多节电池电量测量芯片Word下载.docx_第4页
第4页 / 共38页
最新LTC2943具温度电压和电流测量功能的多节电池电量测量芯片Word下载.docx_第5页
第5页 / 共38页
最新LTC2943具温度电压和电流测量功能的多节电池电量测量芯片Word下载.docx_第6页
第6页 / 共38页
最新LTC2943具温度电压和电流测量功能的多节电池电量测量芯片Word下载.docx_第7页
第7页 / 共38页
最新LTC2943具温度电压和电流测量功能的多节电池电量测量芯片Word下载.docx_第8页
第8页 / 共38页
最新LTC2943具温度电压和电流测量功能的多节电池电量测量芯片Word下载.docx_第9页
第9页 / 共38页
最新LTC2943具温度电压和电流测量功能的多节电池电量测量芯片Word下载.docx_第10页
第10页 / 共38页
最新LTC2943具温度电压和电流测量功能的多节电池电量测量芯片Word下载.docx_第11页
第11页 / 共38页
最新LTC2943具温度电压和电流测量功能的多节电池电量测量芯片Word下载.docx_第12页
第12页 / 共38页
最新LTC2943具温度电压和电流测量功能的多节电池电量测量芯片Word下载.docx_第13页
第13页 / 共38页
最新LTC2943具温度电压和电流测量功能的多节电池电量测量芯片Word下载.docx_第14页
第14页 / 共38页
最新LTC2943具温度电压和电流测量功能的多节电池电量测量芯片Word下载.docx_第15页
第15页 / 共38页
最新LTC2943具温度电压和电流测量功能的多节电池电量测量芯片Word下载.docx_第16页
第16页 / 共38页
最新LTC2943具温度电压和电流测量功能的多节电池电量测量芯片Word下载.docx_第17页
第17页 / 共38页
最新LTC2943具温度电压和电流测量功能的多节电池电量测量芯片Word下载.docx_第18页
第18页 / 共38页
最新LTC2943具温度电压和电流测量功能的多节电池电量测量芯片Word下载.docx_第19页
第19页 / 共38页
最新LTC2943具温度电压和电流测量功能的多节电池电量测量芯片Word下载.docx_第20页
第20页 / 共38页
亲,该文档总共38页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

最新LTC2943具温度电压和电流测量功能的多节电池电量测量芯片Word下载.docx

《最新LTC2943具温度电压和电流测量功能的多节电池电量测量芯片Word下载.docx》由会员分享,可在线阅读,更多相关《最新LTC2943具温度电压和电流测量功能的多节电池电量测量芯片Word下载.docx(38页珍藏版)》请在冰点文库上搜索。

最新LTC2943具温度电压和电流测量功能的多节电池电量测量芯片Word下载.docx

一个精准的库仑计量器负责对流经位于电池正端子和负载或充电器之间的一个检测电阻器电流进行积分运算。

电池电压、电流和温度利用一个内部 

14位无延迟增量累加 

(NoLatencyΔΣTM)ADC 

来测量。

测量结果被存储于可通过内置 

I2C/SMBus 

接口进行存取的内部存放器中。

LTC2943 

具有针对所有 

种测量物理量的可编程高门限和低门限。

如果超过了某个编程门限,那么该器件将采用 

SMBus 

警报协议或通过在内部状态存放器中设定一个标记来传送警报信号。

仅需采用单个低阻值检测电阻器以设定测量电流范围。

应用

∙电开工具

//FunctionDeclaration

voidprint_title();

//Printthetitleblock

voidprint_prompt();

//PrintthePrompt

voidstore_alert_settings();

//StorethealertsettingstotheEEPROM

int8_trestore_alert_settings();

//ReadthealertsettingsfromEEPROM

 

#defineAUTOMATIC_MODE_DISPLAY_DELAY1000//!

<

Thedelaybetweenreadingsinautomaticmode

#defineSCAN_MODE_DISPLAY_DELAY10000//!

Thedelaybetweenreadingsinscanmode

constfloatresistor=.100;

//!

resistorvalueondemoboard

//Errorstring

constcharack_error[]="

Error:

NoAcknowledge.CheckI2CAddress."

;

Errormessage

//Globalvariables

staticint8_tdemo_board_connected;

Setto1iftheboardisconnected

staticuint8_talert_code=0;

ValuestoredorreadfromALERTregister.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;

I2Cacknowledgeindicator

staticuint8_tuser_command;

Theuserinputcommand

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)//!

Donothingifthedemoboardisnotconnected

if(Serial.available())//!

Donothingifserialisnotavailable

user_command=read_int();

Readuserinputcommand

if(user_command!

='

m'

Serial.println(user_command);

Serial.println();

ack=0;

switch(user_command)//!

Printstheappropriatesubmenu

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

case3:

ack|=menu_3_manual_mode(mAh_or_Coulombs,celcius_or_kelvin,prescalar_mode,prescalarValue,alcc_mode);

ManualMode

case4:

ack|=menu_4_sleep_mode(mAh_or_Coulombs,prescalar_mode,prescalarValue,alcc_mode);

SleepMode

case5:

ack|=menu_5_shutdown_mode();

ShutdownMode

case6:

ack|=menu_6_settings(&

mAh_or_Coulombs,&

celcius_or_kelvin,&

prescalar_mode,&

prescalarValue,&

alcc_mode);

SettingsMode

if(ack!

=0)//!

Ifackisnotrecievedprintanerror.

Serial.println(ack_error);

Serial.print(F("

*************************"

));

//FunctionDefinitions

Printthetitleblock

voidprint_title()

Serial.println(F("

\n*****************************************************************"

*DC1812ADemonstrationProgram*\n"

**\n"

*ThisprogramcommunicateswiththeLTC2943MulticellCoulomb*\n"

*CounterfoundontheDC1812Ademoboard.*\n"

*Setthebaudrateto115200andselectthenewlineterminator.*\n"

*****************************************************************\n"

PrintthePrompt

voidprint_prompt()

\n1-AutomaticMode\n"

2-ScanMode\n"

3-ManualMode\n"

4-SleepMode\n"

5-ShutdownMode\n"

6-Settings\n"

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;

LTC2943_mode=LTC2943_AUTOMATIC_MODE|prescalar_mode|alcc_mode;

SetthecontrolregisteroftheLTC2943toautomaticmodeaswellassetprescalarandAL#/CC#pinvalues.

ack|=LTC2943_write(LTC2943_I2C_ADDRESS,LTC2943_CONTROL_REG,LTC2943_mode);

WritesthesetmodetotheLTC2943controlregister

do

*************************\n\n"

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,&

current_code);

ReadMSBandLSBCurrentRegistersfor16bitcurrentcode

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);

C\n"

charge=LTC2943_code_to_mAh(charge_code,resistor,prescalarValue);

ConvertchargecodetomAhifmAhunitsaredesired.

mAh:

mAh\n"

current=LTC2943_code_to_current(current_code,resistor);

ConvertcurrentcodetoAmperes

voltage=LTC2943_code_to_voltage(voltage_code);

ConvertvoltagecodetoVolts

Current"

Serial.print(current,4);

A\n"

Voltage"

Serial.print(voltage,4);

V\n"

if(celcius_or_kelvin){

temperature=LTC2943_code_to_kelvin_temperature(temperature_code);

Converttemperaturecodetokelvin

Temperature"

Serial.print(temperature,4);

K\n"

temperature=LTC2943_code_to_celcius_temperature(temperature_code);

Converttemperaturecodetocelcius

checkAlerts(status_code);

CheckstatuscodeforAlerts.IfanAlerthasbeenset,printoutappropriatemessageintheSerialPrompt.

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);

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

LTC2943_mode=LTC2943_SCAN_MODE|prescalar_mode|alcc_mode;

SetthecontrolmodeoftheLTC2943toscanmodeaswellassetprescalarandAL#/CC#pinvalues.

uint8_tstatus_code;

ReadStatusRegistersfor8bitstatuscode

Convertchargecod

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 经管营销 > 经济市场

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2