LTC4151 - High Voltage I2C Current and Voltage Monitor

Features

  • Wide Operating Voltage Range: 7V to 80V
  • 12-Bit Resolution for Both Current and Voltages
  • I2C Interface
  • Additional ADC Input Monitors an External Voltage
  • Continuous Scan and Snapshot Modes
  • Shutdown Mode (LTC4151) Reduces Quiescent Current to 120μA
  • Split SDA for Opto-Isolation (LTC4151-1/LTC4151-2)
  • Available in 10-Lead MSOP, 10-Lead 3mm × 3mm DFN and 16-Lead SO Packages

Typical Application

LTC4151 Typical Application
LTC4151 Typical Application

Description

The LTC®4151 is a high side power monitor that operates over a wide voltage range of 7V to 80V. In default operation mode, the onboard 12-bit ADC continuously measures high side current, input voltage and an external voltage. Data is reported through the I2C interface when polled by a host. The LTC4151 can also perform on-demand measurement in a snapshot mode. The LTC4151 features a dedicated shutdown pin to reduce power consumption. The LTC4151‑1/LTC4151-2 feature split I2C data pins to drive opto-isolators. The data out on the LTC4151-1 is inverted while that on the LTC4151-2 is not.

Packaging

For complete and up to date package information and drawings, please refer to our packaging page

MS-10, DFN-10, SO-16

LTC4151 Package Drawing
LTC4151 Package Drawing
LTC4151 Package Drawing
LTC4151 Package Drawing
LTC4151 Package Drawing

Order Info

Package Variations and Pricing

Part Number Package Pins Temp Price (1-99) Price (1k)* RoHS Data
LTC4151CDD#PBF DFN 10 C $4.64 $2.60 View
LTC4151CDD#TRPBF DFN 10 C $2.66 View
LTC4151CDD-1#PBF DFN 10 C $4.64 $2.60 View
LTC4151CDD-1#TRPBF DFN 10 C $2.66 View
LTC4151CMS#PBF MSOP 10 C $4.64 $2.60 View
LTC4151CMS#TRPBF MSOP 10 C $2.66 View
LTC4151CMS-1#PBF MSOP 10 C $4.64 $2.60 View
LTC4151CMS-1#TRPBF MSOP 10 C $2.66 View
LTC4151CS-2#PBF SO 16 C $3.71 $2.60 View
LTC4151CS-2#TRPBF SO 16 C $2.66 View
LTC4151HDD#PBF DFN 10 H $6.36 $3.59 View
LTC4151HDD#TRPBF DFN 10 H $3.65 View
LTC4151HMS#PBF MSOP 10 H $6.36 $3.59 View
LTC4151HMS#TRPBF MSOP 10 H $3.65 View
LTC4151IDD#PBF DFN 10 I $5.57 $3.12 View
LTC4151IDD#TRPBF DFN 10 I $3.18 View
LTC4151IDD-1#PBF DFN 10 I $5.57 $3.12 View
LTC4151IDD-1#TRPBF DFN 10 I $3.18 View
LTC4151IMS#PBF MSOP 10 I $5.57 $3.12 View
LTC4151IMS#TRPBF MSOP 10 I $3.18 View
LTC4151IMS-1#PBF MSOP 10 I $5.57 $3.12 View
LTC4151IMS-1#TRPBF MSOP 10 I $3.18 View
LTC4151IS-2#PBF SO 16 I $4.46 $3.12 View
LTC4151IS-2#TRPBF SO 16 I $3.18 View
Buy NowRequest Samples
* The USA list pricing shown is for BUDGETARY USE ONLY, shown in United States dollars (FOB USA per unit for the stated volume), and is subject to change. International prices may differ due to local duties, taxes, fees and exchange rates. For volume-specific price or delivery quotes, please contact your local Linear Technology sales office or authorized distributor.

Demo Boards

