LTC2642 - 16-/14-/12-Bit VOUT DACs in 3mm × 3mm DFN

Features

  • Tiny 3mm × 3mm 8-Pin DFN Package
  • Maximum 16-Bit INL Error: ±1LSB over Temperature
  • Low 120µA Supply Current
  • Guaranteed Monotonic over Temperature
  • Low 0.5nV•sec Glitch Impulse
  • 2.7V to 5.5V Single Supply Operation
  • Fast 1µs Settling Time to 16 Bits
  • Unbuffered Voltage Output Directly Drives 60k Loads
  • 50MHz SPI™/QSPI™/MICROWIRE™ Compatible Serial Interface
  • Power-On Reset Clears DAC Output to Zero Scale(LTC2641) or Midscale (LTC2642)
  • Schmitt-Trigger Inputs for Direct Optocoupler Interface
  • Asynchronous CLR Pin
  • 8-Lead MSOP, 3mm × 3mm DFN, and 8-Lead SO
    Packages (LTC2641)
  • 10-Lead MSOP and 3mm × 3mm DFN Packages(LTC2642)

Typical Application

LTC2642 Typical Application
LTC2642 Typical Application

Description

The LTC2641/LTC2642 are families of 16-, 14- and 12-bit unbuffered voltage output DACs. These DACs operate from a single 2.7V to 5.5V supply and are guaranteed monotonic over temperature. The LTC2641A-16/LTC2642A-16 provide 16-bit performance (±1LSB INL and ±1LSB DNL) over temperature. Unbuffered DAC outputs result in low supply current of 120µA and a low offset error of ±1LSB.

Both the LTC2641 and LTC2642 feature a reference input range of 2V to VDD. VOUT swings from 0V to VREF. For bipolar operation, the LTC2642 includes matched scaling resistors for use with an external precision op amp (such as the LT1678), generating a ±VREF output swing at RFB.

The LTC2641/LTC2642 use a simple SPI/MICROWIRE compatible 3-wire serial interface which can be operated at clock rates up to 50MHz and can interface directly with optocouplers for applications requiring isolation. A power-on reset circuit clears the LTC2641’s DAC output to zero scale and the LTC2642’s DAC output to midscale when power is initially applied. A logic low on the CLR pin asynchronously clears the DAC to zero scale (LTC2641) or midscale (LTC2642). These DACs are all specified over the commercial and industrial ranges.

Packaging

CAD Symbols and Footprints: The downloadable Zip file below contains the schematic symbol and PCB footprints.

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

Part Number Package Code Temp Package
Drawing
RoHS
LTC2642ACDD-16#PBF 3x3 DFN-10 DD C 05-08-1699 Yes
LTC2642ACDD-16#TRPBF 3x3 DFN-10 DD C 05-08-1699 Yes
LTC2642ACMS-16#PBF MS-10 MS C 05-08-1661 Yes
LTC2642ACMS-16#TRPBF MS-10 MS C 05-08-1661 Yes
LTC2642AIDD-16#PBF 3x3 DFN-10 DD I 05-08-1699 Yes
LTC2642AIDD-16#TRPBF 3x3 DFN-10 DD I 05-08-1699 Yes
LTC2642AIMS-16#PBF MS-10 MS I 05-08-1661 Yes
LTC2642AIMS-16#TRPBF MS-10 MS I 05-08-1661 Yes
LTC2642CDD-12#PBF 3x3 DFN-10 DD C 05-08-1699 Yes
LTC2642CDD-12#TRPBF 3x3 DFN-10 DD C 05-08-1699 Yes
LTC2642CDD-14#PBF 3x3 DFN-10 DD C 05-08-1699 Yes
LTC2642CDD-14#TRPBF 3x3 DFN-10 DD C 05-08-1699 Yes
LTC2642CDD-16#PBF 3x3 DFN-10 DD C 05-08-1699 Yes
LTC2642CDD-16#TRPBF 3x3 DFN-10 DD C 05-08-1699 Yes
LTC2642CMS-12#PBF MS-10 MS C 05-08-1661 Yes
LTC2642CMS-12#TRPBF MS-10 MS C 05-08-1661 Yes
LTC2642CMS-14#PBF MS-10 MS C 05-08-1661 Yes
LTC2642CMS-14#TRPBF MS-10 MS C 05-08-1661 Yes
LTC2642CMS-16#PBF MS-10 MS C 05-08-1661 Yes
LTC2642CMS-16#TRPBF MS-10 MS C 05-08-1661 Yes
LTC2642IDD-12#PBF 3x3 DFN-10 DD I 05-08-1699 Yes
LTC2642IDD-12#TRPBF 3x3 DFN-10 DD I 05-08-1699 Yes
LTC2642IDD-14#PBF 3x3 DFN-10 DD I 05-08-1699 Yes
LTC2642IDD-14#TRPBF 3x3 DFN-10 DD I 05-08-1699 Yes
LTC2642IDD-16#PBF 3x3 DFN-10 DD I 05-08-1699 Yes
LTC2642IDD-16#TRPBF 3x3 DFN-10 DD I 05-08-1699 Yes
LTC2642IMS-12#PBF MS-10 MS I 05-08-1661 Yes
LTC2642IMS-12#TRPBF MS-10 MS I 05-08-1661 Yes
LTC2642IMS-14#PBF MS-10 MS I 05-08-1661 Yes
LTC2642IMS-14#TRPBF MS-10 MS I 05-08-1661 Yes
LTC2642IMS-16#PBF MS-10 MS I 05-08-1661 Yes
LTC2642IMS-16#TRPBF MS-10 MS I 05-08-1661 Yes


