LTC具溫度電壓和電流測量功能的多節(jié)電池電量測量芯片_第1頁
LTC具溫度電壓和電流測量功能的多節(jié)電池電量測量芯片_第2頁
LTC具溫度電壓和電流測量功能的多節(jié)電池電量測量芯片_第3頁
LTC具溫度電壓和電流測量功能的多節(jié)電池電量測量芯片_第4頁
LTC具溫度電壓和電流測量功能的多節(jié)電池電量測量芯片_第5頁
已閱讀5頁,還剩39頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、LTC2943 -具溫度、電壓和電流測量功能的多節(jié)電池電量測量芯片特點可測量累積的電池充電和放電電量3.6V至20V工作范圍可適合多種電池應(yīng)用14位ADC負責(zé)測量電池電壓、電流和溫度1%電壓、電流和充電準確度±50mV檢測電壓范圍高壓側(cè)檢測適合任何電池化學(xué)組成和容量的通用測量FC/SMBus接口可配置警報輸出/充電完成輸入靜態(tài)電流小于120 n A小外形8引腳3mm x 3mm DFN圭寸裝典型應(yīng)用 描述LTC?2943?可測量便攜式產(chǎn)品應(yīng)用中的電池充電狀態(tài)、電池電壓、電池電流及其自身溫度。其具有寬輸入電壓范圍,因而可與高達 ? 20V?的多節(jié)電池配合使用。一個精準的庫侖計量器負責(zé)對

2、流經(jīng)位于電池正端子和負載或充電器之間的一個檢測電阻器電流進行積分運算。電池電壓、電流和溫度利用一個內(nèi)部?14位無?|2C/SMBus?接口進行存延遲增量累加?(N。Latency 男)ADC?來測量。測量結(jié)果被存儲于可通過內(nèi)置 取的內(nèi)部寄存器中。LTC2943?具有針對所有? 4?種測量物理量的可編程高門限和低門限。如果超過了某個編程門限,則該器件 將采用?SMBus?警報協(xié)議或通過在內(nèi)部狀態(tài)寄存器中設(shè)定一個標記來傳送;報信號。LTC2943?僅需采用單個低阻值檢測電阻器以設(shè)定測量電流范圍。應(yīng)用電動工具電動自行車便攜式醫(yī)療設(shè)備視頻攝像機程序:include <Arduino.h>i

3、nclude <stdint.h>include "Linduino.h"include TT_l2C.hninclude "Userinterface.hninclude HQuikEval_EEPROM.hninclude ”LTC2943.h”include <Wire.h>/ Function Declarationvoid print_title();/ Print the title blockvoid print_prompt(); / Print the Promptvoid store_alert_settings();

4、/ Store the alert settings to theEEPROMint8_t restore_alert_settings(); / Read the alert settings from EEPROM#define AUTOMATIC_MODE_DISPLAY_DELAY 1000/!< Thedelay between readings in automatic mode#define SCAN_MODE_DISPLAY_DELAY 10000 /!< The delay between readings in scan modeconst float resi

5、stor = .100;/!<resistor value on demo board/ Error stringconst char ack_error = "Error: No Acknowledge. Check I2C Address.n; /!< 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