Linear Technology offers many demo boards free of charge to qualified customers. Contact your local sales office or distributor to inquire about a demo board. Certain demo boards are also available for sale via credit card on this website. Demo boards are for evaluation purposes only. It remains the customer’s responsibility to verify proper and reliable operation in the actual end application.

Part Number Description Price Documentation
DC1208A LTC4151 Demo Board | 80V High Side Power Monitor, req. DC2026 $75.00
Buy Now

Companion Boards

Part Number Description Price Documentation
DC2026B Linduino One Isolated Arduino-Compatible Demonstration Board $75.00
Buy Now
Click here to view our complete list of demo boards

Applications

  • –48V Telecom Infrastructure
  • Automotive
  • Industrial
  • Consumer

Product Notifications

Please login to your MyLinear account for notifications of datasheet updates, new document releases and LTspice model announcements for your favorite products. If you do not have a MyLinear account you may Sign Up Now.

Forgot your password? Click here.
Need help? Email mylinear@linear.com with questions and comments.

Design Tools

Linduino

Linduino is an Arduino compatible platform for developing and distributing firmware libraries and code for SPI and I²C-compatible integrated circuits. The Linduino One board interfaces to more than 300 QuikEval demonstration cards, supporting a variety of product types including analog-to-digital converters (ADCs)digital-to-analog converters (DACs)power monitors, and more. Firmware libraries for individual devices are written in C and designed to be portable to a wide variety of processors and microcontrollers. Each library has a demonstration program that can be uploaded to the Linduino One platform to allow the circuit and software to be quickly and easily verified.

Click here for more information on Linduino

Code

Linduino is Linear Technology's Arduino compatible system for developing and distributing firmware libraries and example code for Linear Technology’s integrated circuits. The code below can be downloaded or copied and pasted into your project. Please visit the Linduino Home Page for demo board, manual and setup information.

This part is Code Supported: There is example code available for this part. The code below may rely on other drivers available in the full library.

Download LTC4151 - DC1206A Linduino .INO File

/*!
DC1208A
High Voltage I2C Current and Voltage Monitor

@verbatim

  Setup:
    Set the terminal baud rate to 115200 and select the newline terminator. Refer
    to Demo Manual DC1208A. Ensure all jumpers are installed in the factory default
    positions. A power supply and load resistor are required. A DVM may be used to
    verify displayed voltage results. A precision voltage source (preferably
    low-noise) may be used to apply a voltage to the ADIN pin. For all tests,
    connect power supply between VIN and GND, 7V-75V. Connect a load resistor to
    Vout and GND.

  Command Description:

                             *****Main Menu*****

    1- Read Continuous Mode- If selected, program keeps taking readings every second
       or so. In this mode, the program displays Load Current, VIN Voltage and ADIN
       voltage.

    2- Snapshot Mode- Selecting this option causes display of the Snapshot Mode
       Menu. Readings are taken just once for each Snapshot Mode menu entry.

                    ***** SNAPSHOT MODE MENU COMMANDS *****

      1- Load Current- Selecting this option causes load current to be displayed.

      2- V_IN Voltage- Selecting this option causes VIN voltage to be displayed.

      3- ADIN Voltage- Selecting this option causes the voltage at the ADIN pin to
         be displayed.

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

@endverbatim

REVISION HISTORY
$Revision: 1879 $
$Date: 2013-08-15 08:49:40 -0700 (Thu, 15 Aug 2013) $

Copyright (c) 2013, Linear Technology Corp.(LTC)
All rights reserved.

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

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.
2. 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.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, 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.

The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of Linear Technology Corp.

The Linear Technology Linduino is not affiliated with the official Arduino team.
However, the Linduino is only possible because of the Arduino team's commitment
to the open-source community.  Please, visit http://www.arduino.cc and
http://store.arduino.cc , and consider a purchase that will help fund their
ongoing work.
*/

/*! @file
    @ingroup LTC4151
*/

#include 
#include 
#include "Linduino.h"
#include "LT_I2C.h"
#include "LT_SPI.h"
#include "UserInterface.h"
#include "QuikEval_EEPROM.h"
#include "LTC4151.h"
#include 
#include 