LTC2642 Package Drawing
LTC2642 Package Drawing
LTC2642 Package Drawing
LTC2642 Package Drawing
LTC2642 Package Drawing

Order Info

  • Part numbers ending in PBF are lead free. Solder plated terminal finish (SnPb) versions are non-standard and special terms and conditions and pricing applies if available. Please contact LTC marketing for information.
  • Part numbers containing TR or TRM are shipped in tape and reel or 500 unit mini tape and reel, respectively
  • Please refer to our general ordering information or the product datasheet for more details

Package Variations and Pricing

Part Number Package Temp Price
(1-99)
Price
(1k)*
RoHS
LTC2642ACDD-16#PBF 3x3 DFN-10 C $11.79 $8.25 Yes
LTC2642ACDD-16#TRPBF 3x3 DFN-10 C $8.31 Yes
LTC2642ACMS-16#PBF MS-10 C $11.79 $8.25 Yes
LTC2642ACMS-16#TRPBF MS-10 C $8.31 Yes
LTC2642AIDD-16#PBF 3x3 DFN-10 I $14.14 $9.90 Yes
LTC2642AIDD-16#TRPBF 3x3 DFN-10 I $9.96 Yes
LTC2642AIMS-16#PBF MS-10 I $14.14 $9.90 Yes
LTC2642AIMS-16#TRPBF MS-10 I $9.96 Yes
LTC2642CDD-12#PBF 3x3 DFN-10 C $4.32 $2.95 Yes
LTC2642CDD-12#TRPBF 3x3 DFN-10 C $3.01 Yes
LTC2642CDD-14#PBF 3x3 DFN-10 C $7.94 $5.42 Yes
LTC2642CDD-14#TRPBF 3x3 DFN-10 C $5.48 Yes
LTC2642CDD-16#PBF 3x3 DFN-10 C $9.15 $6.25 Yes
LTC2642CDD-16#TRPBF 3x3 DFN-10 C $6.31 Yes
LTC2642CMS-12#PBF MS-10 C $4.32 $2.95 Yes
LTC2642CMS-12#TRPBF MS-10 C $3.01 Yes
LTC2642CMS-14#PBF MS-10 C $7.94 $5.42 Yes
LTC2642CMS-14#TRPBF MS-10 C $5.48 Yes
LTC2642CMS-16#PBF MS-10 C $9.15 $6.25 Yes
LTC2642CMS-16#TRPBF MS-10 C $6.31 Yes
LTC2642IDD-12#PBF 3x3 DFN-10 I $5.18 $3.54 Yes
LTC2642IDD-12#TRPBF 3x3 DFN-10 I $3.60 Yes
LTC2642IDD-14#PBF 3x3 DFN-10 I $9.52 $6.50 Yes
LTC2642IDD-14#TRPBF 3x3 DFN-10 I $6.56 Yes
LTC2642IDD-16#PBF 3x3 DFN-10 I $10.98 $7.50 Yes
LTC2642IDD-16#TRPBF 3x3 DFN-10 I $7.56 Yes
LTC2642IMS-12#PBF MS-10 I $5.18 $3.54 Yes
LTC2642IMS-12#TRPBF MS-10 I $3.60 Yes
LTC2642IMS-14#PBF MS-10 I $9.52 $6.50 Yes
LTC2642IMS-14#TRPBF MS-10 I $6.56 Yes
LTC2642IMS-16#PBF MS-10 I $10.98 $7.50 Yes
LTC2642IMS-16#TRPBF MS-10 I $7.56 Yes
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
DC1096B LTC2642A-16 (LTC2641A-16) 16-bit +/-5V Unbuffered Vout DAC (req DC590B) $75.00
Buy Now