6、 readfrom ALERT register. Shared between loop() and restore_alert_settings()/! Initialize Linduino void setup() (char demo_name = "DC1812n; /! Demo Board Name stored in QuikEval EEPROMquikeval_l2C_init(); /! Configure the EEPROM I2C port for 100kHzquikeval_l2C_connect(); /! Connects to main I2C

7、 portSerial.begin(115200); /! Initialize the serial port to the PCprint_title();demo_board_connected = discover_demo_board(demo_name);if (demo_board_connected)(print_prompt();)else(demo_board_connected = true;Serial.println("Did not read ID String, attempting to proceed anyway.AnPlease ensure I

8、2C lines of Linduino are connected to the LTC device");)/! Repeats Linduino loopvoid loop()int8_t ack = 0; indicator/! I2C acknowledgestatic uint8_t user_command;command/! The user inputstatic uint8_t mAh_or_Coulombs = 0;static uint8_t celcius_or_kelvin = 0;static uint16_t prescalar_mode = LTC2

9、943_PRESCALAR_M_4096;static uint16_t prescalarValue = 4096;static uint16_t alcc_mode = LTC2943_ALERT_MODE;if (demo_board_connected) demo /! Do nothing if the board is not connected(if (Serial.available() serial is not /i Do nothing if available(/! Read user inputuser_command = readj nt(); commandif

10、(user_command !=,m')Serial.println(user_command);Serial.println();ack = 0;/! Prints theswitch (user_command) appropriate submenu(case 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_mo

11、de(mAh_or_Coulombs, celcius_or_kelvin, prescalar_mode, prescalarValue, alcc_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, p

12、rescalarValue, alcc_mode); /! Sleep Modebreak;case 5:ack |= menu_5_shutdown_mode();/! Shutdown Modebreak;case 6:ack |= menu_6_settings(&mAh_or_Coulombs, &celcius_or_kelvin, &prescalar_mode, &prescalarValue, &alcc_mode); /! Settings Modebreak;)if (ack != 0)/! If ack is not recieve

13、d print an error.Serial.println(ack_error);Serial print(F(H *")print_prompt();/ Function Definitions /! Print the title block void print_title()Serial.println(F(Hn *Serial.print(F(H* DC1812A Demonstration Program*n”);Serial.print(F(H*n”);Serial.print(F(H* This program communicates with the LTC2

14、943 Multicell Coulomb*n”);Serial.print(F(H* Counter found on the DC1812A demo board. *n");Serial.print(F(H* Set the baud rate to 115200 and select the newline terminator.*nn);Serial.print(F(H*n");SeriaLprint(F(n * nH ./! Print the Prompt void print_prompt() (Serial.print(F("n1 -Automa

15、tic Modenn);Serial.print(F("2-Scan Modenn);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(HEnter a command:");/! Automatic M8_t menu_1_automatic_

16、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. O=acknowledge, 1=no acknowledge.(int8_t LTC2943_mode;int8_t ack = 0;LTC2943_mode = LTC2943_AUTOM

17、ATIC_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_l2C_ADDRESS, LTC2943_CONTROL_REG, LTC2943_mode); /! Writes the set mode to the LTC2943 control registerdo*Se

18、rial.print(F(Hnn");uint8_t status_code, hightemp_code, lowtemp_code;uint16_t charge_code, current_code, voltage_code, temperature_code;ack |= LTC2943_read_16_bits(LTC2943_l2C_ADDRESS, LTC2943_ACCUM_CHARGE_MSB_REG, &charge_code);/! Read MSB and LSB Accumulated Charge Registers for 16 bit cha

19、rge codeack|=LTC2943_read_16_bits(LTC2943_l2C_ADDRESS,LT C2943_V O LT AG E_M S B_R E G, &voltage_code);/! Read MSB and LSBVoltage Registers for 16 bit voltage codeack |= LTC2943_read_16_bits(LTC2943_l2C_ADDRESS, LTC2943_CURRENT_MSB_REG, &current_code); /! Read MSB and LSB CurrentRegisters fo

20、r 16 bit current codeack |= LTC2943_read_16_bits(LTC2943_l2C_ADDRESS, LTC2943_TEMPERATURE_I/ISB_REG, &temperature_code); /! Read MSB and LSB Temperature Registers for 16 bit temperature codeack |= LTC2943_read(LTC2943_l2C_ADDRESS, LTC2943_STATUS_REG, &status_code);/! Read Status Register for

21、 8bit 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 Coulomb units are desired.Serial.print(,Coulombs:");Serial.print(charge, 4);Serial.print(F(" CnH)

22、;)else(charge = LTC2943_code_to_mAh(charge_code, resistor, prescalarValue); /! Convert charge code to mAh if mAh units are desired.Serial.print(HmAh: ”);Serial.print(charge, 4);Serial.print(F(" mAh'n”);)current = LTC2943_code_to_current(current_code, resistor);/! Convert current code to Amp

23、eresvoltage = LT C2943_code_to_voltage(voltage_code);/! Convert voltage code to VoltsSeriaLprint(F(HCurrent ");Serial.print(current, 4);Serial.print(F(H An");Serial.print(F("Voltage ");Serial.print(voltage, 4);Serial.print(F(" Vn");if(celcius_or_kelvin)temperature =LTC2

24、943_code_to_kelvin_temperature(temperature_code); /! Convert temperature code to kelvinSerial.print(F("Temperature ");Serial.print(temperature, 4);Serial.print(F(" Kn");)else(temperature =LTC2943_code_to_celcius_temperature(temperature_code); /! Convert temperature code to celciu

25、sSerial.print(F(HTemperature ");Serial.print(temperature, 4);Serial.print(F(n CnM);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("iTi-Main MenunnM);Serial.flush();delay(AUTOMATIC_MODE_DI

26、SPLAY_DELAY);/! Delay for 1s before next pollingwhile (Serial.available() = false | (ack);/! if Serial is not 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 mAh_or_Coulombs , int

27、8_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. O=acknowledge, 1=no acknowledgeint8_t LTC2943_mode;int8_t ack = 0;LTC2943_mode = LTC2943_SCAN_MODE|prescalar_mode|alcc_mode ;/! S

28、et 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_l2C_ADDRESS, LTC2943_CONTROL_REG, LTC2943_mode); /! Writes the set mode to the LTC2943 control registerdouint8_t status_code;uint16_t charge_code, current_cod

29、e, voltage_code, temperature_code;ack |= LTC2943_read_16_bits(LTC2943_l2C_ADDRESS, LTC2943_ACCUM_CHARGE_MSB_REG, &charge_code); /! Read MSB and LSB Accumulated Charge Registers for 16 bit charge codeack |= LTC2943_read_16_bits(LTC2943_l2C_ADDRESS,LT C2943_V O LT AG E_M S B_R E G, &voltage_co

30、de);/! Read MSB andLSB Voltage Registers for 16 bit voltage codeack |= LTC2943_read_16_bits(LTC2943_l2C_ADDRESS, LTC2943_CURRENT_MSB_REG, &current_code); /! Read MSB and LSB Current Registers for 16 bit current codeack |= LTC2943_read_16_bits(LTC2943_l2C_ADDRESS, LTC2943_TEMPERATURE_I/ISB_REG, &

31、amp;temperature_code); /! Read MSB and LSB Temperature Registers for 16 bit temperature codeack |= LTC2943_read(LTC2943_l2C_ADDRESS, LTC2943_STATUS_REG, &status_code); /! Read Status Registers for 8 bit status codefloat charge, current, voltage, temperature;if(mAh_or_Coulombs)(charge = LTC2943_c

32、ode_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(M Cn");charge = LTC2943_code_to_mAh(charge_code, resistor, prescalarValue); /! Convert chargecode to mAh

33、if mAh units are desired.Serial.printC'mAh: ”);Serial.print(charge, 4);Serial.print(F(M mAhnH);current = LTC2943_code_to_current(current_code, resistor); /! Convert current code to Amperesvoltage = LT C2943_code_to_voltage(voltage_code);/! Convert voltage code to VoltsSerial.print(F("Curren

34、t");Serial.print(current, 4);Serial.print(F(n A'n”);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 Kelvin if Kelvin units are desired

35、.Serial.print(F("Temperature ");Serial.printemperature, 4);Serial.print(F(H KnH);temperature = LTC2943_code_to_celcius_temperature(temperature_code); /! Convert temperature code to Celcius if Celcius units are desired.Serial.print(F(,'Temperature ");Serial.print(temperature, 4);Se

36、rial.print(F(n C'n”);)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 MenunnM);Serial.flush();delay(SCAN_MODE_DISPLAY_DELAY);)elsewhile (Serial.available() = false | (ack); read_int(

37、); / clears the Serial.available return(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) /! return Returns the state of the acknowledge bit after the I2C address write. O=acknowledge3

38、 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_l2C_ADDRESS, LTC2943_CONTROL_REG, LTC29

39、43_mode);/! Writes the set mode to theLTC2943 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.do*Serial.print(F("nnn);uint8_t status_code;uint16_t charge_code, current_co

40、de, voltage_code, temperature_code;ack |= LTC2943_read_16_bits(LTC2943_l2C_ADDRESS, LTC2943_ACCUM_CHARGE_MSB_REG, &charge_code); LSB /! Read MSB and Accumulated Charge Registers for 16 bit charge codeack |= LTC2943_read_16_bits(LTC2943_l2C_ADDRESS,LT C2943_V O LT AG E_M S B_R EG, &voltage_co

41、de);/! Read MSB andLSB Voltage Registers for 16 bit voltage codeack|=LTC2943_read_16_bits(LTC2943_l2C_ADDRESS,LTC2943_CURRENT_MSB_REG, &current_code); /! Read MSB and LSB Current Registers for 16 bit current codeack |= LTC2943_read_16_bits(LTC2943_l2C_ADDRESS,LTC2943_TEMPERATURE_MSB_REG, &te

42、mperature_code); /! Read MSB and LSB Temperature Registers for 16 bit temperature codeack |= LTC2943_read(LTC2943_l2C_ADDRESS, LTC2943_STATUS_REG, &status_code);/! Read Status Registers for8 bit status codefloat charge, current, voltage, temperature; if(mAh_or_Coulombs)charge = LTC2943_code_to_c

43、oulombs(charge_code, resistor, prescalarValue); /! Convert charge codeto Coulombs if Coulomb units are desired.Serial.print(nCoulombs: ”);Serial.print(charge, 4);Serial.print(F(" Cn");)else(charge = LTC2943_code_to_mAh(charge_code, resistor, prescalarValue); /! Convert charge code to mAh i

44、f mAh units are desired.Serial.print("mAh: ");Serial.print(charge, 4);Serial.print(F(H mAhnn);)current = 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(HCurrent

45、");Serial.print(current, 4);Serial.print(F(n A”);if(staleData) Serial.prinFC* Stale Data *n");/! If Stale data is inside the register after initial snapshot, Print Stale Data message.Serial.print(F(nVoltage ”);Serial.print(voltage, 4);Serial.print(F(H VH);if(staleData) SeriaLprint(F(n * St

46、ale Data *nn);/! If Stale data is inside the register after initial snapshot, Print Stale Data message.else Serial.println(,H,);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(nT

47、emperature ");Serial.print(temperature5 4);Serial.print(FC,Kn);)else(temperature = LTC2943_code_to_celcius_temperature(temperature_code); /! Convert temperature code to Celcius if Celcius units are desired.Serial.print(F(nTemperature ");Serial.print(temperature, 4);Serial.print(F(" C&

48、quot;);)if(staleData) Serial.print(F(H * Stale Data *nH);else Serial.println(,H,);checkAlerts(status_code);/! Check status code for Alerts. If an Alert has been set, print out appropriate message in the Serial Promptelse Serial.println(,H,);Serial.print(F(',m-Main Menunn");staleData = 1;Ser

49、ial.flush();delay(AUTOMATIC_MODE_DISPLAY_DELAY);)while (Serial.available() = false | (ack); readjnt(); / clears the Serial.available return(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 s

50、tate of the acknowledge bit after the I2C address write. O=acknowledge, 1=no acknowledge(int8_t LTC2943_mode;int8_t ack = 0;LTC2943_mode = LTC2943_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(

51、);ack |= LTC2943_write(LTC2943_l2C_ADDRESS, LTC2943_CONTROL_REG, LTC2943_mode); /! Writes the set mode to the LTC2943 control registerdo*nn”);delay(100);SeriaLprint(F(nuint8_t status_code;uintl 6_t charge_code;ack |= LTC2943_read_16_bits(LTC2943_l2C_ADDRESS, LTC2943_ACCUM_CHARGE_MSB_REG, &charge

52、_code); /! Read MSB and LSB Accumulated Charge Registers for 16 bit charge codeack |= LTC2943_read(LTC2943_l2C_ADDRESS, LTC2943_STATUS_REG, &status_code);/! Read Status Registers for 8bit status codefloat charge;if(mAh_or_Coulombs)(charge = LTC2943_code_to_coulombs(charge_code, resistor, prescal

53、arValue); /! Convert charge code toCoulombs if Coulomb units are desired.Serial.print(,'Coulombs: ");Serial.print(charge, 4);Serial.print(F(H CnH);)else(charge = LTC2943_code_to_mAh(charge_code, resistor, prescalarValue); /! Convert charge code to mAh if mAh units are desired.Serial.print(H

54、mAh:");Serial.print(charge, 4);Serial.print(F(n mAhnn);)Serial.print(F(HCurrent");Serial.print(F(" ADC Sleep.An");Serial.print(F(,Voltage ");Serial.print(F(" ADC Sleep.An");Serial.print(F(HTemperature ");SeriaLprint(F(n ADC Sleep.nM);Serial.print(F(Hm-Main Men

55、unnH); checkAlerts(status_code);Serial.flush();delay(AUTOMATIC_MODE_DISPLAY_DELAY);)while (Serial.available() = false | (ack);readj nt (); / clears the Serial.available return(ack);)/! Shutdown Modeint8_t menu_5_shutdown_mode()/! return Returns the state of the acknowledge bit after the I2C address

56、write. O=acknowledge, 1=no acknowledge(int8_t ack = 0;ack |= LTC2943_write(LTC2943_l2C_ADDRESS, LTC2943_CONTROL_REG, LTC2943_SHUTDOWN_MODE);/! Sets the LTC2943 intoshutdown modeSerial.print("LTC2943 Has Been ShutDownnH); return(ack);/! Settings Menuint8_t menu_6_settings(uint8_t *mAh_or_Coulombs, uint8_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 ack = 0;int8_t user_command;doSerial.print(FC,nnH);Serial.print(F(H1

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論