LTC1592 - 16-Bit SoftSpan DACs with Programmable Output Range

Features

  • Six Programmable Output Ranges
    Unipolar Mode: 0V to 5V, 0V to 10V
    Bipolar Mode: ±5V, ±10V, ±2.5V,
    –2.5V to 7.5V
  • 1LSB Max DNL and INL Over the Industrial Temperature Range
  • Glitch Impulse < 2nV-s
  • 16-Lead SSOP Package
  • Power-On Reset to 0V
  • Asynchronous Clear to 0V for All Ranges

Typical Application

LTC1592 Typical Application
LTC1592 Typical Application

Description

The LTC1588/LTC1589/LTC1592 are serial input 12-/14- /16-bit multiplying current output DACs that operates from a single 5V supply. These SoftSpan DACs can be software-programmed for either unipolar or bipolar mode through a 3-wire SPI interface. In either mode, the voltage output range can also be software-programmed. Two output ranges in unipolar mode and four output ranges in bipolar mode are available.

INL and DNL are accurate to 1LSB over the industrial temperature range in both unipolar and bipolar modes. True 16-bit 4-quadrant multiplication is achieved with on-chip four quadrant multiplication resistors. The LTC1588/LTC1589/LTC1592 are available in a 16-lead SSOP package.

These devices include an internal deglitcher circuit that reduces the glitch impulse to less than 2nV-s (typ).

The asynchronous clear pin resets the LTC1588/LTC1589/ LTC1592 to 0V in unipolar or bipolar mode.

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
LTC1592ACG#PBF SSOP-16 G C 05-08-1640 (G16) Yes
LTC1592ACG#TRPBF SSOP-16 G C 05-08-1640 (G16) Yes
LTC1592AIG#PBF SSOP-16 G I 05-08-1640 (G16) Yes
LTC1592AIG#TRPBF SSOP-16 G I 05-08-1640 (G16) Yes
LTC1592BCG#PBF SSOP-16 G C 05-08-1640 (G16) Yes
LTC1592BCG#TRPBF SSOP-16 G C 05-08-1640 (G16) Yes
LTC1592BIG#PBF SSOP-16 G I 05-08-1640 (G16) Yes
LTC1592BIG#TRPBF SSOP-16 G I 05-08-1640 (G16) Yes


LTC1592 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
LTC1592ACG#PBF SSOP-16 C $34.35 $26.15 Yes
LTC1592ACG#TRPBF SSOP-16 C $26.21 Yes
LTC1592AIG#PBF SSOP-16 I $40.35 $30.75 Yes
LTC1592AIG#TRPBF SSOP-16 I $30.81 Yes
LTC1592BCG#PBF SSOP-16 C $18.30 $13.95 Yes
LTC1592BCG#TRPBF SSOP-16 C $14.01 Yes
LTC1592BIG#PBF SSOP-16 I $22.20 $16.95 Yes
LTC1592BIG#TRPBF SSOP-16 I $17.01 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
DC572A LTC1592ACG | 16-Bit Softspan DAC, Vin = +15V/-15V, Vout = 0-5V, 0-10V, +/-2.5V, +/-5V, +/-10V, -2.5V to 7.5V (req DC590) $50.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

  • Process Control and Industrial Automation
  • Precision Instrumentation
  • Direct Digital Waveform Generation
  • Software-Controlled Gain Adjustment
  • Automatic Test Equipment

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 LTC1592 - DC572A Linduino.INO File