Companion Boards

Part Number Description Price Documentation
DC2026C Linduino One Isolated USB Demo Board: An Arduino- and QuikEval-Compatible Code Development Platform $75.00
DC590B Isolated USB Serial Controller for Linear Technology QuikEval-Compatible Demo Boards $50.00
Buy Now
Click here to view our complete list of demo boards

Applications

  • High Resolution Offset and Gain Adjustment
  • Process Control and Industrial Automation
  • Automatic Test Equipment
  • Data Aquisition Systems

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

LTspice

LTspice® software is a powerful, fast and free simulation tool, schematic capture and waveform viewer with enhancements and models for improving the simulation of switching regulators. Click here to download LTspice

Models for the following parts are available in LTspice:
LTC2642-12
LTC2642-14
LTC2642-16

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 LTC2642 - DC1096B Linduino.INO File

/*!
Linear Technology DC1096B Demonstration Board.
LTC2642: 16-/14-/12-Bit VOUT DAC with SPI Interface

LTC2641: 16-/14-/12-Bit VOUT DAC with SPI Interface
@verbatim

NOTES

  Set the terminal baud rate to 115200 and select the newline terminator.
  No external power supply is required. Two on-board reference voltages of
  2.5V and 5V are available. The board features LTC2642A with direct and
  buffered output.

  The program displays calculated voltages which are based on the reference
  voltage used. A precision voltmeter is needed to verify the actual
  measured voltages against the calculated voltage displayed.

  There is also an option of generating a square wave of required voltage
  levels and frequency. This proves the fast settling time of the corresponding
  parts. Setting the software to unipolar or bipolar will not set the hardware
  to bipolar mode. The jumpers need to be placed in their proper positions in
  order to accomplish this.

  Jumper settings:
   JP3: Sets DAC2 to either unipolar or bipolar mode. In bipolar mode, set JP6
   and JP7 to EXT and apply an appropriate supply to AMP V+, AMP V–, and GND
   turret posts.

   JP4: Sets DAC3 to either unipolar or bipolar mode. In bipolar mode, set JP6
   and JP7 to EXT and apply an appropriate supply to AMP V+, AMP V–, and GND
   turret posts.

  Explanation of Commands:
   Option 1: Enter a digital value or voltage to obtain analog voltage output.
   Option 2: Enter the voltage levels to obtain a square wave.
   Option 3: Vary the reference voltage used.
   Option 4: Select Bipolar/Unipolar.

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

@endverbatim

http://www.linear.com/product/LTC2642
http://www.linear.com/product/LTC2641

http://www.linear.com/product/LTC2642#demoboards
http://www.linear.com/product/LTC2641#demoboards

REVISION HISTORY
$Revision: 6881 $
$Date: 2017-04-05 15:39:18 -0700 (Wed, 05 Apr 2017) $

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 LTC2642
*/

// Headerfiles
#include <Arduino.h>
#include <stdint.h>
#include <SPI.h>
#include "LT_SPI.h"
#include "LT_I2C.h"
#include "Linduino.h"
#include "QuikEval_EEPROM.h"
#include "UserInterface.h"
#include "LTC2642.h"

// Macros
#define VREF1 5.0
#define VREF2 2.5

// Global Variables
float reference_voltage = VREF1;   // Set the reference voltage
uint8_t range = UNIPOLAR; // set to unipolar

// Function Declarations
void print_title();
void print_prompt();
uint8_t menu1_voltage_output();
uint8_t menu2_square_wave_output();
void menu3_change_reference_voltage();
void menu4_select_range();

//! Used to choose between voltage and code
enum
{
  PROMPT_VOLTAGE = 0, /**< 0 */
  PROMPT_CODE = 1     /**< 1 */
};