// Function Declaration
void print_title();                                                // Print the title block
void print_prompt();                                               // Print the main menu
int8_t LTC4151_snapshot(uint8_t i2c_address, uint8_t channel);     // Build and send the snapshot command

int8_t menu_1_continuous_mode();                                   // Sub-menu functions
int8_t menu_2_snapshot_mode();

// Global variables
static int8_t demo_board_connected;     //!< Set to 1 if the board is connected

const float resistor = .02;             //!< Sense resistor value

const float LTC4151_sense_lsb = 20e-6;  //!< Typical sense lsb weight in volts
const float LTC4151_vin_lsb = 25e-3;    //!< Typical Vin lsb weight in volts
const float LTC4151_adin_lsb = 0.5;     //!< Typical ADIN lsb weight in mV

//! Initialize Linduino
void setup()
{
  char demo_name[] = "DC1208";    // Demo Board Name stored in QuikEval EEPROM
  quikeval_I2C_init();            //! Initializes Linduino I2C port to 100kHz
  quikeval_I2C_connect();         //! Connects I2C port to the QuikEval connector
  Serial.begin(115200);           //! Initialize the serial port to the PC
  print_title();
  demo_board_connected = discover_demo_board(demo_name);    //! Checks if correct demo board is connected.
  if (demo_board_connected)       // Do nothing if the demo board is not connected
    print_prompt();
}

//! Repeats Linduino loop
void loop()
{
  int8_t ack = 0;
  uint8_t user_command;
  if (demo_board_connected)               //! Does nothing if the demo board is not connected
  {
    if (Serial.available())             // Checks for user input
    {
      user_command = read_int();      //! Reads the user command
      if (user_command != 'm')
        Serial.println(user_command);
      ack = 0;
      switch (user_command)           //! Prints the appropriate submenu
      {
        case 1:
          ack = menu_1_continuous_mode(); // Execute continuous mode
          break;
        case 2:
          ack = menu_2_snapshot_mode();   // Execute snapshot mode
          break;
        default:
          Serial.println("Incorrect Option");
          break;
      }
      if (ack != 0)
        Serial.println("Error: No Acknowledge. Check I2C Address.");
      Serial.println();
      Serial.println("***************************");
      print_prompt();
    }
  }
}

// Function Definitions

//! Prints the title block when program first starts.
void print_title()
{
  Serial.println("");
  Serial.println("*****************************************************************");
  Serial.println("* DC1208 Demonstration Program                                  *");
  Serial.println("*                                                               *");
  Serial.println("* This program communicates with the LTC4151 High Voltage I2C   *");
  Serial.println("* Current and Voltage Monitor found on the DC1208A demo board.  *");
  Serial.println("* Set the baud rate to 115200 and select the newline terminator.*");
  Serial.println("*                                                               *");
  Serial.println("*****************************************************************");
}

//! Prints main menu.
void print_prompt()
{
  Serial.println();
  Serial.println("1-Read Continuous Mode");
  Serial.println("2-Read Snapshot Mode");
  Serial.println();
  Serial.print("Enter a command: ");
}

//! Build and send the snapshot command
//! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
int8_t LTC4151_snapshot(uint8_t i2c_address, //!< I2C address of the LTC4151.
                        uint8_t channel)     //!< Desired channel from the header
{
  int8_t ack = 0;
  ack |= LTC4151_write(i2c_address, LTC4151_CONTROL_REG, LTC4151_CONTINUOUS_MODE);              //! Disable previous snapshot mode to allow a new snapshot
  ack |= LTC4151_write(i2c_address, LTC4151_CONTROL_REG, (channel | LTC4151_SNAPSHOT_MODE));    //! Re-enable snapshot mode on selected channel
  return(ack);
}

