Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board

Linear Technology DC1333A Demonstration Board. More...

Detailed Description

Linear Technology DC1333A Demonstration Board.

LTC2640: Single 12-/10-/8-Bit Rail-to-Rail DACs with 10ppm/C Reference Demonstration Circuit DC1333 features the 12-bit versions of the LTC2640.

Linear Technology DC1074A Demonstration Board. LTC2630: Single 12-/10-/8-Bit Rail-to-Rail DACs with Integrated Reference in SC70

NOTES
  Setup:
   Set the terminal baud rate to 115200 and select the newline terminator. The
   program displays calculated voltages which are based on the voltage of the
   reference used, be it internal or external. A precision voltmeter is needed to
   verify the actual measured voltages against the calculated voltage displayed. If
   an external reference is used, a precision voltage source is required to apply
   the external reference voltage. A precision voltmeter is also required to measure
   the external reference voltage. No external power supply is required. All four
   demo board options may be used: DC1333A-A, DC1333A-B, DC1333A-C, or DC1333A-D.


  Explanation of Commands:


   1- Write to DAC input register: Value is stored in the DAC for updating later,
      through a software "Update" command. User will be prompted to enter either a
      code in hex or decimal, or a voltage. If a voltage is entered, a code will be
      calculated based on the active scaling and reference parameters - ideal values
      if no calibration was ever stored. (This is more often used with the
      multichannel DACs in the family, where all DACs can be updated at once in
      software or by asserting the LDAC# pin.)

   2- Write and Update: Similar to item 1, but DAC is updated immediately.

   3- Write to DAC: Sends the DAC code to the Input Register.

   4- Update DAC: Copies the value from the input register into the DAC Register.
      Note that a "write and update" command writes the code to BOTH the input
      register and DAC register, so subsequent "update" commands will simply re-copy
      the same data (no change in output.)

   5- Power Down DAC: Disable DAC output. Power supply current is reduced. DAC code
      present in DAC registers at time of shutdown are preserved.

   6- Set reference mode: Either internal or external. Selecting external mode
      prompts for the external refernce voltage, which is used directly if no
      individual DAC calibration is stored. The selection and entered volgage are
      stored to EEPROM so it is persisent across reset / power cycles.

   7- Calibrate DAC: Use a precision voltmeter to obtain and enter VOUT readings
      taken with different DAC codes. Set reference mode FIRST, as values are stored
      separately for internal and external reference mode. Entries are used to
      calculate the closest code to send to the DAC to achieve an entered voltage.

   8- Enable / Disable Calibration: Switch between stored calibration values and
      defaults. Calibration parameters are stored separately for internal and
      external reference modes. Ideal calibration will be used if the calibration
      parameter valid key is not set.


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

http://www.linear.com/product/LTC2640 http://www.linear.com/product/LTC2630

http://www.linear.com/product/LTC2640#demoboards http://www.linear.com/product/LTC2630#demoboards

Copyright 2018(c) Analog Devices, Inc.

All rights reserved.

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

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
  • The use of this software may or may not infringe the patent rights of one or more patent holders. This license does not release you from the requirement that you obtain separate licenses from these patent holders to use this software.
  • Use of the software either in source or binary form, must be run on or directly connected to an Analog Devices Inc. component.

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file DC1333A.ino.

Go to the source code of this file.

Functions

static int8_t restore_calibration ()
 Read stored calibration parameters from nonvolatile EEPROM on demo board. More...
 
static void store_calibration ()
 Store measured calibration parameters to nonvolatile EEPROM on demo board. More...
 
static void print_title ()
 Prints the title block when program first starts. More...
 
static void print_prompt ()
 Prints main menu. More...
 
static int16_t prompt_voltage_or_code ()
 Prompt user to enter a voltage or digital code to send to DAC. More...
 
static uint16_t get_voltage (float LTC2640_lsb, int32_t LTC2640_offset)
 
static uint16_t get_code ()
 Get code to send to DAC directly, in decimal, hex, or binary. More...
 
static void calibrate_dac ()
 Calibrate the selected DAC using a voltmeter. More...
 
static void menu_1_write_to_input_register ()
 Write data to input register, but do not update DAC output. More...
 
static void menu_2_write_and_update_dac ()
 Write data to DAC register (which updates output immediately) More...
 
static void menu_3_update_power_up_dac ()
 Update DAC with data that is stored in input register, power up if sleeping. More...
 
static void menu_4_power_down_dac ()
 Power down DAC. More...
 
static void menu_5_set_reference_mode ()
 Set reference mode and store to EEPROM. More...
 
static void menu_6_calibrate_dacs ()
 Calibrate all DACs by measuring two known outputs. More...
 
static void menu_7_enable_calibration ()
 Enable / Disable calibration. More...
 
static void setup ()
 Initialize Linduino. More...
 
static void loop ()
 Repeats Linduino loop. More...
 
static uint16_t get_voltage (float LTC2640_lsb, int16_t LTC2640_offset)
 Get voltage from user input, calculate DAC code based on lsb, offset. More...
 

Macros

#define EEPROM_CAL_KEY_INT   0x5678
 Calibration associated with internal reference. More...
 
#define EEPROM_CAL_KEY_EXT   0x9ABC
 Calibration associated with external reference. More...
 
#define REF_INTERNAL   LTC2640_CMD_INTERNAL_REFERENCE
 Stored reference state is Internal. More...
 
#define REF_EXTERNAL   LTC2640_CMD_EXTERNAL_REFERENCE
 Stored reference state is External. More...
 
#define STORED_REF_STATE_BASE   EEPROM_CAL_STATUS_ADDRESS
 Base address of the stored reference state. More...
 
#define INT_CAL_VALID_BASE   STORED_REF_STATE_BASE + 2
 Base address of the "internal ref calibration valid" flag. More...
 
#define INT_CAL_PARAMS_BASE   INT_CAL_VALID_BASE + 2
 Base address of the internal ref calibration parameters. More...
 
#define EXT_CAL_VALID_BASE   INT_CAL_PARAMS_BASE + 8
 Base address of the "external ref calibration valid" flag. More...
 
#define EXT_CAL_PARAMS_BASE   EXT_CAL_VALID_BASE + 2
 Base address of the external ref calibration parameters. More...
 
#define EXT_REF_V_BASE   EXT_CAL_PARAMS_BASE + 8
 Base address of the stored external reference voltage. More...
 
#define LSB_PARAM_ADDR_OFFSET   4
 Offset into XXX_CAL_PARAMS_BASE to locate stored LSB parameter. More...
 

Enumerations

enum  { PROMPT_VOLTAGE = 0, PROMPT_CODE = 1 }
 Used to keep track to print voltage or print code. More...
 

Variables

static uint8_t demo_board_connected
 Set to 1 if the board is connected. More...
 
static uint8_t shift_count = 4
 The data align shift count. More...
 
static uint8_t reference_mode
 Tells whether to set internal or external reference. More...
 
static float reference_voltage
 Reference voltage, either internal or external. More...
 
static float LTC2640_lsb = 1e-3
 DAC lsb. More...
 
static int16_t LTC2640_offset = 0
 DAC offset. More...
 

Function Documentation

◆ calibrate_dac()

static void calibrate_dac ( )
static

Calibrate the selected DAC using a voltmeter.

The routine does a linear curve fit given two data points.

Definition at line 567 of file DC1333A.ino.

◆ get_code()

static uint16_t get_code ( )
static

Get code to send to DAC directly, in decimal, hex, or binary.

Returns
Returns users input dac code

Definition at line 512 of file DC1333A.ino.

◆ get_voltage() [1/2]

static uint16_t get_voltage ( float  LTC2640_lsb,
int32_t  LTC2640_offset 
)
static

◆ get_voltage() [2/2]

static uint16_t get_voltage ( float  LTC2640_lsb,
int16_t  LTC2640_offset 
)
static

Get voltage from user input, calculate DAC code based on lsb, offset.

Returns
Returns the DAC code

Definition at line 498 of file DC1333A.ino.

◆ loop()

static void loop ( void  )
static

Repeats Linduino loop.

Definition at line 211 of file DC1333A.ino.

◆ menu_1_write_to_input_register()

static void menu_1_write_to_input_register ( )
static

Write data to input register, but do not update DAC output.

Definition at line 261 of file DC1333A.ino.

◆ menu_2_write_and_update_dac()

static void menu_2_write_and_update_dac ( )
static

Write data to DAC register (which updates output immediately)

Definition at line 274 of file DC1333A.ino.

◆ menu_3_update_power_up_dac()

static void menu_3_update_power_up_dac ( )
static

Update DAC with data that is stored in input register, power up if sleeping.

Definition at line 286 of file DC1333A.ino.

◆ menu_4_power_down_dac()

static void menu_4_power_down_dac ( )
static

Power down DAC.

Definition at line 293 of file DC1333A.ino.

◆ menu_5_set_reference_mode()

static void menu_5_set_reference_mode ( )
static

Set reference mode and store to EEPROM.

Definition at line 300 of file DC1333A.ino.

◆ menu_6_calibrate_dacs()

static void menu_6_calibrate_dacs ( )
static

Calibrate all DACs by measuring two known outputs.

Definition at line 324 of file DC1333A.ino.

◆ menu_7_enable_calibration()

static void menu_7_enable_calibration ( )
static

Enable / Disable calibration.

Use with caution - behavior is undefined if you enable calibration and an actual calibration cycle has not been performed.

Definition at line 333 of file DC1333A.ino.

◆ print_prompt()

static void print_prompt ( )
static

Prints main menu.

Definition at line 540 of file DC1333A.ino.

◆ print_title()

static void print_title ( void  )
static

Prints the title block when program first starts.

Definition at line 525 of file DC1333A.ino.

◆ prompt_voltage_or_code()

static int16_t prompt_voltage_or_code ( )
static

Prompt user to enter a voltage or digital code to send to DAC.

Returns
Returns the prompt indicator

Definition at line 482 of file DC1333A.ino.

◆ restore_calibration()

static int8_t restore_calibration ( )
static

Read stored calibration parameters from nonvolatile EEPROM on demo board.

Returns
Return 1 if successful, 0 if not

Definition at line 361 of file DC1333A.ino.

◆ setup()

static void setup ( void  )
static

Initialize Linduino.

Definition at line 180 of file DC1333A.ino.

◆ store_calibration()

static void store_calibration ( )
static

Store measured calibration parameters to nonvolatile EEPROM on demo board.

Definition at line 461 of file DC1333A.ino.

Macro Definition Documentation

◆ EEPROM_CAL_KEY_EXT

#define EEPROM_CAL_KEY_EXT   0x9ABC

Calibration associated with external reference.

Definition at line 127 of file DC1333A.ino.

◆ EEPROM_CAL_KEY_INT

#define EEPROM_CAL_KEY_INT   0x5678

Calibration associated with internal reference.

Definition at line 126 of file DC1333A.ino.

◆ EXT_CAL_PARAMS_BASE

#define EXT_CAL_PARAMS_BASE   EXT_CAL_VALID_BASE + 2

Base address of the external ref calibration parameters.

Definition at line 140 of file DC1333A.ino.

◆ EXT_CAL_VALID_BASE

#define EXT_CAL_VALID_BASE   INT_CAL_PARAMS_BASE + 8

Base address of the "external ref calibration valid" flag.

Definition at line 139 of file DC1333A.ino.

◆ EXT_REF_V_BASE

#define EXT_REF_V_BASE   EXT_CAL_PARAMS_BASE + 8

Base address of the stored external reference voltage.

Definition at line 141 of file DC1333A.ino.

◆ INT_CAL_PARAMS_BASE

#define INT_CAL_PARAMS_BASE   INT_CAL_VALID_BASE + 2

Base address of the internal ref calibration parameters.

Definition at line 138 of file DC1333A.ino.

◆ INT_CAL_VALID_BASE

#define INT_CAL_VALID_BASE   STORED_REF_STATE_BASE + 2

Base address of the "internal ref calibration valid" flag.

Definition at line 137 of file DC1333A.ino.

◆ LSB_PARAM_ADDR_OFFSET

#define LSB_PARAM_ADDR_OFFSET   4

Offset into XXX_CAL_PARAMS_BASE to locate stored LSB parameter.

Definition at line 142 of file DC1333A.ino.

◆ REF_EXTERNAL

#define REF_EXTERNAL   LTC2640_CMD_EXTERNAL_REFERENCE

Stored reference state is External.

Definition at line 133 of file DC1333A.ino.

◆ REF_INTERNAL

#define REF_INTERNAL   LTC2640_CMD_INTERNAL_REFERENCE

Stored reference state is Internal.

Definition at line 132 of file DC1333A.ino.

◆ STORED_REF_STATE_BASE

#define STORED_REF_STATE_BASE   EEPROM_CAL_STATUS_ADDRESS

Base address of the stored reference state.

Definition at line 136 of file DC1333A.ino.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Used to keep track to print voltage or print code.

Enumerator
PROMPT_VOLTAGE 

0

PROMPT_CODE 

1

Definition at line 173 of file DC1333A.ino.

Variable Documentation

◆ demo_board_connected

uint8_t demo_board_connected
static

Set to 1 if the board is connected.

Definition at line 163 of file DC1333A.ino.

◆ LTC2640_lsb

float LTC2640_lsb = 1e-3
static

DAC lsb.

Default to 12-bits

Definition at line 169 of file DC1333A.ino.

◆ LTC2640_offset

int16_t LTC2640_offset = 0
static

DAC offset.

Definition at line 170 of file DC1333A.ino.

◆ reference_mode

uint8_t reference_mode
static

Tells whether to set internal or external reference.

Definition at line 165 of file DC1333A.ino.

◆ reference_voltage

float reference_voltage
static

Reference voltage, either internal or external.

Definition at line 168 of file DC1333A.ino.

◆ shift_count

uint8_t shift_count = 4
static

The data align shift count.

For 12-bits, shift_count = 4

Definition at line 164 of file DC1333A.ino.