![]() |
Linduino
1.3.0
Linear Technology Arduino-Compatible Demonstration Board
|
DC2156A LTC2946: 12-Bit Wide Range Power, Charge and Energy Monitor. More...
DC2156A LTC2946: 12-Bit Wide Range Power, Charge and Energy Monitor.
Setting the Alert Thresholds: 1. Select the Alert option from the main menu. 2. Select the desired Thresholds 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 DC2156A. 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:
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 DC2156.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 (uint8_t CTRLA, uint8_t VOLTAGE_SEL, float scale) |
Continuous Mode. More... | |
static int8_t | menu_2_snapshot_mode (uint8_t VOLTAGE_SEL, float scale) |
Snapshot Mode Menu. More... | |
static int8_t | menu_2_snapshot_mode_menu_1_SENSE () |
SENSE+ - Snapshot mode. More... | |
static int8_t | menu_2_snapshot_mode_menu_2_ADIN (float scale) |
ADIN - Snapshot Mode. More... | |
static int8_t | menu_2_snapshot_mode_menu_3_VDD () |
VDD - Snapshot Mode. More... | |
static int8_t | menu_2_snapshot_mode_menu_4_Current () |
Current - Snapshot Mode. More... | |
static int8_t | menu_3_alert (uint8_t VOLTAGE_SEL, float scale) |
Alert and Threshold Menu. More... | |
static int8_t | menu_3_alert_menu_1_set_power_alerts (uint8_t VOLTAGE_SEL, float scale) |
Set Power Alert Thresholds. More... | |
static int8_t | menu_3_alert_menu_2_set_current_alerts () |
Set Current Alert Thresholds. More... | |
static int8_t | menu_3_alert_menu_3_set_vin_alerts () |
Set VIN Alert Thresholds. More... | |
static int8_t | menu_3_alert_menu_4_set_adin_alerts (float scale) |
Set ADIN Alert Thresholds. More... | |
static int8_t | menu_3_alert_menu_5_enable_disable_alerts () |
Enable/Disable Alert Menu. More... | |
static int8_t | menu_3_alert_menu_5_enable_disable_alerts_menu_1_ALERT1 () |
Enable/Disable Alert in ALERT1 Register. More... | |
static int8_t | menu_3_alert_menu_5_enable_disable_alerts_menu_2_ALERT2 () |
static int8_t | menu_3_alert_menu_6_read_clear_faults () |
Read Faults and Clear. More... | |
static int8_t | menu_4_shutdown (uint8_t *CTRLB, uint8_t *shutdown) |
Toggle Shutdown Down Mode. More... | |
static int8_t | menu_5_settings (uint8_t *CTRLA, uint8_t *CTRLB, uint8_t *VOLTAGE_SEL, uint8_t *GPIO_CFG, uint8_t *GPIO3_CTRL, float *scale) |
Change Settings. More... | |
static int8_t | menu_5_settings_menu_1_configure_CTRLA_reg (uint8_t *CTRLA, uint8_t *VOLTAGE_SEL) |
Configure CTRLA Register. More... | |
static void | menu_5_settings_menu_1_configure_CTRLA_reg_menu_1_ADIN_Configuration (uint8_t *CTRLA) |
Configure the ADIN reference to GND/INTVCC. More... | |
static void | menu_5_settings_menu_1_configure_CTRLA_reg_menu_2_Offset_Configuration (uint8_t *CTRLA) |
Configure frequency of offset calibration. More... | |
static void | menu_5_settings_menu_1_configure_CTRLA_reg_menu_3_Voltage_Configuration (uint8_t *CTRLA, uint8_t *VOLTAGE_SEL) |
Select the voltage measurement channel. More... | |
static void | menu_5_settings_menu_1_configure_CTRLA_reg_menu_4_Channel_Configuration (uint8_t *CTRLA) |
Select duty cycle of measurments and channel configuration. More... | |
static int8_t | menu_5_settings_menu_2_configure_CTRLB_reg (uint8_t *CTRLB) |
Configure CTRLB Register. More... | |
static int8_t | menu_5_settings_menu_3_configure_GPIO (uint8_t *GPIO_CFG, uint8_t *GPIO3_CTRL) |
Configure GPIO pin States. More... | |
static void | menu_5_settings_menu_4_scaling_for_ADIN (uint8_t *scale) |
Select duty cycle of measurments and channel configuration. 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 2000 |
The delay between readings. More... | |
Variables | |
const float | resistor = .02 |
resistor value on demo board More... | |
const float | CLK_FREQ = 4E6 |
CLK Frequency. More... | |
const float | LTC2946_ADIN_lsb = 5.001221E-04 |
Typical ADIN lsb weight in volts. More... | |
const float | LTC2946_DELTA_SENSE_lsb = 2.5006105E-05 |
Typical Delta lsb weight in volts. More... | |
const float | LTC2946_VIN_lsb = 2.5006105E-02 |
Typical VIN lsb weight in volts. More... | |
const float | LTC2946_Power_lsb = 6.25305E-07 |
Typical POWER lsb weight in V^2 VIN_lsb * DELTA_SENSE_lsb. More... | |
const float | LTC2946_ADIN_DELTA_SENSE_lsb = 1.25061E-08 |
Typical sense lsb weight in V^2 *ADIN_lsb * DELTA_SENSE_lsb. More... | |
const float | LTC2946_INTERNAL_TIME_lsb = 4101.00/250000.00 |
Internal TimeBase lsb. More... | |
static float | LTC2946_TIME_lsb = 16.39543E-3 |
Static variable which is based off of the default clk frequency of 250KHz. 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 | alert1_code = 0 |
Value stored or read from ALERT1 register. More... | |
static uint8_t | alert2_code = 0 |
Value stored or read from ALERT2 register. More... | |
static bool | internalCLK = true |
|
static |
Repeats Linduino loop.
Definition at line 168 of file DC2156.ino.
|
static |
Continuous Mode.
CTRLA | CTRLA Register sets the mode in which Continious measurements are made. Configured in "Settings" menu. |
VOLTAGE_SEL | VOLTAGE_SEL variable represents the voltage channel selected. Scaling is done if ADIN channel is selected and resistive dividers are present. |
scale | Stores division ratio for resistive divider on ADIN pin. Configured inside "Settings" menu. |
Definition at line 257 of file DC2156.ino.
|
static |
Snapshot Mode Menu.
VOLTAGE_SEL | VOLTAGE_SEL variable represents the voltage channel selected. Scaling is done if ADIN channel is selected and resistive dividers are present. |
scale | Stores division ratio for resistive divider on ADIN pin. Configured inside "Settings" menu. |
Definition at line 453 of file DC2156.ino.
|
static |
SENSE+ - Snapshot mode.
Definition at line 527 of file DC2156.ino.
|
static |
ADIN - Snapshot Mode.
Definition at line 554 of file DC2156.ino.
|
static |
VDD - Snapshot Mode.
Definition at line 581 of file DC2156.ino.
|
static |
Current - Snapshot Mode.
Definition at line 608 of file DC2156.ino.
|
static |
Alert and Threshold Menu.
VOLTAGE_SEL | Voltage Selection Variable. |
scale | Stores division ratio for resistive divider on ADIN pin. Configured inside "Settings" menu. |
Definition at line 636 of file DC2156.ino.
|
static |
Set Power Alert Thresholds.
VOLTAGE_SEL | Choose whether power multiplier uses ADIN pin or SENSE pin as voltage input (A0 bit in CONTROL Register A) |
scale | Scale value based on resistive divider on the ADIN pin. |
Definition at line 703 of file DC2156.ino.
|
static |
Set Current Alert Thresholds.
Definition at line 738 of file DC2156.ino.
|
static |
Set VIN Alert Thresholds.
Definition at line 766 of file DC2156.ino.
|
static |
Set ADIN Alert Thresholds.
scale | Scale value based on resistive divider on the ADIN pin. |
Definition at line 793 of file DC2156.ino.
|
static |
Enable/Disable Alert Menu.
Definition at line 822 of file DC2156.ino.
|
static |
Enable/Disable Alert in ALERT1 Register.
Definition at line 858 of file DC2156.ino.
|
static |
Definition at line 984 of file DC2156.ino.
|
static |
Read Faults and Clear.
Definition at line 1109 of file DC2156.ino.
|
static |
Toggle Shutdown Down Mode.
Definition at line 1143 of file DC2156.ino.
|
static |
Change Settings.
CTRLA | Local Copy of Configuration in CTRLA Register. |
CTRLB | Local Copy of Configuration in CTRLB Register. |
VOLTAGE_SEL | Local Copy of Voltage Selection Channel. |
GPIO_CFG | Local Copy of GPIO_CFG Register. Allows Configuration of GPIO1 and GPIO2 Pin states. |
GPIO3_CTRL | Local Copy of GPIO3_CTRL Register. Allows Configuration of GPIO3 Pin |
scale | Stores division ratio for resistive divider on ADIN pin. |
Definition at line 1169 of file DC2156.ino.
|
static |
Configure CTRLA Register.
CTRLA | Local Copy of CTRLA Register. |
VOLTAGE_SEL | Local Copy of VOLTAGE_SEL. Indicates which voltage channel has been selected for power measurement. |
Definition at line 1216 of file DC2156.ino.
|
static |
Configure the ADIN reference to GND/INTVCC.
Definition at line 1268 of file DC2156.ino.
|
static |
Configure frequency of offset calibration.
Definition at line 1296 of file DC2156.ino.
|
static |
Select the voltage measurement channel.
CTRLA | Local copy of CTRLA register. |
VOLTAGE_SEL | Voltage selection variable. |
Definition at line 1337 of file DC2156.ino.
|
static |
Select duty cycle of measurments and channel configuration.
CTRLA | Local copy of CTRLA Register |
Definition at line 1378 of file DC2156.ino.
|
static |
Configure CTRLB Register.
CTRLB | Local copy of CTRLB register. |
Definition at line 1440 of file DC2156.ino.
|
static |
Configure GPIO pin States.
GPIO_CFG | Local copy of GPIO_CFG register. |
GPIO3_CTRL | Local copy of GPIO3_CTRL register. |
Definition at line 1582 of file DC2156.ino.
|
static |
Select duty cycle of measurments and channel configuration.
scale | Stores division ratio for resistive divider on ADIN pin. |
Definition at line 1737 of file DC2156.ino.
|
static |
Clear Min/Max.
Definition at line 1753 of file DC2156.ino.
|
static |
Print the Prompt.
Definition at line 245 of file DC2156.ino.
|
static |
Print the title block.
Definition at line 232 of file DC2156.ino.
|
static |
Read the alert settings from EEPROM.
Definition at line 1793 of file DC2156.ino.
|
static |
Initialize Linduino.
Definition at line 146 of file DC2156.ino.
|
static |
Store the alert settings to the EEPROM.
Definition at line 1832 of file DC2156.ino.
#define CONTINUOUS_MODE_DISPLAY_DELAY 2000 |
The delay between readings.
Definition at line 120 of file DC2156.ino.
const char ack_error[] = "Error: No Acknowledge. Check I2C Address." |
Error message.
Definition at line 137 of file DC2156.ino.
|
static |
Value stored or read from ALERT1 register.
Shared between loop() and restore_alert_settings()
Definition at line 141 of file DC2156.ino.
|
static |
Value stored or read from ALERT2 register.
Shared between loop() and restore_alert_settings()
Definition at line 142 of file DC2156.ino.
const float CLK_FREQ = 4E6 |
CLK Frequency.
Definition at line 123 of file DC2156.ino.
|
static |
Set to 1 if the board is connected.
Definition at line 140 of file DC2156.ino.
|
static |
Definition at line 143 of file DC2156.ino.
const float LTC2946_ADIN_DELTA_SENSE_lsb = 1.25061E-08 |
Typical sense lsb weight in V^2 *ADIN_lsb * DELTA_SENSE_lsb.
Definition at line 131 of file DC2156.ino.
const float LTC2946_ADIN_lsb = 5.001221E-04 |
Typical ADIN lsb weight in volts.
Definition at line 127 of file DC2156.ino.
const float LTC2946_DELTA_SENSE_lsb = 2.5006105E-05 |
Typical Delta lsb weight in volts.
Definition at line 128 of file DC2156.ino.
const float LTC2946_INTERNAL_TIME_lsb = 4101.00/250000.00 |
Internal TimeBase lsb.
Use LTC2946_TIME_lsb if an external CLK is used. See Settings menu for how to calculate Time LSB.
Definition at line 132 of file DC2156.ino.
const float LTC2946_Power_lsb = 6.25305E-07 |
Typical POWER lsb weight in V^2 VIN_lsb * DELTA_SENSE_lsb.
Definition at line 130 of file DC2156.ino.
|
static |
Static variable which is based off of the default clk frequency of 250KHz.
Definition at line 134 of file DC2156.ino.
const float LTC2946_VIN_lsb = 2.5006105E-02 |
Typical VIN lsb weight in volts.
Definition at line 129 of file DC2156.ino.
const float resistor = .02 |
resistor value on demo board
Definition at line 122 of file DC2156.ino.