Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board

LTC2992: Dual Wide Range Power Monitor. More...

Detailed Description

LTC2992: Dual Wide Range Power Monitor.

Setting the Thresholds:
    1. Select the Threshold Configuration from the main menu.
    2. Select the desired Threshold to be changed. Then enter the minimum and maximum
       values.
    3. If any reading exceeds the set threshold, a fault will be generated that can be viewed in
     the Read/Clear Faults Menu


Reading and Clearing a Fault:
    1. Select the Read/Clear Fault option from the main menu.
    2. To read all the faults, select Read Faults option. This will display all the faults that have occured.
  3. To clear all faults, go back to the Read/Clear Faults menu and select Clear Faults option.

NOTE: Due to memory limitations of the Atmega328 processor this sketch shows limited functionality of the LTC2992. Please
      check the datasheet for a picture of the full functionality of the LTC2992.

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

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

http://www.linear.com/product/LTC2992

http://www.linear.com/product/LTC2992#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 DC2561.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 int8_t menu_1_continuous_mode (int8_t CTRLA_mode, int8_t bit_resolution, float scale)
 Continuous Mode. More...
 
static int8_t menu_2_threshold_config (float scale, int8_t bit_resolution)
 Configure Threshold Values. More...
 
static int8_t menu_3_GPIO_config ()
 
static int8_t menu_4_settings (int8_t *CTRLA_mode, int8_t *bit_resolution)
 Settings to configure shutdown mode and ADC Resolution. More...
 
static int8_t menu_5_read_clear_faults ()
 Read/Clear Faults. More...
 
static int8_t menu_2_threshold_menu_1_set_power (int8_t bit_resolution)
 Set Power Min/Max Values. More...
 
static int8_t menu_2_threshold_menu_2_set_current (int8_t bit_resolution)
 Set Min/Max Current Threshold. More...
 
static int8_t menu_2_threshold_menu_3_set_SENSE (int8_t bit_resolution)
 Set Min/Max Voltage Thresholds. More...
 
static int8_t menu_2_alert_menu_4_set_adin_alerts (float scale, int8_t bit_resolution)
 
static int8_t menu_2_threshold_menu_5_reset_thresholds ()
 Set All Thresholds to Default Values. 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 in continious mode. More...
 

Variables

const float LTC2992_GPIO_8bit_lsb = 8.000E-3
 Typical GPIO lsb weight for 8-bit mode in volts. More...
 
const float LTC2992_GPIO_12bit_lsb = 0.500E-3
 Typical GPIO lsb weight for 12-bit mode in volts. More...
 
const float LTC2992_DELTA_SENSE_8bit_lsb = 200.00E-6
 Typical Delta lsb weight for 8-bit mode in volts. More...
 
const float LTC2992_DELTA_SENSE_12bit_lsb = 12.50E-6
 Typical Delta lsb weight for 12-bit mode in volts. More...
 
const float LTC2992_SENSE_8bit_lsb = 400.00E-3
 Typical SENSE lsb weight for 8-bit mode in volts. More...
 
const float LTC2992_SENSE_12bit_lsb = 25.00E-3
 Typical SENSE lsb weight for 12-bit mode in volts. More...
 
const float LTC2992_Power_8bit_lsb = LTC2992_DELTA_SENSE_8bit_lsb*LTC2992_SENSE_8bit_lsb
 Typical POWER lsb weight for 8-bit mode in V^2. More...
 
const float LTC2992_Power_12bit_lsb = LTC2992_DELTA_SENSE_12bit_lsb*LTC2992_SENSE_12bit_lsb
 Typical POWER lsb weight for 12-bit mode in V^2. More...
 
const float resistor = .01
 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...
 

Function Documentation

◆ loop()

static void loop ( void  )
static

Repeats Linduino loop.

Definition at line 152 of file DC2561.ino.

◆ menu_1_continuous_mode()

static int8_t menu_1_continuous_mode ( int8_t  CTRLA_mode,
int8_t  bit_resolution,
float  scale 
)
static

Continuous Mode.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
Parameters
CTRLA_modeSet Continious Mode
bit_resolutionSet ADC Resolution
scaleStores division ratio for resistive divider on GPIO pin. Configured inside "Settings" menu.

Definition at line 232 of file DC2561.ino.

◆ menu_2_alert_menu_4_set_adin_alerts()

static int8_t menu_2_alert_menu_4_set_adin_alerts ( float  scale,
int8_t  bit_resolution 
)
static
Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
Parameters
scaleStores division ratio for resistive divider on GPIO pin. Configured inside "Settings" menu.
bit_resolutionSets ADC Resolution

Definition at line 1080 of file DC2561.ino.

◆ menu_2_threshold_config()

static int8_t menu_2_threshold_config ( float  scale,
int8_t  bit_resolution 
)
static

Configure Threshold Values.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
Parameters
scaleStores division ratio for resistive divider on GPIO pin. Configured inside "Settings" menu.
bit_resolutionSets ADC Resolution

