Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board

Linear Technology DC14968B-B Demonstration Board. More...

Detailed Description

Linear Technology DC14968B-B Demonstration Board.

LTC2942: Battery Gas Gauge with Temperature, Voltage Measurement

Linear Technology DC14968B-A Demonstration Board. LTC2941: Battery Gas Gauge with I2C Interface

  Setup:
     Apply a voltage source to the V_BATT terminal and a load at the V_CHRG/LD terminal.
     Refer to the Demo Manual Guide for a detailed setup description. Ensure that JP1 is
     set to AL# position.

  Explanation of Commands:

     1 - Automatic Mode - Scans Voltage, Temperature and charge every 60ms.
         Scanning interval has been increased to 1s for ease of reading on the Serial Prompt.
         Displays an alert if it is set in the status register at the time of scan.

     2 - Manual Voltage Mode - Provides a SnapShot of the Voltage, and Accumulated Charge.
         After the initial SnapShot, the part goes into sleep mode where it only counts charge.
         Displays an alert if it is set in the status register at the time of scan.

     3 - Manual Temperature Mode - Provides a SnapShot of the Temperature, and Accumulated Charge.
        After the initial SnapShot, the part goes into sleep mode where it only counts charge.
        Displays an alert if it is set in the status register at the time of scan.

     4 - Sleep Mode - The ADC portion of the LTC2942 is shutdown. In this mode only charge is accumulated.

     5 - Shutdown Mode - The LTC2942 goes into low power mode.

     6 - Settings - Allows user to set alert thresholds, set prescalar, set AL#/CC# pin mode and change the temperature and charge units.

NOTES
 Setup:
 Set the terminal baud rate to 115200 and select the newline terminator.
 Requires a power supply.
 Refer to demo manual DC1812A-A.
 For use with LTC2941 ignore calls to temperature and voltage as these are not present in LTC2941.
 All of the functionality of LTC2941 is supported except Control Register B[7:6]

USER INPUT DATA FORMAT:
 decimal : 1024
 hex     : 0x400
 octal   : 02000  (leading 0 "zero")
 binary  : B10000000000
 float   : 1024.0

http://www.linear.com/product/LTC2942 http://www.linear.com/product/LTC2941

http://www.linear.com/product/LTC2942#demoboards http://www.linear.com/product/LTC2941#demoboards

Copyright 2018(c) Analog Devices, Inc.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
  • The use of this software may or may not infringe the patent rights of one or more patent holders. This license does not release you from the requirement that you obtain separate licenses from these patent holders to use this software.
  • Use of the software either in source or binary form, must be run on or directly connected to an Analog Devices Inc. component.

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file DC1496BB.ino.

Go to the source code of this file.

Functions

static void print_title ()
 Print the title block. More...
 
static void print_prompt ()
 Print the Prompt. More...
 
static void store_alert_settings ()
 
static int8_t restore_alert_settings ()
 
static void setup ()
 Initialize Linduino. More...
 
static void loop ()
 Repeats Linduino loop. More...
 
static 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)
 Automatic Mode. More...
 
static int8_t menu_2_manual_voltage_mode (int8_t mAh_or_Coulombs, int8_t celcius_or_kelvin, uint16_t prescalar_mode, uint16_t prescalarValue, uint16_t alcc_mode)
 Manual Voltage Mode. More...
 
static int8_t menu_3_manual_temperature_mode (int8_t mAh_or_Coulombs, int8_t celcius_or_kelvin, uint16_t prescalar_mode, uint16_t prescalarValue, uint16_t alcc_mode)
 Manual Voltage Mode. More...
 
static int8_t menu_4_sleep_mode (int8_t mAh_or_Coulombs, uint16_t prescalar_mode, uint16_t prescalarValue, uint16_t alcc_mode)
 Sleep Mode. More...
 
static int8_t menu_5_shutdown_mode ()
 Shutdown Mode. More...
 
