| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

Data Structures | Functions | Macros | Variables
DC1697A.ino File Reference
Power Monitors and Coulomb Counters » LTC2945: 12-Bit Wide Range Power Monitor

DC1697A LTC2945: Wide Range Power Monitor. More...

## Detailed Description

DC1697A LTC2945: Wide Range Power Monitor.

    Setting the Alerts:
        1. Select the Alert option from the main menu.
        2. Select the desired alerts to be changed. Then enter the minimum and maximum
           values.
        3. Select the Enable and Disable Alert Option and Enable the desired alerts.
        4. Lastly, go back to the main menu and start reading values in Continuous Mode
           or Snapshot Mode.
           Note: Alerts only respond when conversion is done. Therefore, in continuous
           mode the alerts will constantly be updated.

    Reading and Clearing an Alert:
        1. Select the Alert option from the main menu.
        2. Select the Read and Clear Alerts option. This reads all faults that occured
           and clears the alerts.

    NOTES
     Setup:
     Set the terminal baud rate to 115200 and select the newline terminator.
     Requires a power supply.
     Refer to demo manual DC1697A.

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

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 DC1697A.ino.

Go to the source code of this file.

## Data Structures
union | eeprom_data_union
| Used to manipulate EEPROM data. More...
struct | eeprom_data_union::data_struct_type
| EEPROM data structure. More...

## Functions
static void | print_title ()
| Print the title block. More...
static void | print_prompt ()
| Print the Prompt. More...
static void | store_alert_settings ()
| Store the alert settings to the EEPROM. More...
static int8_t | restore_alert_settings ()
| Read the alert settings from EEPROM. More...
static int8_t | menu_1_continuous_mode (int8_t VDD_or_SENSE_monitoring, int8_t ADIN_or_SENSE, float scale)
| Continuous Mode. More...
static int8_t | menu_2_snapshot_mode (int8_t VDD_or_SENSE_monitoring, int8_t ADIN_or_SENSE)
| Snapshot Mode Menu. More...
static int8_t | menu_2_snapshot_mode_menu_1_current (int8_t VDD_or_SENSE_monitoring, int8_t ADIN_or_SENSE)
| Current - Snapshot mode. More...
static int8_t | menu_2_snapshot_mode_menu_2_vin ()
| VIN - Snapshot Mode. More...
static int8_t | menu_2_snapshot_mode_menu_3_ADIN ()
| ADIN - Snapshot Mode. More...
static int8_t | menu_3_alert (int8_t ADIN_or_SENSE)
| Alert Menu. More...
static int8_t | menu_3_alert_menu_1_set_power_alerts (int8_t ADIN_or_SENSE)
| Set Power Alerts. More...
static int8_t | menu_3_alert_menu_2_set_current_alerts ()
| Set Current Alerts. More...
static int8_t | menu_3_alert_menu_3_set_vin_alerts ()
| Set VIN Alerts. More...
static int8_t | menu_3_alert_menu_4_set_adin_alerts ()
| Set ADIN Alerts. More...
static int8_t | menu_3_alert_menu_5_enable_disable_alerts ()
| Enable/Disable Alerts. More...
static int8_t | menu_3_alert_menu_6_read_clear_alerts ()
| Read Alerts and Clear Alerts. More...
static int8_t | menu_4_shutdown ()
| Shutdown Down Mode. More...
static void | menu_5_settings (int8_t *VDD_or_SENSE_monitoring, int8_t *ADIN_or_SENSE, float *scale)
| change Settings More...
static int8_t | menu_6_clear_min_max ()
| Clear Min/Max. More...
static void | setup ()
| Initialize Linduino. More...
static void | loop ()
| Repeats Linduino loop. More...

## Macros
#define | CONTINUOUS_MODE_DISPLAY_DELAY 1000
| The delay between readings. More...

## Variables
const float | LTC2945_ADIN_lsb = 5.001221E-04
| Typical ADIN lsb weight in volts. More...
const float | LTC2945_DELTA_SENSE_lsb = 2.5006105E-05
| Typical Delta lsb weight in volts. More...
const float | LTC2945_VIN_lsb = 2.5006105E-02
| Typical VIN lsb weight in volts. More...
const float | LTC2945_Power_lsb = 6.25305E-07
| Typical POWER lsb weight in V^2. More...
const float | LTC2945_ADIN_DELTA_SENSE_lsb = 1.25061E-08
| Typical sense lsb weight in V^2 *ADIN_lsb * DELTA_SENSE_lsb. More...
const float | resistor = .02
| 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