//! Initialize Linduino
void setup()
{
  uint8_t demo_board_connected;

  char demo_name[] = "DC1096";           // Demo Board Name stored in QuikEval EEPROM
  output_high(LTC2642_CS);                //! Pulls LTC2642 Chip Select (LD pin) High

  quikeval_I2C_init();                    //! Initializes Linduino I2C port.

  quikeval_SPI_init();                    //! Configures the SPI port for 4MHz SCK
  quikeval_SPI_connect();                 //! Connects SPI to QuikEval port

  Serial.begin(115200);                   //! Initializes the serial port to the PC
  print_title();                          //! Displays the title

  demo_board_connected = discover_demo_board(demo_name); //! Checks if correct demo board is connected.
  if (demo_board_connected)               //! Prints the prompt if the correct demo board is connected
  {
    print_prompt();                       // Prints prompt and indicates that "A" is selected.
  }
}

//! Repeats Linduino loop
void loop()
{
  int8_t user_command;                // The user input command
  uint8_t acknowledge = 0;
  if (Serial.available())             // Check for user input
  {
    user_command = read_int();        // Read the user command
    if (user_command != 'm')
      Serial.println(user_command);   // Prints the user command to com port
    Serial.flush();
    switch (user_command)
    {
      case 1:
        acknowledge |= menu1_voltage_output();
        break;
      case 2:
        acknowledge |= menu2_square_wave_output();
        break;
      case 3:
        menu3_change_reference_voltage();
        break;
      case 4:
        menu4_select_range();
        break;
      default:
        Serial.println(F("Incorrect Option"));
    }
    if (acknowledge)
      Serial.println(F("***** I2C ERROR *****"));
    print_prompt();
  }
}

//! Function to enter a digital value and get the analog output
uint8_t menu1_voltage_output()
{
  uint16_t dac_code;
  float voltage;
  if (prompt_voltage_or_code() == PROMPT_VOLTAGE)
    dac_code = get_voltage();
  else
    dac_code = get_code();

  LTC2642_write(QUIKEVAL_CS, dac_code);
  voltage = LTC2642_code_to_voltage(dac_code, reference_voltage, range);
  Serial.print("\nDac Code = 0x");
  Serial.print(dac_code, HEX);
  Serial.print("\nOutput voltage = ");
  Serial.print(voltage, 3);
  Serial.print(" V");
  return 0;
}

//! Function to generate a square wave of desired frequency and voltage ranges
uint8_t menu2_square_wave_output()
{
  float voltage_high, voltage_low;
  uint16_t code_high, code_low;
  //uint8_t receive_enter;  // To receive enter key pressed

  Serial.print("\nEnter voltage_high: ");
  while (!Serial.available());
  voltage_high = read_float();
  Serial.print(voltage_high);
  Serial.println(" V");

  Serial.print("Enter voltage_low: ");
  while (!Serial.available());
  voltage_low = read_float();
  Serial.print(voltage_low);
  Serial.println(" V");

  //! Converting data into voltage
  code_high = LTC2642_voltage_to_code(voltage_high, reference_voltage, range);
  code_low = LTC2642_voltage_to_code(voltage_low, reference_voltage, range);

  Serial.print(F("Enter any character to stop. "));
  while (!Serial.available()) //! Generate square wave until a key is pressed
  {
    LTC2642_write(LTC2642_CS, code_high);
    delay(30);  // 30 ms delay
    LTC2642_write(LTC2642_CS, code_low);
    delay(30);  // 30 ms delay
  }
  read_int();
  return 0;
}

//! Function to change the reference voltage to be used
void menu3_change_reference_voltage()
{
  Serial.print(F("\nEnter the reference voltage: "));
  reference_voltage = read_float();
  Serial.print(reference_voltage);
  Serial.print(F(" V"));
}

//! Select between unipolar/bipolar
void menu4_select_range()
{
  uint8_t choice;
  Serial.print("\nEnter your choice (1 - Unipolar, 2 - Bipolar): ");
  choice = read_int();
  Serial.print(choice);

  if (choice == 1)
  {
    range = UNIPOLAR;
    Serial.print(F("\nSet jumpers JP3 and JP4 to UNI."));
  }
  else
  {
    range = BIPOLAR;
    Serial.print(F("\nSet jumpers JP3 and JP4 to BIP."));
    Serial.print(F("\nIn bipolar mode, set JP6 and JP7 to EXT and apply an appropriate supply"));
    Serial.print(F("\nto AMP V+, AMP V–, and GND turret posts."));
  }
}

