收藏 分享(赏)

LTC2943 - 具温度、电压和电流测量功能的多节电池电量测量芯片.doc

上传人:精品资料 文档编号:8849873 上传时间:2019-07-14 格式:DOC 页数:36 大小:147KB
下载 相关 举报
LTC2943 - 具温度、电压和电流测量功能的多节电池电量测量芯片.doc_第1页
第1页 / 共36页
LTC2943 - 具温度、电压和电流测量功能的多节电池电量测量芯片.doc_第2页
第2页 / 共36页
LTC2943 - 具温度、电压和电流测量功能的多节电池电量测量芯片.doc_第3页
第3页 / 共36页
LTC2943 - 具温度、电压和电流测量功能的多节电池电量测量芯片.doc_第4页
第4页 / 共36页
LTC2943 - 具温度、电压和电流测量功能的多节电池电量测量芯片.doc_第5页
第5页 / 共36页
点击查看更多>>
资源描述

1、LTC2943 - 具温度、电压和电流测量功能的多节电池电量测量芯片特点 可测量累积的电池充电和放电电量 3.6V 至 20V 工作范围可适合多种电池应用 14 位 ADC 负责测量电池电压、电流和温度 1% 电压、电流和充电准确度 50mV 检测电压范围 高压侧检测 适合任何电池化学组成和容量的通用测量 I2C / SMBus 接口 可配置警报输出 / 充电完成输入 静态电流小于 120A 小外形 8 引脚 3mm x 3mm DFN 封装典型应用描述LTC2943 可测量便携式产品应用中的电池充电状态、电池电压、电池电流及其自身温度。其具有宽输入电压范围,因而可与高达 20V 的多节电池配

2、合使用。一个精准的库仑计量器负责对流经位于电池正端子和负载或充电器之间的一个检测电阻器电流进行积分运算。电池电压、电流和温度利用一个内部 14位无延迟增量累加 (No Latency TM) ADC 来测量。测量结果被存储于可通过内置 I 2C / SMBus 接口进行存取的内部寄存器中。LTC2943 具有针对所有 4 种测量物理量的可编程高门限和低门限。如果超过了某个编程门限,则该器件将采用 SMBus 警报协议或通过在内部状态寄存器中设定一个标记来传送警报信号。LTC2943 仅需采用单个低阻值检测电阻器以设定测量电流范围。应用 电动工具 电动自行车 便携式医疗设备 视频摄像机程序:#i

3、nclude #include #include “Linduino.h“#include “LT_I2C.h“#include “UserInterface.h“#include “QuikEval_EEPROM.h“#include “LTC2943.h“#include / Function Declarationvoid print_title(); / Print the title blockvoid print_prompt(); / Print the Promptvoid store_alert_settings(); / Store the alert settings t

4、o the EEPROMint8_t restore_alert_settings(); / Read the alert settings from EEPROM#define AUTOMATIC_MODE_DISPLAY_DELAY 1000 /! The delay between readings in automatic mode#define SCAN_MODE_DISPLAY_DELAY 10000 /! The delay between readings in scan modeconst float resistor = .100; /! resistor value on

5、 demo board/ Error stringconst char ack_error = “Error: No Acknowledge. Check I2C Address.“; /! Error 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 ALERT register. Shared between loop() an

6、d restore_alert_settings()/! Initialize Linduinovoid setup()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 t

7、o the PCprint_title();demo_board_connected = discover_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 L

8、induino loopvoid loop()int8_t ack = 0; /! I2C acknowledge indicatorstatic uint8_t user_command; /! The user input commandstatic 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 uint

9、16_t alcc_mode = LTC2943_ALERT_MODE;if (demo_board_connected) /! Do nothing if the demo board is not connectedif (Serial.available() /! Do nothing if serial is not availableuser_command = read_int(); /! Read user input commandif (user_command != m)Serial.println(user_command);Serial.println();ack =

10、0;switch (user_command) /! 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_

11、mode); /! Scan Modebreak;case 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_

