| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

Functions | Enumerations | Variables
DC934A.ino File Reference
Digital-to-Analog Converters (DAC) » LTC2607: 16-Bit, Dual Rail-to-Rail DACs with I2C Interface

Linear Technology DC934 Demonstration Board. More...

## Detailed Description

Linear Technology DC934 Demonstration Board.

LTC2607: 16-Bit, Dual Rail-to-Rail DACs with I2C Interface

Linear Technology DC936 Demonstration Board. LTC2609: Quad 16-/14-/12-Bit Rail-to-Rail DACs with I²C Interface.

Linear Technology DC812 Demonstration Board. LTC2606: 16-Bit Rail-to-Rail DACs with I²C Interface.

    NOTES
      Setup:
       Set the terminal baud rate to 115200 and select the newline terminator.
       Calibration requires a precision voltmeter.
       No external power supply is required.

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

http://www.linear.com/product/LTC2607 http://www.linear.com/product/LTC2609 http://www.linear.com/product/LTC2606

http://www.linear.com/product/LTC2607#demoboards http://www.linear.com/product/LTC2609#demoboards http://www.linear.com/product/LTC2606#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 DC934A.ino.

Go to the source code of this file.

## Functions
static void | print_title ()
| Prints the title block. More...
static void | print_prompt (int16_t selected_dac)
| Prints the main menu, and prompts the user for an input command. More...
static int16_t | prompt_voltage_or_code ()
| Prompts user to find out if they want to enter DAC code as a "voltage" or a "code". More...
static uint16_t | get_voltage (float LTC2607_lsb, int32_t LTC2607_offset)
| Read desired DAC output voltage from user input. More...
static uint16_t | get_code ()
static uint8_t | menu_1_select_dac (int16_t *selected_dac)
| Menu 1: Select DAC to update. More...
static uint8_t | menu_2_write_to_input_register (int16_t selected_dac)
| Menu 2: Write to input register only. More...
static uint8_t | menu_3_write_and_update_dac (int16_t selected_dac)
| Menu 3: Write to input register and update output voltage. More...
static uint8_t | menu_4_update_power_up_dac (int16_t selected_dac)
| Menu 4: Update/Power Up DAC. More...
static uint8_t | menu_5_power_down_dac (int16_t selected_dac)
| Menu 5: Power Down DAC. More...
static uint8_t | menu_6_read_adc ()
| Menu 6: Read voltage from the ADC. More...
static uint8_t | menu_7_sweep ()
| Menu 7: Voltage Sweep. More...
static uint8_t | menu_8_calibrate_all ()
| Menu 8: Calibrate All. More...
static void | setup ()
| Initialize Linduino. More...
static void | loop ()
| Repeats Linduino loop. More...

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

## Variables
const uint16_t | LTC2422_TIMEOUT = 1000
| Configures the maximum timeout (ms) allowed for an LTC2607 read. More...
const uint8_t | address_map [3] = {LTC2607_DAC_A, LTC2607_DAC_B, LTC2607_ALL_DACS}
| Look-up table for DAC_A, DAC_B, or both command byte option. More...
const uint16_t | MISO_TIMEOUT = 1000
| The MISO timout in ms. More...
static float | LTC2607_lsb [3] = {LTC2607_TYPICAL_lsb, LTC2607_TYPICAL_lsb, LTC2607_TYPICAL_lsb}
| The LTC2607 least significant bit value with 5V full-scale. More...
static float | LTC2422_lsb = LTC2422_TYPICAL_lsb
| The LTC2422 least significant bit value with 5V full-scale. More...
static int32_t | LTC2607_offset [3] = {LTC2607_TYPICAL_OFFSET, LTC2607_TYPICAL_OFFSET, LTC2607_TYPICAL_OFFSET}
| The LTC2422 offset variable. More...
static int8_t | demo_board_connected
| Set to 1 if the board is connected. More...

## Function Documentation

## ◆ get_code()

static uint16_t get_code | ( |  | ) |
| static

Reads desired DAC code from user input.

Returns
  the adc CODE entered by the user. (Note, this is a CODE not a VOLTAGE.)

Definition at line 271 of file DC934A.ino.

## ◆ get_voltage()

static uint16_t get_voltage | ( | float | LTC2607_lsb,
|  | int32_t | LTC2607_offset
| ) |  |
| static

Read desired DAC output voltage from user input.

Returns
  the code that can be written to the LTC2607 DAC

Parameters

  LTC2607_lsb | lsb weight of the LTC2607 (possibly calibrated)
  LTC2607_offset | offset of LTC2607 (possibly calibrated)

Definition at line 255 of file DC934A.ino.

## ◆ loop()

static void loop | ( | void |  | ) |
| static

Repeats Linduino loop.

Definition at line 168 of file DC934A.ino.

## ◆ menu_1_select_dac()

static uint8_t menu_1_select_dac | ( | int16_t * | selected_dac | ) |
| static

Menu 1: Select DAC to update.

Prompts user for DAC A, DAC B, or both. This is only a user menu. This function does not communicate with the LTC2607.

Returns
  always returns 0. Fail return code is not implemented.

Parameters

  selected_dac | Overwritten with 0, 1, or 2 to indicate whether the user wants commands to act upon DAC A, DAC B, or both DACs respectively.

