


版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、LTC2943 -具温度、电压与电流测量功能的多节电池电量测量芯片特点可测量累积的电池充电与放电电量3、6V至20V工作范围可适合多种电池应用14位ADC负责测量电池电压、电流与温度1%电压、电流与充电准确度 =t50mV检测电压范围高压侧检测适合任何电池化学组成与容量的通用测量I2C / SMBus 接口可配置警报输出/充电完成输入静态电流小于120卩A小外形8引脚3mm x 3mm DFN圭寸装典型应用3.3VCHARGERDD卩P2kLTC2943 SENSE+ ALCCSDASENSE-SCLGNDTMULTICEl I三 LI-ION1A LOADTotal Charge Error
2、 vsDifferential Sense VoltageOJ110100sense (mV)294a TAO It描述LTC?2943可测量便携式产品应用中的电池充电状态、电池电压、电池电流及其自身温度。其具有宽输入电压范围,因而可与高达20V的多节电池配合使用。一个精准的库仑计量器负责对流经位于电池正端子与负载或充电器之间的一个检测电阻器电流进行积分运算。电池电压、电流与温度利用一个内部 14位无延迟增量累加 (No Latency 男)ADC来测量。测量结果被存储于 可通过内置I2C / SMBus接口进行存取的内部寄存器中。LTC2943具有针对所有4种测量物理量的可编程高门限与低门限
3、。如果超过了某个编程门限,则该器件将采用SMBus警报协议或通过在内部状态寄存器中设定一个标记来传送警报信号。LTC2943仅需采用单个低阻值检测电阻器以设定测量电流范围。应用电动工具电动自行车便携式医疗设备视频摄像机程序:#inelude vArduino 、h>#inelude vstdint 、h>#inelude "Linduino 、h"#inelude "LT_I2C 、h"#include "UserInterface 、h"#include "QuikEval_EEPROM、h"#inc
4、lude "LTC2943、h"#include <Wire 、 h>/ Function Declarationvoid print_title(); / Print the title blockvoid print_prompt(); / Print the Promptvoid store_alert_settings();/ Store the alert settings to the EEPROMint8_t restore_alert_settings(); / Read the alert settings from EEPROM/!<
5、The delay/!< The delay between#define AUTOMATIC_MODE_DISPLAY_DELAY 1000 between readings in automatic mode#define SCAN_MODE_DISPLAY_DELAY 10000 readings in scan modeconst float resistor = 、 100;/!< resistor value on demo board/ Error stringCheck I2C Address 、 " /!< Errorconst char ack_
6、error = "Error: No Acknowledge message/ Global variablesstatic int8_t demo_board_connected;/!< Set to 1 if the board is connectedstatic uint8_t alert_code = 0;/!< Value stored or read from ALERTregister 、 Shared between loop() and restore_alert_settings()/! Initialize Linduinovoid setup()
7、char demo_name = "DC1812" /! Demo Board Name stored in QuikEval EEPROMquikeval_I2C_init();/! Configure the EEPROM I2C port for 100kHzquikeval_I2C_connect();/! Connects to main I2C portSerial 、 begin(115200);/! Initialize the serial port to the PCprint_title();demo_board_connected = discove
8、r_demo_board(demo_name); if (demo_board_connected)print_prompt();elsedemo_board_connected = true;Serial、 println("Did not read ID String, attempting to proceed anyway nPlease ensure I2C lines of Linduino are connected to the LTC device");/! Repeats Linduino loopvoid loop()int8_t ack = 0;/!
9、 I2C acknowledge indicatorstatic uint8_t user_command; /! The user input command static uint8_t mAh_or_Coulombs = 0;static uint8_t celcius_or_kelvin = 0;static uint16_t prescalar_mode = LTC2943_PRESCALAR_M_4096;static uint16_t prescalarValue = 4096;static uint16_t alcc_mode = LTC2943_ALERT_MODE;/! D
10、o nothing if the demo board is not/! Do nothing if serial is not available/! Read user input commandif (demo_board_connected) connectedif (Serial 、 available()user_command = read_int(); if (user_command != 'm')Serial 、 println(user_command);Serial 、 println();ack = 0;switch (user_command) /!
11、 Prints the appropriate submenucase 1:ack |= menu_1_automatic_mode(mAh_or_Coulombs, celcius_or_kelvin, prescalar_mode, prescalarValue, alcc_mode); /! Automatic Modebreak;case 2:ack |= menu_2_scan_mode(mAh_or_Coulombs, celcius_or_kelvin, prescalar_mode, prescalarValue, alcc_mode); /! Scan Modebreak;c
12、ase 3:ack |= menu_3_manual_mode(mAh_or_Coulombs, celcius_or_kelvin, prescalar_mode, prescalarValue, alcc_mode); /! Manual Modebreak;case 4:ack |= menu_4_sleep_mode(mAh_or_Coulombs, prescalar_mode, prescalarValue, alcc_mode);/! Sleep Modebreak;case 5:ack |= menu_5_shutdown_mode();/! Shutdown Modebrea
13、k;case 6:ack |= menu_6_settings(&mAh_or_Coulombs, &celcius_or_kelvin, &prescalar_mode, &prescalarValue, &alcc_mode); /! Settings Modebreak;/! If ack is not recieved printif (ack != 0) an error 、Serial 、 println(ack_error);Serial 、print(F(Il*");println(F("n*");print
14、_prompt();/ Function Definitions /! Print the title block void print_title()Serial 、*n");*n");Serial 、 print(F("* DC1812A Demonstration ProgramSerial 、print(F("*Serial 、 print(F("* This program communicates with the LTC2943 Multicell Coulomb *n");Serial 、 print(F("
15、* Counter found on the DC1812A demo board、*n");Serial 、 print(F("* Set the baud rate to 115200 and select the newline terminator *n");Serial 、print(F("*n");/! Print the Prompt void print_prompt()Serial 、 print(F("n1-Automatic Moden");Serial 、 print(F("2-Scan M
16、oden");Serial 、 print(F("3-Manual Moden");Serial 、 print(F("4-Sleep Moden");Serial 、 print(F("5-Shutdown Moden");Serial 、 print(F("6-Settingsn");Serial 、 print(F("Enter a command: "); /! Automatic Mode int8_t menu_1_automatic_mode(int8_t mAh_or_
17、Coulombs, int8_t celcius_or_kelvin ,uint16_t prescalar_mode, uint16_t prescalarValue, uint16_t alcc_mode) /! return Returns the state of the acknowledge bit after the I2C address write 0=acknowledge, 1=no acknowledge 、int8_t LTC2943_mode;int8_t ack = 0;LTC2943_mode = LTC2943_AUTOMATIC_MODE|prescalar
18、_mode|alcc_mode ; /! Set the control register of the LTC2943 to automatic mode as well as set prescalar and AL#/CC# pin values 、ack |= LTC2943_write(LTC2943_I2C_ADDRESS, LTC2943_CONTROL_REG, LTC2943_mode); /! Writes the set mode to the LTC2943 control registerdo Serial 、print(F(H*nn");uint8_t s
19、tatus_code, hightemp_code, lowtemp_code; uint16_t charge_code, current_code, voltage_code, temperature_code;ack |= LTC2943_read_16_bits(LTC2943_I2C_ADDRESS,LTC2943_ACCUM_CHARGE_MSB_REG, &charge_code); /! Read MSB and LSB Accumulated Charge Registers for 16 bit charge codeack |= LTC2943_read_16_b
20、its(LTC2943_I2C_ADDRESS,LTC2943_VOLTAGE_MSB_REG, &voltage_code); /! Read MSB and LSB Voltage Registers for 16 bit voltage codeack |= LTC2943_read_16_bits(LTC2943_I2C_ADDRESS,LTC2943_CURRENT_MSB_REG, ¤t_code); /! Read MSB and LSB Current Registers for 16 bit current codeack |= LTC2943_r
21、ead_16_bits(LTC2943_I2C_ADDRESS,LTC2943_TEMPERATURE_MSB_REG, &temperature_code); /! Read MSB and LSB Temperature Registers for 16 bit temperature codeack |= LTC2943_read(LTC2943_I2C_ADDRESS, LTC2943_STATUS_REG, &status_code);/! Read Status Register for 8 bit status codefloat charge, current,
22、 voltage, temperature;if(mAh_or_Coulombs)charge = LTC2943_code_to_coulombs(charge_code, resistor, prescalarValue); /! Convert charge code to Coulombs if Coulomb units are desired 、Serial 、 print("Coulombs: ");Serial 、print(F(" Cn");else/!charge = LTC2943_code_to_mAh(charge_code,
23、resistor, prescalarValue);Convert charge code to mAh if mAh units are desired、Serial 、 print("mAh: ");Serial 、 print(charge, 4);Serial 、print(F(" mAhn");current = LTC2943_code_to_current(current_code, resistor);/!Convert current code to Amperesvoltage = LTC2943_code_to_voltage(vo
24、ltage_code); /! Convert voltage code to VoltsSerial 、 print(F("Current ");Serial 、 print(current, 4);Serial 、print(F(" An");Serial 、print(F("Voltage ");Serial 、 print(voltage, 4);Serial 、print(F(" Vn");if(celcius_or_kelvin) temperature = LTC2943_code_to_kelvin
25、_temperature(temperature_code);/! Convert temperature code to kelvinSerial 、 print(F("Temperature ");Serial 、 print(temperature, 4);Serial 、print(F(" Kn");elsetemperature = LTC2943_code_to_celcius_temperature(temperature_code);/! Convert temperature code to celciusSerial 、 print(
26、F("Temperature ");Serial 、 print(temperature, 4);Serial 、print(F(" Cn");checkAlerts(status_code); /! Check status code for Alerts 、 If an Alert has been set, print out appropriate message in the Serial Prompt 、Serial 、 print(F("m-Main Menunn");Serial 、 flush();delay(AUT
27、OMATIC_MODE_DISPLAY_DELAY); /! Delay for 1s before next pollingwhile (Serial 、 available() = false | (ack); /! if Serial isnot available and an NACK has not been recieved, keep polling the registers、read_int(); / clears the Serial 、 availablereturn(ack);/! Scan Mode int8_t menu_2_scan_mode(int8_t mA
28、h_or_Coulombs , int8_t celcius_or_kelvin ,uint16_t prescalar_mode,uint16_t prescalarValue, uint16_t alcc_mode) /! return Returns the state of the acknowledge bit after the I2C address write 0=acknowledge, 1=no acknowledgeint8_t LTC2943_mode;int8_t ack = 0;LTC2943_mode = LTC2943_SCAN_MODE|prescalar_m
29、ode|alcc_mode ;/! Set the control mode of the LTC2943 to scan mode as well as set prescalar and AL#/CC# pin values 、Serial 、 println();ack |= LTC2943_write(LTC2943_I2C_ADDRESS, LTC2943_CONTROL_REG, LTC2943_mode);/! Writes the set mode to the LTC2943 control registerdoSerial 、print(F(H*nn");uint
30、8_t status_code;uint16_t charge_code, current_code, voltage_code, temperature_code;/! Read MSB and LSBack |= LTC2943_read_16_bits(LTC2943_I2C_ADDRESS, LTC2943_ACCUM_CHARGE_MSB_REG, &charge_code); Accumulated Charge Registers for 16 bit charge codeack |= LTC2943_read_16_bits(LTC2943_I2C_ADDRESS,
31、LTC2943_VOLTAGE_MSB_REG, &voltage_code);/! Read MSB and LSBVoltage Registers for 16 bit voltage codeack |= LTC2943_read_16_bits(LTC2943_I2C_ADDRESS, LTC2943_CURRENT_MSB_REG, ¤t_code);/! Read MSB and LSBCurrent Registers for 16 bit current codeack |= LTC2943_read_16_bits(LTC2943_I2C_ADD
32、RESS, LTC2943_TEMPERATURE_MSB_REG, &temperature_code); /! Read MSB and LSB Temperature Registers for 16 bit temperature codeack |= LTC2943_read(LTC2943_I2C_ADDRESS, LTC2943_STATUS_REG, &status_code); /! Read Status Registers for 8 bit status codefloat charge, current, voltage, temperature;if
33、(mAh_or_Coulombs)charge = LTC2943_code_to_coulombs(charge_code, resistor, prescalarValue);/! Convert charge code to Coulombs if Coulomb units are desired、Serial 、 print("Coulombs: ");Serial 、 print(charge, 4);Serial 、print(F(" Cn");elsecharge = LTC2943_code_to_mAh(charge_code, re
34、sistor, prescalarValue);/! Convert charge code to mAh if mAh units are desired、Serial 、 print("mAh: ");Serial 、 print(charge, 4);Serial 、print(F(" mAhn");current = LTC2943_code_to_current(current_code, resistor); /! Convert current code to Amperesvoltage = LTC2943_code_to_voltage
35、(voltage_code);/! Convert voltage code to VoltsSerial 、 print(F("Current ");Serial 、 print(current, 4);Serial 、print(F(" An");Serial 、print(F("Voltage ");Serial 、 print(voltage, 4);Serial 、print(F(" Vn");if(celcius_or_kelvin)temperature = LTC2943_code_to_kelvi
36、n_temperature(temperature_code); /! Convert temperature code to Kelvin if Kelvin units are desired、Serial 、 print(F("Temperature ");Serial 、 print(temperature, 4);Serial 、print(F(" Kn");elsetemperature = LTC2943_code_to_celcius_temperature(temperature_code); /! Convert temperatur
37、e code to Celcius if Celcius units are desired、Serial 、 print(F("Temperature ");Serial 、 print(temperature, 4);Serial 、print(F(" Cn");checkAlerts(status_code); /! Check status code for Alerts 、 If an Alert has been set, print out appropriate message in the Serial PromptSerial 、 f
38、lush();delay(SCAN_MODE_DISPLAY_DELAY);while (Serial 、 available() = false | (ack);read_int(); / clears the Serial、 availablereturn(ack);/! Manual Mode int8_t menu_3_manual_mode(int8_t mAh_or_Coulombs ,int8_t celcius_or_kelvin ,uint16_t prescalar_mode, uint16_t prescalarValue, uint16_t alcc_mode) /!
39、return Returns the state of the acknowledge bit after the I2C address write 0=acknowledge, 1=no acknowledgeint8_t LTC2943_mode;int8_t ack = 0;LTC2943_mode = LTC2943_MANUAL_MODE|prescalar_mode|alcc_mode ;/! Set the control mode of the LTC2943 to manual mode as well as set prescalar and AL#/CC# pin va
40、lues 、Serial 、 println();ack |= LTC2943_write(LTC2943_I2C_ADDRESS, LTC2943_CONTROL_REG, LTC2943_mode);/! Writes the set mode to the LTC2943 controlregisterint staleData = 0;/! StaleData Check variable 、 When set to 1 it indicates that stale data is being read from the voltage, current and temperatur
41、e registers、do Serial 、print(F(H*nn");uint8_t status_code;uint16_t charge_code, current_code, voltage_code, temperature_code;/! Read MSB and LSBack |= LTC2943_read_16_bits(LTC2943_I2C_ADDRESS, LTC2943_ACCUM_CHARGE_MSB_REG, &charge_code); Accumulated Charge Registers for 16 bit charge codeac
42、k |= LTC2943_read_16_bits(LTC2943_I2C_ADDRESS,LTC2943_VOLTAGE_MSB_REG, &voltage_code); /! Read MSB and LSB Voltage Registers for 16 bit voltage codeack |= LTC2943_read_16_bits(LTC2943_I2C_ADDRESS, LTC2943_CURRENT_MSB_REG, ¤t_code);/! Read MSB and LSBCurrent Registers for 16 bit current
43、 code/! Read MSB and LSBack |= LTC2943_read_16_bits(LTC2943_I2C_ADDRESS, LTC2943_TEMPERATURE_MSB_REG, &temperature_code); Temperature Registers for 16 bit temperature codeack |= LTC2943_read(LTC2943_I2C_ADDRESS, LTC2943_STATUS_REG, &status_code); /! Read Status Registers for 8 bit status cod
44、efloat charge, current, voltage, temperature;if(mAh_or_Coulombs)charge = LTC2943_code_to_coulombs(charge_code, resistor, prescalarValue); /! Convert charge code to Coulombs if Coulomb units are desired、Serial 、 print("Coulombs: ");Serial 、 print(charge, 4);Serial 、print(F(" Cn");
45、elsecharge = LTC2943_code_to_mAh(charge_code, resistor, prescalarValue); /! Convert charge code to mAh if mAh units are desired、Serial 、 print("mAh: ");Serial 、 print(charge, 4);Serial 、print(F(" mAhn");current = LTC2943_code_to_current(current_code, resistor); /! Convert current
46、 code to Amperesvoltage = LTC2943_code_to_voltage(voltage_code);/! Convert voltage code to VoltsSerial 、 print(F("Current ");Serial 、 print(current, 4);Serial 、print(F(" A");if(staleData) Serial 、 print(F(" * Stale Data *n");/! If Stale data is inside the register after
47、 initial snapshot, Print Stale Data message 、else Serial 、 println("");Serial 、print(F("Voltage ");Serial 、 print(voltage, 4);Serial 、print(F(" V");/! If Stale data is inside the register after initial snapshot, Print Stale Data message 、else Serial 、 println("&quo
48、t;);if(celcius_or_kelvin)temperature = LTC2943_code_to_kelvin_temperature(temperature_code);/! Convert temperature code to Kelvin if Kelvin units are desired、Serial 、 print(F("Temperature ");Serial 、 print(temperature, 4);Serial 、print(F(" K");elsetemperature = LTC2943_code_to_ce
49、lcius_temperature(temperature_code);/! Convert temperature code to Celcius if Celcius units are desired、Serial 、 print(F("Temperature ");Serial 、 print(temperature, 4);Serial 、print(F(" C");if(staleData) Serial 、 print(F(" * Stale Data *n");else Serial 、 println("&
50、quot;);checkAlerts(status_code);/! Check status code for Alerts 、 If an Alert has been set, print out appropriate message in the Serial PromptstaleData = 1;Serial 、 flush();delay(AUTOMATIC_MODE_DISPLAY_DELAY); while (Serial 、 available() = false | (ack);read_int(); / clears the Serial、 availableretu
51、rn(ack);/! Sleep Modeint8_t menu_4_sleep_mode(int8_t mAh_or_Coulombs ,uint16_t prescalar_mode, uint16_t prescalarValue, uint16_t alcc_mode)/! return Returns the state of the acknowledge bit after the I2C address write 0=acknowledge, 1=no acknowledgeint8_t LTC2943_mode;int8_t ack = 0;LTC2943_mode = L
52、TC2943_SLEEP_MODE|prescalar_mode|alcc_mode ;/! Set the control mode of the LTC2943 to sleep mode as well as set prescalar and AL#/CC# pin values 、Serial 、 println();ack |= LTC2943_write(LTC2943_I2C_ADDRESS, LTC2943_CONTROL_REG, LTC2943_mode);/! Writes the set mode to the LTC2943 control registerdoSe
53、rial 、print(F(H*nn");delay(100);uint8_t status_code;uint16_t charge_code;ack |= LTC2943_read_16_bits(LTC2943_I2C_ADDRESS, LTC2943_ACCUM_CHARGE_MSB_REG, &charge_code); /! Read MSB and LSB Accumulated Charge Registers for 16 bit charge codeack |= LTC2943_read(LTC2943_I2C_ADDRESS, LTC2943_STAT
54、US_REG, &status_code);/! Read Status Registers for 8 bit status codefloat charge;if(mAh_or_Coulombs)charge = LTC2943_code_to_coulombs(charge_code, resistor, prescalarValue); /! Convert charge code to Coulombs if Coulomb units are desired、Serial 、 print("Coulombs: ");Serial 、 print(char
55、ge, 4);Serial 、print(F(" Cn");elsecharge = LTC2943_code_to_mAh(charge_code, resistor, prescalarValue); /! Convert charge code to mAh if mAh units are desired 、Serial 、 print("mAh: ");Serial 、 print(charge, 4);Serial 、print(F(" mAhn");Serial 、 print(F("Current "
56、;);Serial 、print(F(" ADC Sleep 、 n");Serial 、print(F("Voltage ");Serial 、print(F(" ADC Sleep 、 n");Serial 、 print(F("Temperature ");Serial 、print(F(" ADC Sleep 、 n");Serial 、 print(F("m-Main Menunn");checkAlerts(status_code);Serial 、 flush(
57、); delay(AUTOMATIC_MODE_DISPLAY_DELAY);while (Serial 、 available() = false | (ack);read_int(); / clears the Serial、 availablereturn(ack);/! Shutdown Modeint8_t menu_5_shutdown_mode()/! return Returns the state of the acknowledge bit after the I2C address write 0=acknowledge, 1=no acknowledgeint8_t ack = 0;ack |= LTC2943_write(LTC2943_I2C_ADDRESS, LTC2943_CONTROL_REG, LTC2943_SHUTDOWN_MODE);/! Se
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 老年健康管理2025年长期照护服务模式下的护理服务质量评估与改进实践
- 新一代智能办公系统软件操作指南与使用手册
- 2025年母婴产品市场消费升级与品牌竞争新动态研究报告
- BOM物料表的用途
- 玻璃纤维过滤材料项目可行性研究报告
- 中级银行从业资格之中级银行业法律法规与综合能力能力提升打印大全及答案详解(历年真题)
- 2025年食品行业食品安全追溯体系在食品添加剂行业中的应用与发展
- 重难点自考专业(学前教育)真题【B卷】附答案
- 工业污染场地修复技术选择与2025年成本效益评估模型构建报告
- 环保公司检测仪器安全规章
- 2025年建筑工程-安全员C证-安全员(C证·上海)历年参考题库典型考点含答案解析
- 光伏项目施工组织设计方案
- 2025至2030医学混合成像系统行业产业运行态势及投资规划深度研究报告
- 2025年内蒙古交通集团考试笔试试题(含答案)
- 低压安全隐患排查
- 学堂在线 高技术与现代局部战争 章节测试答案
- 水费收缴使用管理办法
- 广东省汕头市金平区2023-2024学年七年级下学期期末数学试题(无答案)
- 中央供料系统介绍
- 输液泵/微量注射泵使用技术操作考核评分标准
- PWM控制技术的最新科技成果-介绍ISL6752
评论
0/150
提交评论