## ◆ loop()

static void loop | ( | void |  | ) |
| static

Repeats Linduino loop.

Definition at line 150 of file DC1697A.ino.

## ◆ menu_1_continuous_mode()

static int8_t menu_1_continuous_mode | ( | int8_t | VDD_or_SENSE_monitoring,
|  | int8_t | ADIN_or_SENSE,
|  | float | scale
| ) |  |
| static

Continuous Mode.

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

Parameters

  VDD_or_SENSE_monitoring | Choose whether VIN is sensed at VDD pin or SENSE pin (A2 bit of CONTROL Register A)
  ADIN_or_SENSE | Choose whether power multiplier uses ADIN pin or SENSE pin as voltage input (A0 bit in CONTROL Register A)
  scale | Stores division ratio for resistive divider on ADIN pin. Configured inside "Settings" menu.

Definition at line 234 of file DC1697A.ino.

## ◆ menu_2_snapshot_mode()

static int8_t menu_2_snapshot_mode | ( | int8_t | VDD_or_SENSE_monitoring,
|  | int8_t | ADIN_or_SENSE
| ) |  |
| static

Snapshot Mode Menu.

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

Parameters

  VDD_or_SENSE_monitoring | Choose whether VIN is sensed at VDD pin or SENSE pin (A2 bit of CONTROL Register A)
  ADIN_or_SENSE | Choose whether power multiplier uses ADIN pin or SENSE pin as voltage input (A0 bit in CONTROL Register A)

Definition at line 381 of file DC1697A.ino.

## ◆ menu_2_snapshot_mode_menu_1_current()

static int8_t menu_2_snapshot_mode_menu_1_current | ( | int8_t | VDD_or_SENSE_monitoring,
|  | int8_t | ADIN_or_SENSE
| ) |  |
| static

Current - Snapshot mode.

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

Parameters

  VDD_or_SENSE_monitoring | Choose whether VIN is sensed at VDD pin or SENSE pin (A2 bit of CONTROL Register A)
  ADIN_or_SENSE | Choose whether power multiplier uses ADIN pin or SENSE pin as voltage input (A0 bit in CONTROL Register A)

Definition at line 440 of file DC1697A.ino.

## ◆ menu_2_snapshot_mode_menu_2_vin()

static int8_t menu_2_snapshot_mode_menu_2_vin | ( |  | ) |
| static

VIN - Snapshot Mode.

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

Definition at line 470 of file DC1697A.ino.

## ◆ menu_2_snapshot_mode_menu_3_ADIN()

static int8_t menu_2_snapshot_mode_menu_3_ADIN | ( |  | ) |
| static

ADIN - Snapshot Mode.

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

Definition at line 495 of file DC1697A.ino.

## ◆ menu_3_alert()

static int8_t menu_3_alert | ( | int8_t | ADIN_or_SENSE | ) |
| static

Alert Menu.

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

Parameters

  ADIN_or_SENSE | Choose whether power multiplier uses ADIN pin or SENSE pin as voltage input (A0 bit in CONTROL Register A)

Definition at line 521 of file DC1697A.ino.

## ◆ menu_3_alert_menu_1_set_power_alerts()

static int8_t menu_3_alert_menu_1_set_power_alerts | ( | int8_t | ADIN_or_SENSE | ) |
| static

Set Power Alerts.

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

Parameters

  ADIN_or_SENSE | Choose whether power multiplier uses ADIN pin or SENSE pin as voltage input (A0 bit in CONTROL Register A)

Definition at line 586 of file DC1697A.ino.

## ◆ menu_3_alert_menu_2_set_current_alerts()

static int8_t menu_3_alert_menu_2_set_current_alerts | ( |  | ) |
| static

Set Current Alerts.

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

Definition at line 620 of file DC1697A.ino.

## ◆ menu_3_alert_menu_3_set_vin_alerts()

static int8_t menu_3_alert_menu_3_set_vin_alerts | ( |  | ) |
| static

Set VIN Alerts.

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

Definition at line 648 of file DC1697A.ino.

## ◆ menu_3_alert_menu_4_set_adin_alerts()

static int8_t menu_3_alert_menu_4_set_adin_alerts | ( |  | ) |
| static