static int8_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)
 Settings Menu. More...
 
static int8_t menu_6_settings_menu_1_set_alert_thresholds ()
 Alert Threshold Menu. More...
 
static int8_t menu_6_alert_menu_1_set_charge_thresholds ()
 Set Charge Threshold Function. More...
 
static int8_t menu_6_alert_menu_2_set_voltage_thresholds ()
 Set Voltage Thresholds. More...
 
static int8_t menu_6_alert_menu_3_set_temperature_thresholds ()
 Set Temperature Thresholds. More...
 
static int8_t menu_6_settings_menu_2_set_prescalar_values (uint16_t *prescalar_mode, uint16_t *prescalarValue)
 Prescalar Menu. More...
 
static uint8_t menu_6_alert_menu_3_set_allcc_state (uint16_t *alcc_mode)
 AL#/CC# Pin Mode Menu. More...
 
static uint8_t menu_6_alert_menu_4_set_units (uint8_t *mAh_or_Coulombs, uint8_t *celcius_or_kelvin)
 Set Charge and Temperature Units Menu. More...
 
bool isBitSet (uint8_t value, uint8_t position)
 Checks to see if a bit in a certain position is set. More...
 
static void checkAlerts (uint8_t status_code)
 Check Alerts Function - Checks to see if an alert has been set in the status register. If an alert has been set, it prints out the appropriate message. More...
 

Macros

#define AUTOMATIC_MODE_DISPLAY_DELAY   1000
 The delay between readings in automatic mode. More...
 
#define SCAN_MODE_DISPLAY_DELAY   10000
 The delay between readings in scan mode. More...
 

Variables

const float resistor = .100
 resistor value on demo board More...
 
const char ack_error [] = "Error: No Acknowledge. Check I2C Address."
 Error message. More...
 
static int8_t demo_board_connected
 Set to 1 if the board is connected. More...
 
static uint8_t alert_code = 0
 Value stored or read from ALERT register. More...
 

Function Documentation

◆ checkAlerts()

static void checkAlerts ( uint8_t  status_code)
static

Check Alerts Function - Checks to see if an alert has been set in the status register. If an alert has been set, it prints out the appropriate message.

Returns

Definition at line 888 of file DC1496BB.ino.

◆ isBitSet()

bool isBitSet ( uint8_t  value,
uint8_t  position 
)

Checks to see if a bit in a certain position is set.

Returns
Returns the state of a bit at "position" in a byte. 1 = Set, 0 = Not Set

Definition at line 882 of file DC1496BB.ino.

◆ loop()

static void loop ( void  )
static

Repeats Linduino loop.

Definition at line 153 of file DC1496BB.ino.

◆ menu_1_automatic_mode()

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

Automatic Mode.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.

Definition at line 228 of file DC1496BB.ino.

◆ menu_2_manual_voltage_mode()

static int8_t menu_2_manual_voltage_mode ( int8_t  mAh_or_Coulombs,
int8_t  celcius_or_kelvin,
uint16_t  prescalar_mode,
uint16_t  prescalarValue,
uint16_t  alcc_mode 
)
static

Manual Voltage Mode.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge

Definition at line 314 of file DC1496BB.ino.

◆ menu_3_manual_temperature_mode()

static int8_t menu_3_manual_temperature_mode ( int8_t  mAh_or_Coulombs,
int8_t  celcius_or_kelvin,
uint16_t  prescalar_mode,
uint16_t  prescalarValue,
uint16_t  alcc_mode 
)
static

Manual Voltage Mode.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge

Definition at line 384 of file DC1496BB.ino.

◆ menu_4_sleep_mode()

static int8_t menu_4_sleep_mode ( int8_t  mAh_or_Coulombs,
uint16_t  prescalar_mode,
uint16_t  prescalarValue,
uint16_t  alcc_mode 
)
static

Sleep Mode.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge

Definition at line 460 of file DC1496BB.ino.