Definition at line 731 of file DC2561.ino.

◆ menu_2_threshold_menu_1_set_power()

static int8_t menu_2_threshold_menu_1_set_power ( int8_t  bit_resolution)
static

Set Power Min/Max Values.

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

Definition at line 785 of file DC2561.ino.

◆ menu_2_threshold_menu_2_set_current()

static int8_t menu_2_threshold_menu_2_set_current ( int8_t  bit_resolution)
static

Set Min/Max Current Threshold.

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

Definition at line 894 of file DC2561.ino.

◆ menu_2_threshold_menu_3_set_SENSE()

static int8_t menu_2_threshold_menu_3_set_SENSE ( int8_t  bit_resolution)
static

Set Min/Max Voltage Thresholds.

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

Definition at line 1004 of file DC2561.ino.

◆ menu_2_threshold_menu_5_reset_thresholds()

static int8_t menu_2_threshold_menu_5_reset_thresholds ( )
static

Set All Thresholds to Default Values.

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

Definition at line 1221 of file DC2561.ino.

◆ menu_3_GPIO_config()

static int8_t menu_3_GPIO_config ( )
static
Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.

Definition at line 1284 of file DC2561.ino.

◆ menu_4_settings()

static int8_t menu_4_settings ( int8_t *  CTRLA_mode,
int8_t *  bit_resolution 
)
static

Settings to configure shutdown mode and ADC Resolution.

Sets ADC Bit Resolution.

Returns
Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
Parameters
bit_resolutionCTRLA Register. Used to set device in Shutdown

Definition at line 1585 of file DC2561.ino.

◆ menu_5_read_clear_faults()

static int8_t menu_5_read_clear_faults ( )
static

Read/Clear Faults.

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

Definition at line 1402 of file DC2561.ino.

◆ print_prompt()

static void print_prompt ( )
static

Print the Prompt.

Definition at line 221 of file DC2561.ino.

◆ print_title()

static void print_title ( void  )
static

Print the title block.

Definition at line 208 of file DC2561.ino.

◆ setup()

static void setup ( void  )
static

Initialize Linduino.

Definition at line 130 of file DC2561.ino.

Macro Definition Documentation

◆ CONTINUOUS_MODE_DISPLAY_DELAY

#define CONTINUOUS_MODE_DISPLAY_DELAY   1000

The delay between readings in continious mode.

Definition at line 108 of file DC2561.ino.

Variable Documentation

◆ ack_error

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

Error message.

Definition at line 123 of file DC2561.ino.

◆ demo_board_connected

int8_t demo_board_connected
static

Set to 1 if the board is connected.

Definition at line 126 of file DC2561.ino.

◆ LTC2992_DELTA_SENSE_12bit_lsb

const float LTC2992_DELTA_SENSE_12bit_lsb = 12.50E-6

Typical Delta lsb weight for 12-bit mode in volts.

Definition at line 114 of file DC2561.ino.

◆ LTC2992_DELTA_SENSE_8bit_lsb

const float LTC2992_DELTA_SENSE_8bit_lsb = 200.00E-6

Typical Delta lsb weight for 8-bit mode in volts.

Definition at line 113 of file DC2561.ino.

◆ LTC2992_GPIO_12bit_lsb

const float LTC2992_GPIO_12bit_lsb = 0.500E-3

Typical GPIO lsb weight for 12-bit mode in volts.

Definition at line 112 of file DC2561.ino.

◆ LTC2992_GPIO_8bit_lsb

const float LTC2992_GPIO_8bit_lsb = 8.000E-3

Typical GPIO lsb weight for 8-bit mode in volts.

Definition at line 111 of file DC2561.ino.

◆ LTC2992_Power_12bit_lsb

const float LTC2992_Power_12bit_lsb = LTC2992_DELTA_SENSE_12bit_lsb*LTC2992_SENSE_12bit_lsb

Typical POWER lsb weight for 12-bit mode in V^2.

Definition at line 118 of file DC2561.ino.

◆ LTC2992_Power_8bit_lsb

const float LTC2992_Power_8bit_lsb = LTC2992_DELTA_SENSE_8bit_lsb*LTC2992_SENSE_8bit_lsb

Typical POWER lsb weight for 8-bit mode in V^2.

Definition at line 117 of file DC2561.ino.

◆ LTC2992_SENSE_12bit_lsb

const float LTC2992_SENSE_12bit_lsb = 25.00E-3

Typical SENSE lsb weight for 12-bit mode in volts.

Definition at line 116 of file DC2561.ino.

◆ LTC2992_SENSE_8bit_lsb

const float LTC2992_SENSE_8bit_lsb = 400.00E-3

Typical SENSE lsb weight for 8-bit mode in volts.

Definition at line 115 of file DC2561.ino.

◆ resistor

const float resistor = .01

resistor value on demo board

Definition at line 120 of file DC2561.ino.