12、mode(); /! Shutdown Modebreak;case 6:ack |= menu_6_settings( /! Settings Modebreak;if (ack != 0) /! If ack is not recieved print an error.Serial.println(ack_error);Serial.print(F(“*“);print_prompt();/ Function Definitions/! Print the title blockvoid print_title()Serial.println(F(“n*“);Serial.print(F

13、(“* DC1812A Demonstration Program *n“);Serial.print(F(“* *n“);Serial.print(F(“* This program communicates with the LTC2943 Multicell Coulomb *n“);Serial.print(F(“* Counter found on the DC1812A demo board. *n“);Serial.print(F(“* Set the baud rate to 115200 and select the newline terminator.*n“);Seria

14、l.print(F(“* *n“);Serial.print(F(“*n“);/! Print the Promptvoid print_prompt()Serial.print(F(“n1-Automatic Moden“);Serial.print(F(“2-Scan Moden“);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 c

15、ommand: “);/! Automatic Mode.int8_t menu_1_automatic_mode(int8_t mAh_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 acknowledge.int8_t LTC

16、2943_mode; int8_t ack = 0;LTC2943_mode = LTC2943_AUTOMATIC_MODE|prescalar_mode|alcc_mode ; /! Set the control register of the LTC2943 to automatic mode as well as set prescalar and AL#/CC# pin values. Serial.println(); ack |= LTC2943_write(LTC2943_I2C_ADDRESS, LTC2943_CONTROL_REG, LTC2943_mode); /!

17、Writes the set mode to the LTC2943 control registerdoSerial.print(F(“*nn“);uint8_t status_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, /! Read MSB and LSB Accumulate

18、d Charge Registers for 16 bit charge codeack |= LTC2943_read_16_bits(LTC2943_I2C_ADDRESS, LTC2943_VOLTAGE_MSB_REG, /! Read MSB and LSB Voltage Registers for 16 bit voltage codeack |= LTC2943_read_16_bits(LTC2943_I2C_ADDRESS, LTC2943_CURRENT_MSB_REG, /! Read MSB and LSB Current Registers for 16 bit c

19、urrent codeack |= LTC2943_read_16_bits(LTC2943_I2C_ADDRESS, LTC2943_TEMPERATURE_MSB_REG, /! Read MSB and LSB Temperature Registers for 16 bit temperature codeack |= LTC2943_read(LTC2943_I2C_ADDRESS, LTC2943_STATUS_REG, /! Read Status Register for 8 bit status codefloat charge, current, voltage, temp

20、erature;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“);elsecharge = LTC2943_code_to_mAh(charge_code, resistor, presca

21、larValue); /! 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(voltage_code); /! Convert voltage cod

22、e 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_temperature(temperature_code); /! Convert temperature code to kelvinSerial.print(F(“

23、Temperature “);Serial.print(temperature, 4);Serial.print(F(“ Kn“);elsetemperature = LTC2943_code_to_celcius_temperature(temperature_code); /! Convert temperature code to celciusSerial.print(F(“Temperature “);Serial.print(temperature, 4);Serial.print(F(“ Cn“);checkAlerts(status_code); /! Check status

24、 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(AUTOMATIC_MODE_DISPLAY_DELAY); /! Delay for 1s before next pollingwhile (Serial.available() = false | (ack); /! if Serial is not available and an NACK

25、has not been recieved, keep polling the registers.read_int(); / clears the Serial.availablereturn(ack);/! Scan Modeint8_t menu_2_scan_mode(int8_t mAh_or_Coulombs , int8_t celcius_or_kelvin ,uint16_t prescalar_mode,uint16_t prescalarValue, uint16_t alcc_mode)/! return Returns the state of the acknowl

26、edge bit after the I2C address write. 0=acknowledge, 1=no acknowledgeint8_t LTC2943_mode;int8_t ack = 0;LTC2943_mode = LTC2943_SCAN_MODE|prescalar_mode|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_wri

27、te(LTC2943_I2C_ADDRESS, LTC2943_CONTROL_REG, LTC2943_mode); /! Writes the set mode to the LTC2943 control registerdoSerial.print(F(“*nn“);uint8_t status_code;uint16_t charge_code, current_code, voltage_code, temperature_code;ack |= LTC2943_read_16_bits(LTC2943_I2C_ADDRESS, LTC2943_ACCUM_CHARGE_MSB_R

28、EG, /! Read MSB and LSB Accumulated Charge Registers for 16 bit charge codeack |= LTC2943_read_16_bits(LTC2943_I2C_ADDRESS, LTC2943_VOLTAGE_MSB_REG, /! Read MSB and LSB Voltage Registers for 16 bit voltage codeack |= LTC2943_read_16_bits(LTC2943_I2C_ADDRESS, LTC2943_CURRENT_MSB_REG, /! Read MSB and

29、LSB Current Registers for 16 bit current codeack |= LTC2943_read_16_bits(LTC2943_I2C_ADDRESS, LTC2943_TEMPERATURE_MSB_REG, /! Read MSB and LSB Temperature Registers for 16 bit temperature codeack |= LTC2943_read(LTC2943_I2C_ADDRESS, LTC2943_STATUS_REG, /! Read Status Registers for 8 bit status codef

30、loat 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“);elsecharge = LTC2943_code_t

31、o_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 code to Amperes voltage = LTC2943_code_to_voltage(v

32、oltage_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_temperature(temperature_code); /! Convert temper

33、ature 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 temperature code to Celcius if Celcius units are desired.Serial.print(F(“Temperature

34、“);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.print(F(“m-Main Menunn“);Serial.flush();delay(SCAN_MODE_DISPLAY_DELAY);while (Serial.available() = false

35、 | (ack);read_int(); / clears the Serial.availablereturn(ack);/! Manual Modeint8_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)/! return Returns the state of the acknowledge bit after the I2C address write.

36、 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 values. Serial.println();ack |= LTC2943_write(LTC2943_I2C_ADDRESS, LTC2943_C

37、ONTROL_REG, LTC2943_mode); /! Writes the set mode to the LTC2943 control registerint staleData = 0; /! Stale Data Check variable. When set to 1 it indicates that stale data is being read from the voltage, current and temperature registers.doSerial.print(F(“*nn“);uint8_t status_code;uint16_t charge_c

38、ode, current_code, voltage_code, temperature_code;ack |= LTC2943_read_16_bits(LTC2943_I2C_ADDRESS, LTC2943_ACCUM_CHARGE_MSB_REG, /! Read MSB and LSB Accumulated Charge Registers for 16 bit charge codeack |= LTC2943_read_16_bits(LTC2943_I2C_ADDRESS, LTC2943_VOLTAGE_MSB_REG, /! Read MSB and LSB Voltag

39、e Registers for 16 bit voltage codeack |= LTC2943_read_16_bits(LTC2943_I2C_ADDRESS, LTC2943_CURRENT_MSB_REG, /! Read MSB and LSB Current Registers for 16 bit current codeack |= LTC2943_read_16_bits(LTC2943_I2C_ADDRESS, LTC2943_TEMPERATURE_MSB_REG, /! Read MSB and LSB Temperature Registers for 16 bit

40、 temperature codeack |= LTC2943_read(LTC2943_I2C_ADDRESS, LTC2943_STATUS_REG, /! Read Status Registers for 8 bit status codefloat charge, current, voltage, temperature;if(mAh_or_Coulombs)charge = LTC2943_code_to_coulombs(charge_code, resistor, prescalarValue); /! Convert charge code to Coulombs if C

41、oulomb units are desired.Serial.print(“Coulombs: “);Serial.print(charge, 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“);curr

42、ent = LTC2943_code_to_current(current_code, resistor); /! Convert current 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 S

43、tale data is inside the register after initial snapshot, Print Stale Data message.else Serial.println(“);Serial.print(F(“Voltage “);Serial.print(voltage, 4);Serial.print(F(“ V“);if(staleData) Serial.print(F(“ * Stale Data *n“); /! If Stale data is inside the register after initial snapshot, Print St

44、ale Data message.else Serial.println(“);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 = LTC294

45、3_code_to_celcius_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(“);checkAlerts(status_code); /! Check status code for Alerts. If an Alert

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

当前位置:首页 > 企业管理 > 管理学资料

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报