Set ADIN Alerts.

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

Definition at line 675 of file DC1697A.ino.

## ◆ menu_3_alert_menu_5_enable_disable_alerts()

static int8_t menu_3_alert_menu_5_enable_disable_alerts | ( |  | ) |
| static

Enable/Disable Alerts.

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

Definition at line 702 of file DC1697A.ino.

## ◆ menu_3_alert_menu_6_read_clear_alerts()

static int8_t menu_3_alert_menu_6_read_clear_alerts | ( |  | ) |
| static

Read Alerts and Clear Alerts.

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

Definition at line 827 of file DC1697A.ino.

## ◆ menu_4_shutdown()

static int8_t menu_4_shutdown | ( |  | ) |
| static

Shutdown Down Mode.

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

Definition at line 845 of file DC1697A.ino.

## ◆ menu_5_settings()

static void menu_5_settings | ( | int8_t * | VDD_or_SENSE_monitoring,
|  | int8_t * | ADIN_or_SENSE,
|  | float * | scale
| ) |  |
| static

change Settings

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

Parameters

  VDD_or_SENSE_monitoring | Choose whether VIN is sensed at VDD pin or SENSE pin (A2 bit of CONTROL Register A)
  ADIN_or_SENSE | Choose whether power multiplier uses ADIN pin or SENSE pin as voltage input (A0 bit in CONTROL Register A)
  scale | Stores division ratio for resistive divider on ADIN pin.

Definition at line 856 of file DC1697A.ino.

## ◆ menu_6_clear_min_max()

static int8_t menu_6_clear_min_max | ( |  | ) |
| static

Clear Min/Max.

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

Definition at line 886 of file DC1697A.ino.

## ◆ print_prompt()

static void print_prompt | ( |  | ) |
| static

Print the Prompt.

Definition at line 222 of file DC1697A.ino.

## ◆ print_title()

static void print_title | ( | void |  | ) |
| static

Print the title block.

Definition at line 209 of file DC1697A.ino.

## ◆ restore_alert_settings()

static int8_t restore_alert_settings | ( |  | ) |
| static

Read the alert settings from EEPROM.

Returns
  Return 1 if successful, 0 if not

Definition at line 924 of file DC1697A.ino.

## ◆ setup()

static void setup | ( | void |  | ) |
| static

Initialize Linduino.

Definition at line 128 of file DC1697A.ino.

## ◆ store_alert_settings()

static void store_alert_settings | ( |  | ) |
| static

Store the alert settings to the EEPROM.

Definition at line 962 of file DC1697A.ino.

## Macro Definition Documentation

## ◆ CONTINUOUS_MODE_DISPLAY_DELAY

#define CONTINUOUS_MODE_DISPLAY_DELAY 1000

The delay between readings.

Definition at line 109 of file DC1697A.ino.

## Variable Documentation

## ◆ ack_error

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

Error message.

Definition at line 121 of file DC1697A.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 DC1697A.ino.

## ◆ demo_board_connected

int8_t demo_board_connected
| static

Set to 1 if the board is connected.

Definition at line 124 of file DC1697A.ino.

## ◆ LTC2945_ADIN_DELTA_SENSE_lsb

const float LTC2945_ADIN_DELTA_SENSE_lsb = 1.25061E-08

Typical sense lsb weight in V^2 *ADIN_lsb * DELTA_SENSE_lsb.

Definition at line 116 of file DC1697A.ino.

## ◆ LTC2945_ADIN_lsb

const float LTC2945_ADIN_lsb = 5.001221E-04

Typical ADIN lsb weight in volts.

Definition at line 112 of file DC1697A.ino.

## ◆ LTC2945_DELTA_SENSE_lsb

const float LTC2945_DELTA_SENSE_lsb = 2.5006105E-05

Typical Delta lsb weight in volts.

Definition at line 113 of file DC1697A.ino.

## ◆ LTC2945_Power_lsb

const float LTC2945_Power_lsb = 6.25305E-07

Typical POWER lsb weight in V^2.

Definition at line 115 of file DC1697A.ino.

## ◆ LTC2945_VIN_lsb

const float LTC2945_VIN_lsb = 2.5006105E-02

Typical VIN lsb weight in volts.

Definition at line 114 of file DC1697A.ino.

## ◆ resistor

const float resistor = .02

resistor value on demo board

Definition at line 118 of file DC1697A.ino.