/*!
Linear Technology DC572A Demonstration Board.
LTC1592: 16-bit SoftSpan DAC with Programmable Output Range

@verbatim
NOTES
  Setup:
   Set the terminal baud rate to 115200 and select the newline terminator.

   An external +/- 15V power supply is required to power the circuit.

  Explanation of Commands:
   1- Voltage Output
   Displays the calculated voltage depending on the code input from user and
   voltage range selected.

   2- Square Wave Output
   Generates a square wave on the output pin. This function helps to measure
   settling time and glitch impulse.

   3- Change Range
   |   Command   | Range Selected |
   | C3 C2 C1 C0 |                |
   |------------------------------|
   | 1  0  0  0  |    0V - 5V     |
   | 1  0  0  1  |    0V - 10V    |
   | 1  0  1  0  |   -5V - +5V    |
   | 1  0  1  1  |  -10V - +10V   |
   | 1  1  0  0  | -2.5V - +2.5V  |
   | 1  1  0  1  | -2.5V - 7V     |


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

@endverbatim

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

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

REVISION HISTORY
$Revision: 3238 $
$Date: 2015-03-06 16:40:13 -0800 (Fri, 06 Mar 2015) $

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

// Headerfiles
#include "LT_SPI.h"
#include "UserInterface.h"
#include "LT_I2C.h"
#include "QuikEval_EEPROM.h"
#include "Linduino.h"
#include <SPI.h>
#include "LTC1592.h"
#include <QVariant>   // for parseFloat()
#include <Stream.h>

// Global variables
static uint8_t demo_board_connected;   //!< Set to 1 if the board is connected
float RANGE_LOW = 0;
float RANGE_HIGH = 5;
uint16_t data = 0x0000;
uint8_t choice = 0x00;

// Function Declarations
void print_title();
void print_prompt();
uint8_t voltage_output();
uint8_t square_wave_output();
void change_range();

//! Initialize Linduino
void setup()
{
  char demo_name[] = "DC572";  // Demo Board Name stored in QuikEval EEPROM

  quikeval_SPI_init();          // Configure the spi port for 4MHz SCK
  quikeval_SPI_connect();       // Connect SPI to main data port
  quikeval_I2C_init();          // Configure the EEPROM I2C port for 100kHz

  Serial.begin(115200);         // Initialize the serial port to the PC
  print_title();

  read_quikeval_id_string(&ui_buffer[0]);
  ui_buffer[48] = 0;
  Serial.println(ui_buffer);

  demo_board_connected = discover_demo_board(demo_name);
  if (demo_board_connected)
  {
    Serial.println("Connected...");
    print_prompt();
  }
}

//! Repeats Linduino loop
void loop()
{
  int16_t user_command;
  if (Serial.available())               // Check for user input
  {
    user_command = read_int();          // Read the user command
    Serial.println(user_command);
    Serial.flush();
    switch (user_command)
    {
      case 1:
        voltage_output();
        break;
      case 2:
        square_wave_output();
        break;
      case 3:
        change_range();
        break;
      default:
        Serial.println(F("Incorrect Option"));
        break;
    }
    Serial.println(F("\n************************************************************"));
    print_prompt();
  }
}

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

//! Prints main menu.
void print_prompt()
{
  Serial.println(F("\nCommand Summary:"));
  Serial.println(F("  1-Voltage Output"));
  Serial.println(F("  2-Square wave output"));
  Serial.println(F("  3-Change Range"));

  Serial.println(F("\nPresent Values:"));
  Serial.print(F("  Range: "));
  switch (choice)
  {
    case 0:
      Serial.print(F("0V to 5V"));
      break;

    case 1:
      Serial.print(F("0V to 10V"));
      break;

    case 2:
      Serial.print(F("-5V to +5V"));
      break;

    case 3:
      Serial.print(F("-10V to +10V"));
      break;

    case 4:
      Serial.print(F("-2.5V to +2.5V"));
      break;

    case 5:
      Serial.print(F("-2.5V to 7V"));
      break;

    default:
      Serial.println("0V to 5V");
  }

  Serial.print(F("\n\nEnter a command: "));
  Serial.flush();
}

//! Function to enter a digital value and get the analog output
uint8_t voltage_output()
{
  float voltage;
  Serial.print("\nEnter the 16-bit data as decimal or hex: ");
  data = read_int();
  Serial.print("0x");
  Serial.println(data, HEX);

  LTC1592_write(LTC1592_CS, data, choice);
  voltage = LTC1592_code_to_voltage(data, RANGE_HIGH, RANGE_LOW);

  Serial.print("\nOutput voltage = ");
  Serial.print(voltage);
  Serial.println(" V");
  return 0;
}

//! Function to generate a square wave of desired frequency and voltage ranges
uint8_t square_wave_output()
{
  uint16_t freq;
  float time;
  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 = Serial.parseFloat();
  Serial.print(voltage_high);
  Serial.println(" V");
  receive_enter = read_int();

  Serial.print("\nEnter voltage_low: ");
  while (!Serial.available());
  voltage_low = Serial.parseFloat();
  Serial.print(voltage_low);
  Serial.println(" V");
  receive_enter = read_int();

  Serial.print("\nEnter the required frequency in Hz: ");
  freq = read_int();
  Serial.print(freq);
  Serial.println(" Hz");

  time = (float)1000/freq;
  Serial.print("\nT = ");
  Serial.print(time);
  Serial.println(" ms");

  //! Converting data into voltage
  code_high = LTC1592_voltage_to_code(voltage_high, RANGE_HIGH, RANGE_LOW);
  code_low = LTC1592_voltage_to_code(voltage_low, RANGE_HIGH, RANGE_LOW);

  while (!Serial.available()) //! Generate square wave until a key is pressed
  {
    LTC1592_write(LTC1592_CS, code_high, choice);
    delayMicroseconds(time * 500);
    LTC1592_write(LTC1592_CS, code_low, choice);
    delayMicroseconds(time * 500);
  }
  receive_enter = read_int();
  return 0;
}

//! Function to choose the range of voltages to be used
void change_range()
{
  Serial.println("\n| Choice | Range         |");
  Serial.println("|--------|---------------|");
  Serial.println("|    0   | 0 - 5 V       |");
  Serial.println("|    1   | 0 - 10 V      |");
  Serial.println("|    2   | -5 - +5 V     |");
  Serial.println("|    3   | -10 - +10 V   |");
  Serial.println("|    4   | -2.5 - +2.5 V |");
  Serial.println("|    5   | -2.5 - 7 V    |");

  Serial.print("\nEnter your choice: ");
  choice = read_int();
  Serial.println(choice);

  switch (choice)
  {
    case 0:
      RANGE_LOW = 0;
      RANGE_HIGH = 5;
      break;

    case 1:
      RANGE_LOW = 0;
      RANGE_HIGH = 10;
      break;

    case 2:
      RANGE_LOW = -5;
      RANGE_HIGH = 5;
      break;

    case 3:
      RANGE_LOW = -10;
      RANGE_HIGH = 10;
      break;

    case 4:
      RANGE_LOW = -2.5;
      RANGE_HIGH = 2.5;
      break;

    case 5:
      RANGE_LOW = -2.5;
      RANGE_HIGH = 7;
      break;

    default:
      Serial.println("\nWrong choice!");
  }
}

Download LTC1592 Linduino Header File

/*!
LTC1592: 16-bit SoftSpan DAC with Programmable Output Range

@verbatim

The LTC1592 is a 16-bit serial input DAC that operates on a single 5V supply.
It can be software-programmed for either unipolar or bipolar mode. It can
also be programmed for different output voltage ranges - two output ranges in
unipolar mode and four output ranges in bipolar mode.

The device includes an internal deglitcher circuit that reduces the glitch
impulse to less than 2nV-s (typ).

When the CS/LD is brought to a logic low, the data on the SDI input is loaded
into the shift register on the rising edge of the clock.  A 4-bit command word
(C3 C2 C1 C0), followed by four “don’t care” bits and 16 data bits(MSB-first)
is the minimum loading sequence required. When the CS/LD is brought to a logic
high, the clock is disabled internally and the command word is executed.

SPI DIN FORMAT (MSB First):

Byte #1                     Byte #2                        Byte #3
C3 C2 C1 C0  X  X   X   X   D15 D14 D13 D12 D11 D10 D9 D8  D7 D6 D5 D4 D3 D2 D1 D0

@endverbatim

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

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

REVISION HISTORY
$Revision: 3238 $
$Date: 2015-03-06 16:40:13 -0800 (Fri, 06 Mar 2015) $

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 LTC1592
    Header File for LTC1592: 16-bit SoftSpan DAC with Programmable Output Range
*/