//! Prompt user to enter a voltage or digital code to send to DAC
int16_t prompt_voltage_or_code()
{
  int16_t user_input;
  Serial.print(F("\nType 1 to enter voltage, 2 to enter code:"));
  Serial.flush();
  user_input = read_int();
  Serial.println(user_input);

  if (user_input != 2)
    return(PROMPT_VOLTAGE);
  else
    return(PROMPT_CODE);
}

//! Get voltage from user input, calculate DAC code based on lsb, offset
uint16_t get_voltage()
{
  float dac_voltage;

  Serial.print(F("Enter Desired DAC output voltage: "));
  dac_voltage = read_float();
  Serial.print(dac_voltage, 3);
  Serial.println(" V");
  Serial.flush();
  return(LTC2642_voltage_to_code(dac_voltage, reference_voltage, range));
}

//! Get code to send to DAC directly, in decimal, hex, or binary
uint16_t get_code()
{
  uint16_t returncode;
  Serial.println("Enter Desired DAC Code");
  Serial.print("(Format 32768, 0x8000, 0100000, or B1000000000000000): ");
  returncode = (uint16_t) read_int();
  Serial.print("0x");
  Serial.println(returncode, HEX);
  Serial.flush();
  return(returncode);
}


//! Prints the title block when program first starts.
void print_title()
{
  Serial.print(F("\n*****************************************************************\n"));
  Serial.print(F("* DC1096B Demonstration Program                                 *\n"));
  Serial.print(F("*                                                               *\n"));
  Serial.print(F("* This program demonstrates how to send data to the 16-bit DAC. *\n"));
  Serial.print(F("* Set the baud rate to 115200 and select the newline terminator.*\n"));
  Serial.print(F("*                                                               *\n"));
  Serial.print(F("*****************************************************************\n"));
}

//! Prints main menu.
void print_prompt()
{
  Serial.print(F("\n*****************************************************************\n"));
  Serial.print(F("\nSelected Range: "));
  if (range == UNIPOLAR)
    Serial.print(F("Unipolar"));
  else
    Serial.print(F("Bipolar"));
  Serial.print(F("\nSelected Reference Voltage: "));
  Serial.print(reference_voltage);
  Serial.print(F(" V"));

  Serial.print(F("\n\nMenu:"));
  Serial.print(F("\n  1 - Set output\n"));
  Serial.print(F("  2 - Square Wave output\n"));
  Serial.print(F("  3 - Set Reference Voltage\n"));
  Serial.print(F("  4 - Select Unipolar/Bipolar\n"));
  Serial.print(F("Enter a command: "));
}

Download LTC2642 Linduino Header File

/*!
LTC2642: 16-/14-/12-Bit VOUT DAC with SPI Interface
LTC2641: 16-/14-/12-Bit VOUT DAC with SPI Interface

@verbatim

The LTC2641/LTC2642 are families of 16-,14 and 12-bit unbuffered voltage output
DACs. These DACs operate from 2.7V to 5.5V supply and are monotonic over
temperature.

They communicate via SPI interface. 16 bits of data are loaded through DIN
after a high-to-low transition of CS (MSB first). After 16 data bits have
been loaded into the serial input register, a low-to-high transition on CS
transfers the data to the 16-bit DAC latch, updating the DAC output.

For the 14-bit DACs, (LTC2641-14/LTC2642-14), the MSB remains in the same
(left-justified) position in the input 16-bit data word. Therefore, two
“don’t-care” bits must be loaded after the LSB, to make up the required
16 data bits. Similarly, for the 12-bit family members(LTC2641-12/LTC2642-12)
four “don’t-care” bits must follow the LSB.

@endverbatim

http://www.linear.com/product/LTC2642
http://www.linear.com/product/LTC2641

http://www.linear.com/product/LTC2642#demoboards
http://www.linear.com/product/LTC2641#demoboards

REVISION HISTORY
$Revision: 6880 $
$Date: 2017-04-05 15:34:50 -0700 (Wed, 05 Apr 2017) $

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 LTC2642
    Header for LTC2642: 16-/14-/12-Bit VOUT DAC with SPI Interface
*/