Definition at line 324 of file DC934A.ino.

## ◆ menu_2_write_to_input_register()

static uint8_t menu_2_write_to_input_register | ( | int16_t | selected_dac | ) |
| static

Menu 2: Write to input register only.

Does not update the output voltage.

Returns
  Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.

Parameters

  selected_dac | DAC to be updated. 0=A, 1=B, 2=All

Definition at line 339 of file DC934A.ino.

## ◆ menu_3_write_and_update_dac()

static uint8_t menu_3_write_and_update_dac | ( | int16_t | selected_dac | ) |
| static

Menu 3: Write to input register and update output voltage.

Returns
  Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.

Parameters

  selected_dac | DAC to be updated. 0=A, 1=B, 2=All

Definition at line 358 of file DC934A.ino.

## ◆ menu_4_update_power_up_dac()

static uint8_t menu_4_update_power_up_dac | ( | int16_t | selected_dac | ) |
| static

Menu 4: Update/Power Up DAC.

Returns
  Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.

Parameters

  selected_dac | DAC to be updated. 0=A, 1=B, 2=All

Definition at line 377 of file DC934A.ino.

## ◆ menu_5_power_down_dac()

static uint8_t menu_5_power_down_dac | ( | int16_t | selected_dac | ) |
| static

Menu 5: Power Down DAC.

Returns
  Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.

Definition at line 388 of file DC934A.ino.

## ◆ menu_6_read_adc()

static uint8_t menu_6_read_adc | ( |  | ) |
| static

Menu 6: Read voltage from the ADC.

Returns
  Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.

Definition at line 398 of file DC934A.ino.

## ◆ menu_7_sweep()

static uint8_t menu_7_sweep | ( |  | ) |
| static

Menu 7: Voltage Sweep.

Returns
  Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.

Definition at line 441 of file DC934A.ino.

## ◆ menu_8_calibrate_all()

static uint8_t menu_8_calibrate_all | ( |  | ) |
| static

Menu 8: Calibrate All.

Returns
  Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.

Definition at line 532 of file DC934A.ino.

## ◆ print_prompt()

static void print_prompt | ( | int16_t | selected_dac | ) |
| static

Prints the main menu, and prompts the user for an input command.

Parameters

  selected_dac | this parameter is passed so that it can be printed at the bottom of the menu.

Definition at line 299 of file DC934A.ino.

## ◆ print_title()

static void print_title | ( | void |  | ) |
| static

Prints the title block.

Definition at line 284 of file DC934A.ino.

## ◆ prompt_voltage_or_code()

static int16_t prompt_voltage_or_code | ( |  | ) |
| static

Prompts user to find out if they want to enter DAC code as a "voltage" or a "code".

Returns
  PROMPT_CODE or PROMPT_VOLTAGE that indicates whether the user requested for the next entry to be a CODE or VOLTAGE

Definition at line 239 of file DC934A.ino.

## ◆ setup()

static void setup | ( | void |  | ) |
| static

Initialize Linduino.

Definition at line 144 of file DC934A.ino.

## Enumeration Type Documentation

## ◆ prompt

enum prompt

Used to keep track to print voltage or print code.

Enumerator
PROMPT_VOLTAGE | 0
PROMPT_CODE | 1

Definition at line 113 of file DC934A.ino.

## Variable Documentation

## ◆ address_map

const uint8_t address_map[3] = {LTC2607_DAC_A, LTC2607_DAC_B, LTC2607_ALL_DACS}

Look-up table for DAC_A, DAC_B, or both command byte option.

Builds the command for dac address

Definition at line 123 of file DC934A.ino.

## ◆ demo_board_connected

int8_t demo_board_connected
| static

Set to 1 if the board is connected.

Definition at line 141 of file DC934A.ino.

## ◆ LTC2422_lsb

float LTC2422_lsb = LTC2422_TYPICAL_lsb
| static

The LTC2422 least significant bit value with 5V full-scale.

Initialized to typical value from datasheet. Can be calibrated through option menu.

Definition at line 135 of file DC934A.ino.

## ◆ LTC2422_TIMEOUT

const uint16_t LTC2422_TIMEOUT = 1000

Configures the maximum timeout (ms) allowed for an LTC2607 read.

Definition at line 120 of file DC934A.ino.

## ◆ LTC2607_lsb

float LTC2607_lsb[3] = {LTC2607_TYPICAL_lsb, LTC2607_TYPICAL_lsb, LTC2607_TYPICAL_lsb}
| static

The LTC2607 least significant bit value with 5V full-scale.

Initialized to typical value from datasheet. Can be calibrated through option menu. Builds the lsb. Index 2 is used for All DACs

Definition at line 131 of file DC934A.ino.

## ◆ LTC2607_offset

int32_t LTC2607_offset[3] = {LTC2607_TYPICAL_OFFSET, LTC2607_TYPICAL_OFFSET, LTC2607_TYPICAL_OFFSET}
| static

The LTC2422 offset variable.

Initialized to typical value from datasheet. Can be calibrated through option menu. Builds the offset. Index 2 is used for All DACs

Definition at line 139 of file DC934A.ino.

## ◆ MISO_TIMEOUT

const uint16_t MISO_TIMEOUT = 1000

The MISO timout in ms.

Definition at line 125 of file DC934A.ino.