◆ menu_5_shutdown_mode()

static int8_t menu_5_shutdown_mode ( )
static

Shutdown Mode.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge

Definition at line 518 of file DC1496BB.ino.

◆ menu_6_alert_menu_1_set_charge_thresholds()

static int8_t menu_6_alert_menu_1_set_charge_thresholds ( )
static

Set Charge Threshold Function.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge

Definition at line 620 of file DC1496BB.ino.

◆ menu_6_alert_menu_2_set_voltage_thresholds()

static int8_t menu_6_alert_menu_2_set_voltage_thresholds ( )
static

Set Voltage Thresholds.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge

Definition at line 644 of file DC1496BB.ino.

◆ menu_6_alert_menu_3_set_allcc_state()

static uint8_t menu_6_alert_menu_3_set_allcc_state ( uint16_t *  alcc_mode)
static

AL#/CC# Pin Mode Menu.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge

Definition at line 785 of file DC1496BB.ino.

◆ menu_6_alert_menu_3_set_temperature_thresholds()

static int8_t menu_6_alert_menu_3_set_temperature_thresholds ( )
static

Set Temperature Thresholds.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge

Definition at line 675 of file DC1496BB.ino.

◆ menu_6_alert_menu_4_set_units()

static uint8_t menu_6_alert_menu_4_set_units ( uint8_t *  mAh_or_Coulombs,
uint8_t *  celcius_or_kelvin 
)
static

Set Charge and Temperature Units Menu.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge

Definition at line 830 of file DC1496BB.ino.

◆ menu_6_settings()

static int8_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 
)
static

Settings Menu.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge

Definition at line 527 of file DC1496BB.ino.

◆ menu_6_settings_menu_1_set_alert_thresholds()

static int8_t menu_6_settings_menu_1_set_alert_thresholds ( )
static

Alert Threshold Menu.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge

Definition at line 578 of file DC1496BB.ino.

◆ menu_6_settings_menu_2_set_prescalar_values()

static int8_t menu_6_settings_menu_2_set_prescalar_values ( uint16_t *  prescalar_mode,
uint16_t *  prescalarValue 
)
static

Prescalar Menu.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge

Definition at line 707 of file DC1496BB.ino.

◆ print_prompt()

static void print_prompt ( )
static

Print the Prompt.

Definition at line 216 of file DC1496BB.ino.

◆ print_title()

static void print_title ( void  )
static

Print the title block.

Definition at line 203 of file DC1496BB.ino.

◆ restore_alert_settings()

static int8_t restore_alert_settings ( )
static

◆ setup()

static void setup ( void  )
static

Initialize Linduino.

Definition at line 128 of file DC1496BB.ino.

◆ store_alert_settings()

static void store_alert_settings ( )
static

Macro Definition Documentation

◆ AUTOMATIC_MODE_DISPLAY_DELAY

#define AUTOMATIC_MODE_DISPLAY_DELAY   1000

The delay between readings in automatic mode.

Definition at line 114 of file DC1496BB.ino.

◆ SCAN_MODE_DISPLAY_DELAY

#define SCAN_MODE_DISPLAY_DELAY   10000

The delay between readings in scan mode.

Definition at line 115 of file DC1496BB.ino.

Variable Documentation

◆ ack_error

const char ack_error[] = "Error: No Acknowledge. Check I2C Address."

Error message.

Definition at line 119 of file DC1496BB.ino.

◆ alert_code

uint8_t alert_code = 0
static

Value stored or read from ALERT register.

Shared between loop() and restore_alert_settings()

Definition at line 125 of file DC1496BB.ino.

◆ demo_board_connected

int8_t demo_board_connected
static

Set to 1 if the board is connected.

Definition at line 124 of file DC1496BB.ino.

◆ resistor

const float resistor = .100

resistor value on demo board

Definition at line 116 of file DC1496BB.ino.