//! Reads all inputs in continuous mode
//! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
int8_t menu_1_continuous_mode()
{
  int8_t ack = 0;

  // Read Continuous Mode
  ack |= LTC4151_write(LTC4151_I2C_ADDRESS, LTC4151_CONTROL_REG, LTC4151_CONTINUOUS_MODE);  //! Set LTC4151 to continuous mode
  do
  {
    uint16_t current_sense_adc_code, vin_adc_code, adin_adc_code;

    ack |= LTC4151_read_12_bits(LTC4151_I2C_ADDRESS, LTC4151_SENSE_MSB_REG, ¤t_sense_adc_code);  //! Reads two bytes for SENSE, MSB register followed by LSB register
    ack |= LTC4151_read_12_bits(LTC4151_I2C_ADDRESS, LTC4151_VIN_MSB_REG, &vin_adc_code);              //! Reads two bytes for VIN, MSB register followed by LSB register
    ack |= LTC4151_read_12_bits(LTC4151_I2C_ADDRESS, LTC4151_ADIN_MSB_REG, &adin_adc_code);            //! Reads two bytes for ADIN, MSB register followed by LSB register

    float current, VIN_voltage, ADIN_voltage;
    current = LTC4151_code_to_sense_current(current_sense_adc_code, resistor, LTC4151_sense_lsb);
    VIN_voltage = LTC4151_code_to_vin_voltage(vin_adc_code, LTC4151_vin_lsb);
    ADIN_voltage = LTC4151_code_to_ADIN_voltage(adin_adc_code, LTC4151_adin_lsb);

    //! Display current, VIN voltage, and ADIN Voltage

    Serial.println();
    Serial.println("***************************");
    Serial.print("Load Current: ");
    Serial.print(current);
    Serial.println(" A\n");

    Serial.print("VIN Voltage: ");
    Serial.print(VIN_voltage);
    Serial.println(" V\n");

    Serial.print("ADIN Voltage: ");
    Serial.print(ADIN_voltage);
    Serial.println(" mV\n");

    Serial.println("m-Main Menu");
    delay(2000);
  }
  while (Serial.available() == false); //! Repeats until user enters a character
  read_int();  // Clears Serial.available
  return(ack);
}

//! Reads inputs in snapshot mode
//! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
int8_t menu_2_snapshot_mode()
{
  int8_t ack = 0;
  uint8_t user_command;

  // Snapshot Mode
  do
  {
    //! Displays the Snapshot Mode menu
    Serial.println("***************************");
    Serial.println("Snapshot Mode");
    Serial.println("1-Load Current:");
    Serial.println("2-V_IN Voltage:");
    Serial.println("3-ADIN Voltage:");
    Serial.println("m-Main Menu");
    Serial.print("Enter a command: ");

    user_command = read_int();      //! Reads the user command

    if (user_command == 'm')        // Print m if it is entered
      Serial.println("m");
    else
      Serial.println(user_command); // Print user command
    Serial.println();

    uint16_t current_sense_adc_code, vin_adc_code, adin_adc_code;
    float current, VIN_voltage, ADIN_voltage;

    //! Reads sense resistor current, Vin voltage, or ADIN voltage
    switch (user_command)
    {
      case 1:
        ack |= LTC4151_snapshot(LTC4151_I2C_ADDRESS, LTC4151_SENSE_CHANNEL_REG);
        delay(200); //Wait for conversion to finish.  Could watch busy bit instead to reduce wait time.
        ack |= LTC4151_read_12_bits(LTC4151_I2C_ADDRESS, LTC4151_SENSE_MSB_REG, ¤t_sense_adc_code);
        current = LTC4151_code_to_sense_current(current_sense_adc_code, resistor, LTC4151_sense_lsb);
        Serial.print("Load Current: ");
        Serial.print(current);
        Serial.println(" A\n");
        break;
      case 2:
        ack |=LTC4151_snapshot(LTC4151_I2C_ADDRESS, LTC4151_VIN_CHANNEL_REG);
        delay(100); //Wait for conversion to finish.  Could watch busy bit instead to reduce wait time.
        ack |= LTC4151_read_12_bits(LTC4151_I2C_ADDRESS, LTC4151_VIN_MSB_REG, &vin_adc_code);
        VIN_voltage = LTC4151_code_to_vin_voltage(vin_adc_code, LTC4151_vin_lsb);
        Serial.print("VIN Voltage: ");
        Serial.print(VIN_voltage);
        Serial.println(" V\n");
        break;
      case 3:
        ack |= LTC4151_snapshot(LTC4151_I2C_ADDRESS, LTC4151_ADIN_CHANNEL_REG);
        delay(100); //Wait for conversion to finish.  Could watch busy bit instead to reduce wait time.
        ack |= LTC4151_read_12_bits(LTC4151_I2C_ADDRESS, LTC4151_ADIN_MSB_REG, &adin_adc_code);
        ADIN_voltage = LTC4151_code_to_ADIN_voltage(adin_adc_code, LTC4151_adin_lsb);
        Serial.print("ADIN Voltage: ");
        Serial.print(ADIN_voltage);
        Serial.println(" mV\n");
        break;
      default:
        if (user_command != 'm')
          Serial.println("Incorrect Option");
        break;
    }
    ack = LTC4151_write(LTC4151_I2C_ADDRESS, LTC4151_CONTROL_REG, LTC4151_CONTINUOUS_MODE);  // Disable snapshot mode
  }
  while ((user_command != 'm') && (ack == 0));
  return(ack);
}