#ifndef LTC1592_H
#define LTC1592_H

//! Headerfiles
#include "Linduino.h"
#include <stdint.h>

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

//! Transmits 24 bit input stream: 4-bit command + 4-bit don't-care + 16-bit data
//! @return void
void LTC1592_write(uint8_t cs,            //!< Chip Select
                   uint16_t data,           //!< 16-bit digital data input
                   uint8_t dac_command        //!< 4-bit command: c3 c2 c1 c0 X X X X
                  );

//! Calculates the voltage from ADC output data depending on the channel configuration
//! @return Floating point voltage
float LTC1592_code_to_voltage(uint16_t data,    //!< 16-bit digital data input
                              float RANGE_HIGH,   //!< Maximum voltage range
                              float RANGE_LOW   //!< Minimum voltage range
                             );

//! Calculates the 16 bit data code from voltage
//! @return 16 bit data code
uint16_t LTC1592_voltage_to_code(float voltage,   //!< Voltage to be converted
                                 float RANGE_HIGH,  //!< Maximum voltage range
                                 float RANGE_LOW  //!< Minimum voltage range
                                );

#endif    // LTC1592_H

Download LTC1592 Linduino.CPP

/*!
LTC1592: 16-bit SoftSpan DAC with Programmable Output Range

@verbatim

The LTC1592 is a 16-bit serial input DAC that operates on a single 5V supply.
It can be software-programmed for either unipolar or bipolar mode. It can
also be programmed for different output voltage ranges - two output ranges in
unipolar mode and four output ranges in bipolar mode.

The device includes an internal deglitcher circuit that reduces the glitch
impulse to less than 2nV-s (typ).

When the CS/LD is brought to a logic low, the data on the SDI input is loaded
into the shift register on the rising edge of the clock.  A 4-bit command word
(C3 C2 C1 C0), followed by four “don’t care” bits and 16 data bits(MSB-first)
is the minimum loading sequence required. When the CS/LD is brought to a logic
high, the clock is disabled internally and the command word is executed.

SPI DIN FORMAT (MSB First):

Byte #1                     Byte #2                        Byte #3
C3 C2 C1 C0  X  X   X   X   D15 D14 D13 D12 D11 D10 D9 D8  D7 D6 D5 D4 D3 D2 D1 D0

@endverbatim

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

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

REVISION HISTORY
$Revision: 3238 $
$Date: 2015-03-06 16:40:13 -0800 (Fri, 06 Mar 2015) $

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 LTC1592 LTC1592: 16-bit SoftSpan DAC with Programmable Output Range

/*! @file
    @ingroup LTC1592
    Library for LTC1592: 16-bit SoftSpan DAC with Programmable Output Range
*/

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

// Transmits 24 bit input stream: 4-bit command + 4-bit don't-care + 16-bit data
void LTC1592_write(uint8_t cs, uint16_t data, uint8_t dac_command)
{
  output_low(cs);
  delay(100);
  spi_write(0x80 | (dac_command << 4));
  spi_write((uint8_t)(data >> 8));  //D15:D8
  spi_write((uint8_t)data);     //D7:D0
  delay(100);
  output_high(cs);
}

// Calculates the voltage from ADC output data depending on the channel configuration
float LTC1592_code_to_voltage(uint16_t data, float RANGE_HIGH, float RANGE_LOW)
{
  float voltage;
  voltage = (RANGE_HIGH - RANGE_LOW) * data / 0xFFFF + RANGE_LOW;
  return voltage;
}

// Calculates the 16 bit data code from voltage
uint16_t LTC1592_voltage_to_code(float voltage, float RANGE_HIGH, float RANGE_LOW)
{
  float code;
  code = (voltage - RANGE_LOW) * (0xFFFF / (RANGE_HIGH - RANGE_LOW));
  return code;
}

Technical Support