#ifndef LTC2642_H
#define LTC2642_H

//! Define the SPI CS pin
#ifndef LTC2642_CS
#define LTC2642_CS QUIKEVAL_CS
#endif

#define UNIPOLAR  1
#define BIPOLAR   2

//! Writes the 16-bit data into the DAC
//! @return void
void LTC2642_write(uint8_t cs,            //!< Chip Select Pin
                   uint16_t data          //!< 16-bit digital input data
                  );
//! Calculates the output voltage from the given digital code and reference voltage
//! @return Floating point voltage
float LTC2642_code_to_voltage(uint16_t data,    //!< 16-bit digital input data
                              float reference_voltage,      //!< Reference voltage
                              uint8_t range  //!< Unipolar/Bipolar
                             );
//! Calculates the 16 bit data code from voltage
//! @return 16-bit code
uint16_t LTC2642_voltage_to_code(float voltage,   //!< Analog voltage to be converted into code
                                 float reference_voltage,     //!< Reference Voltage
                                 uint8_t range  //!< Unipolar/Bipolar
                                );
#endif      //LTC2642_H

Download LTC2642 Linduino.CPP

/*!
LTC2642: 16-/14-/12-Bit VOUT DAC with SPI Interface
LTC2641: 16-/14-/12-Bit VOUT DAC with SPI Interface

@verbatim

The LTC2641/LTC2642 are families of 16-,14 and 12-bit unbuffered voltage output
DACs. These DACs operate from 2.7V to 5.5V supply and are monotonic over
temperature.

Both the LTC2641 and LTC2642 feature a reference input range of 2V to VDD. VOUT
swings from 0V to VREF . For bipolar operation, the LTC2642 includes matched scaling
resistors for use with an external precision op amp (such as the LT1678), generating
a ±VREF output swing at RFB.

They communicate via SPI interface. 16 bits of data are loaded through DIN
after a high-to-low transition of CS (MSB first). After 16 data bits have
been loaded into the serial input register, a low-to-high transition on CS
transfers the data to the 16-bit DAC latch, updating the DAC output.

For the 14-bit DACs, (LTC2641-14/LTC2642-14), the MSB remains in the same
(left-justified) position in the input 16-bit data word. Therefore, two
“don’t-care” bits must be loaded after the LSB, to make up the required
16 data bits. Similarly, for the 12-bit family members(LTC2641-12/LTC2642-12)
four “don’t-care” bits must follow the LSB.

@endverbatim

http://www.linear.com/product/LTC2642
http://www.linear.com/product/LTC2641

http://www.linear.com/product/LTC2642#demoboards
http://www.linear.com/product/LTC2641#demoboards

REVISION HISTORY
$Revision: 6880 $
$Date: 2017-04-05 15:34:50 -0700 (Wed, 05 Apr 2017) $

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.
*/

//! @ingroup Digital_to_Analog_Converters
//! @{
//! @defgroup LTC2642 LTC2642: 16-/14-/12-Bit VOUT DAC with SPI Interface
//! @}

/*! @file
    @ingroup LTC2642
    Library for LTC2642 16-/14-/12-Bit VOUT DAC with SPI Interface
*/

#include <SPI.h>
#include "LT_SPI.h"
#include "Linduino.h"
#include "LTC2642.h"

// Writes 16 bit data into serial input register
void LTC2642_write(uint8_t cs, uint16_t data)
{
  uint16_t rx;
  spi_transfer_word(cs, data, &rx);
}

// Calculates the 16 bit data code from voltage
uint16_t LTC2642_voltage_to_code(float voltage, float reference_voltage, uint8_t range)
{
  uint16_t code;
  if (range == UNIPOLAR)
  {
    code = voltage / reference_voltage * 0xFFFF ;
  }
  else
  {
    code = (voltage * 0x7FFF)/reference_voltage + 0x7FFF;
  }
  return code;
}

// Calculates the output voltage from the given digital code and reference voltage
float LTC2642_code_to_voltage(uint16_t code, float reference_voltage, uint8_t range)
{
  float voltage;
  if (range == UNIPOLAR)
  {
    voltage = code * reference_voltage / 0xFFFF ;
  }
  else
  {
    code = (int16_t)code;
    voltage = (((float)code/0x7FFF) - 1) * reference_voltage;
  }
  return voltage;
}

Technical Support