Download LTC4151 Linduino .CPP File

/*!
LTC4151: High Voltage I2C Current and Voltage Monitor

@verbatim

The LTC4151 is a high side power monitor that operates over a wide voltage range 
of 7V to 80V. In default operation mode, the onboard 12-bit ADC continuously 
measures high side current, input voltage and an external voltage. Data is 
reported through the I2C interface when polled by a host. The LTC4151 can also 
perform on-demand measurement in a snapshot mode. The LTC4151 features a 
dedicated shutdown pin to reduce power consumption. The LTC4151-1/LTC4151-2 
feature split I2C data pins to drive opto-isolators. The data out on the 
LTC4151-1 is inverted while that on the LTC4151-2 is not. 

@endverbatim

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

http://www.linear.com/product/LTC4151#demoboards

REVISION HISTORY
$Revision: 2040 $
$Date: 2013-10-15 16:18:50 -0700 (Tue, 15 Oct 2013) $

Copyright (c) 2013, Linear Technology Corp.(LTC)
All rights reserved.

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

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.
2. 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.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, 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.

The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of Linear Technology Corp.

The Linear Technology Linduino is not affiliated with the official Arduino team.
However, the Linduino is only possible because of the Arduino team's commitment
to the open-source community.  Please, visit http://www.arduino.cc and
http://store.arduino.cc , and consider a purchase that will help fund their
ongoing work.
*/

//! @defgroup LTC4151 LTC4151: High Voltage I2C Current and Voltage Monitor

/*! @file
    @ingroup LTC4151
    Library for LTC4151: High Voltage I2C Current and Voltage Monitor
*/

#include 
#include "Linduino.h"
#include "LT_I2C.h"
#include "LTC4151.h"
#include 

// Write one byte to an LTC4151 register.
int8_t LTC4151_write(uint8_t i2c_address, uint8_t adc_command, uint8_t code)
{
  int32_t ack;
  
  ack = i2c_write_byte_data(i2c_address, adc_command, code);
  
  return(ack);
}

// Reads a 12-bit value from LTC4151
int8_t LTC4151_read_12_bits(uint8_t i2c_address, uint8_t adc_command, uint16_t *adc_code)
{
  int32_t ack = 0;
  
  ack = i2c_read_word_data(i2c_address, adc_command, adc_code);
  
  *adc_code >>= 4;
  
  return(ack);
}

// Note that the following functions are somewhat contrived, and the units are arbitrary.  LTC4151_ADIN_voltage could be given an LSB
// weight (LTC4151_adin_lsb) in volts instead of mV, and the returned voltage will be in volts instead of mV.
// Similarly, the LTC4151_sense_current function could be written to accept an LSB weight in amps or milliamps.
// That would eliminate the extra floating point divide operation based on the sense resistor value.

// Calculates the LTC4151 sense current in Amps given "resistor" value in ohms and "LTC4151_sense_lsb" LSB weight in volts.
float LTC4151_code_to_sense_current(uint16_t adc_code, float resistor, float LTC4151_sense_lsb)
{
  float voltage, current;
  voltage = (float)adc_code * LTC4151_sense_lsb;    //! 1) Convert code to voltage from sense lsb
  current = voltage / resistor;                     //! 2) Calculate Current, I = V/R
  return (current);
}

// Calculates the LTC4151 V_IN voltage given "LTC_vin_lsb" LSB weight in volts
float LTC4151_code_to_vin_voltage(uint16_t adc_code, float LTC4151_vin_lsb)
{
  float voltage;
  voltage = (float)adc_code * LTC4151_vin_lsb;  //! 1) Convert code to voltage from VIN lsb
  return (voltage);
}

// Calculates the LTC4151 ADIN voltage in mV given "LTC4151_adin_lsb" LSB weight in mV
float LTC4151_code_to_ADIN_voltage(uint16_t adc_code, float LTC4151_adin_lsb)
{
  float voltage;
  voltage = (float)adc_code * LTC4151_adin_lsb; //! 1) Convert Code to voltage from ADIN lsb
  return (voltage);
}

Download LTC4151 Linduino Header File

/*!
LTC4151: High Voltage I2C Current and Voltage Monitor

@verbatim

The LTC4151 is a high side power monitor that operates over a wide voltage 
range of 7V to 80V. In default operation mode, the onboard 12-bit ADC 
continuously measures high side current, input voltage and an external voltage. 
Data is reported through the I2C interface when polled by a host. The LTC4151 
can also perform on-demand measurement in a snapshot mode. The LTC4151 features 
a dedicated shutdown pin to reduce power consumption. The LTC4151-1/LTC4151-2 
feature split I2C data pins to drive opto-isolators. The data out on the 
LTC4151-1 is inverted while that on the LTC4151-2 is not. 

I2C DATA FORMAT (MSB FIRST);

Data Out:

Byte #1                                    Byte #2                       Byte #3
START  SA6 SA5 SA4 SA3 SA2 SA1 SA0 W SACK  X  X  X  X  C3 C2 C1 C0 SACK  D7 D6 D5 D4 D3 D2 D1 D0 SACK  STOP

Data In:

Byte #1                                    Byte #2                                    Byte #3                                                                                                                                 MSB                                       LSB
START  SA6 SA5 SA4 SA3 SA2 SA1 SA0 W SACK  X  X  X  X  C3 C2 C1 C0 SACK REPEAT START  SA6 SA5 SA4 SA3 SA2 SA1 SA0 R SACK

Byte #4                                   Byte #5
D15 D14  D13  D12  D11  D10  D0 D8 MACK   D7 D6 D5 D4 D3  D2  D1  D0  MNACK  STOP

START        : I2C Start
REPEAT START : I2C Repeat Start
STOP         : I2C Stop
SACK         : I2C Slave Generated Acknowledge (Active Low)
MACK         : I2C Master Generated Acknowledge (Active Low)
MNACK        : I2C Master Generated Not Acknowledge
SAx  : I2C Address
W    : I2C Write (0)
R    : I2C Read  (1)
Cx   : Command Code
Dx   : Data Bits
X    : Don't care



Example Code:


@endverbatim

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

http://www.linear.com/product/LTC4151#demoboards

REVISION HISTORY
$Revision: 1876 $
$Date: 2013-08-14 14:43:26 -0700 (Wed, 14 Aug 2013) $

Copyright (c) 2013, Linear Technology Corp.(LTC)
All rights reserved.

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

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.
2. 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.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, 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.

The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of Linear Technology Corp.

The Linear Technology Linduino is not affiliated with the official Arduino team.
However, the Linduino is only possible because of the Arduino team's commitment
to the open-source community.  Please, visit http://www.arduino.cc and
http://store.arduino.cc , and consider a purchase that will help fund their
ongoing work.
*/

/*! @file
    @ingroup LTC4151
    Library Header File for LTC4151: High Voltage I2C Current and Voltage Monitor
*/

#ifndef LTC4151_H
#define LTC4151_H

#include 

//! Address Choices:
//! To choose an address, comment out all options except the
//! configuration on the demo board.

/*!
| LTC4151 I2C Address | Value      |   AD1    |   AD2    |
| :------------------ | :------:   | :------: | :------: |
| LTC4151_I2C_ADDRESS | 0x67       |   High   |   Low    |
| LTC4151_I2C_ADDRESS | 0x68       |  Float   |  High    |
| LTC4151_I2C_ADDRESS | 0x69       |  High    |  High    |
| LTC4151_I2C_ADDRESS | 0x6A       |  Float   |  Float   |
| LTC4151_I2C_ADDRESS | 0x6B       |  Float   |  Low     |
| LTC4151_I2C_ADDRESS | 0x6C       |  Low     |  High    |
| LTC4151_I2C_ADDRESS | 0x6D       |  High    |  Float   |
| LTC4151_I2C_ADDRESS | 0x6E       |  Low     |  Float   |
| LTC4151_I2C_ADDRESS | 0x6F       |  Low     |  Low     |
| LTC4151_I2C_GLOBAL_ADDRESS | 0x66 |  X      |  X       |
*/

/*! @name I2C_Addresses
@{ */

// Address assignment
// LTC4151 I2C Address                 //  AD1       AD0
// #define LTC4151_I2C_ADDRESS 0x67    //  High      Low
// #define LTC4151_I2C_ADDRESS 0x68    //  Float     High
// #define LTC4151_I2C_ADDRESS 0x69    //  High      High
// #define LTC4151_I2C_ADDRESS 0x6A    //  Float     Float
// #define LTC4151_I2C_ADDRESS 0x6B    //  Float     Low
// #define LTC4151_I2C_ADDRESS 0x6C    //  Low       High
// #define LTC4151_I2C_ADDRESS 0x6D    //  High      Float
// #define LTC4151_I2C_ADDRESS 0x6E    //  Low       Float
#define LTC4151_I2C_ADDRESS 0x6F      //  Low       Low

// LTC4151 Global I2C Address.
// #define LTC4151_I2C_GLOBAL_ADDRESS 0x66  //  Global Address

//! @} */

//! Note: Register 0x07 is Reserved.
/*!
| Registers                 |   Location    | Descrition                                |
| :------------------------ | :-----------: | :---------------------------------------- |
| LTC4151_SENSE_MSB_REG     | 0x00          | ADC Current Sense Voltage Data (8 MSB)    |
| LTC4151_SENSE_LSB_REG     | 0x01          | ADC Current Sense Voltage Data (4 LSB)    |
| LTC4151_VIN_MSB_REG       | 0x02          | ADC V_IN Voltage Data (8 MSB)             |
| LTC4151_VIN_LSB_REG       | 0x03          | ADC V_IN Voltage Data (4 LSB)             |
| LTC4151_ADIN_MSB_REG      | 0x04          | ADC ADIN Voltage Data (8 MSB)             |
| LTC4151_ADIN_LSB_REG      | 0x05          | ADC ADIN Voltage Data (4 LSB)             |
| LTC4151_CONTROL_REG       | 0x06          | Controls ADC Operation Mode and Test Mode |

*/

/*! @name REGISTERS
@{ */
// Registers
#define LTC4151_SENSE_MSB_REG       0x00  // ADC Current Sense Voltage Data (8 MSB)
#define LTC4151_SENSE_LSB_REG       0x01  // ADC Current Sense Voltage Data (4 LSB)
#define LTC4151_VIN_MSB_REG         0x02  // ADC V_IN Voltage Data (8 MSB) 
#define LTC4151_VIN_LSB_REG         0x03  // ADC V_IN Voltage Data (4 LSB)
#define LTC4151_ADIN_MSB_REG        0x04  // ADC ADIN Voltage Data (8 MSB)
#define LTC4151_ADIN_LSB_REG        0x05  // ADC ADIN Voltage Data (4 LSB)
#define LTC4151_CONTROL_REG         0x06  // Controls ADC Operation Mode and Test Mode
//!@} */

//! Bitwise AND  with channel register, and write to LTC4151_CONTROL_REG.
/*!
| Commands and Channel Registers    |   Value   |   Descrition                          |
| :----------------------------     |   :---:   |   :---------                          |
| LTC4151_CONTINUOUS_MODE           |   0x00    |   Sets LTC4151 in Continuous Mode     |
| LTC4151_SNAPSHOT_MODE             |   0x80    |   Sets LTC4151 in Snapshot Mode       |
| LTC4151_SENSE_CHANNEL_REG         |   0x00    |   ADC Sense Channel For Snapshot Mode |
| LTC4151_VIN_CHANNEL_REG           |   0x20    |   DC V_IN Channel For Snapshot Mode   |
| LTC4151_ADIN_CHANNEL_REG          |   0x40    |   ADC ADIN Channel For Snapshot Mode  |
*/

/*! @name LTC4151 Commands
@{ */

#define LTC4151_SENSE_CHANNEL_REG   0x00  // ADC Sense Channel For Snapshot Mode
#define LTC4151_VIN_CHANNEL_REG     0x20  // ADC V_IN Channel For Snapshot Mode
#define LTC4151_ADIN_CHANNEL_REG    0x40  // ADC ADIN Channel For Snapshot Mode

#define LTC4151_CONTINUOUS_MODE 0x00
#define LTC4151_SNAPSHOT_MODE   0x80
//! @} */

//! Write one byte to an LTC4151 register.
//! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
int8_t LTC4151_write(uint8_t i2c_address,   //!< I2C address of the LTC4151. Configured by tying the ADR0 and ADR1 pins high or low. See Table 1 of datasheet.
                     uint8_t adc_command,   //!< The "command byte" for the LTC4151.
                     uint8_t code           //!< Value that will be written to the register.
                    );

//! Reads a 12-bit value from LTC4151
//! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
int8_t LTC4151_read_12_bits(uint8_t i2c_address,    //!< I2C address of the LTC4151. Configured by tying the ADR0 and ADR1 pins high or low. See Table 1 of datasheet.
                            uint8_t adc_command,    //!< The "command byte" for the LTC4151.
                            uint16_t *adc_code      //!< Returns 12-bit value read from the adc
                           );

//! Calculates the LTC4151 sense current in Amps given "resistor" value in ohms and "LTC4151_sense_lsb" LSB weight in volts.
//! @return Returns the current in Amperes.
float LTC4151_code_to_sense_current(uint16_t adc_code,      //!< Code read from the adc (from a function such as LTC4151_read_12_bits)
                                    float resistor,         //!< The sense resistor value
                                    float LTC4151_sense_lsb //!< Current LSB weight.
                                   );

//! Calculates the LTC4151 V_IN voltage given "LTC_vin_lsb" LSB weight in volts
//! @return the V_IN voltage in volts.
float LTC4151_code_to_vin_voltage(uint16_t adc_code,        //!< Code read from the adc (from a function such as LTC4151_read_12_bits)
                                  float LTC4151_vin_lsb     //!< Voltage LSB weight.
                                 );

//! Calculates the LTC4151 ADIN voltage in mV given "LTC4151_adin_lsb" LSB weight in mV
//! @return the ADIN voltage in volts.
float LTC4151_code_to_ADIN_voltage(uint16_t adc_code,       //!< Code read from the adc (from a function such as LTC4151_read_12_bits)
                                   float LTC4151_adin_lsb   //!< ADIN voltage LSB weight.
                                  );

#endif  // LTC4151_H

Technical Support