| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

Data Structures | Functions | Macros | Enumerations | Variables
DC2376A.ino File Reference
Digital-to-Analog Converters (DAC) » LTC2664 4-Channel SPI 16-/12-Bit +/-10V Vout SoftSpan DACs with 10ppm/C Max Reference

Linear Technology DC2376A Demonstration Board. More...

## Detailed Description

Linear Technology DC2376A Demonstration Board.

LTC2664: 4 Channel SPI 16-/12-Bit Rail-to-Rail DACs with 10ppm/C Max Reference.

    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.

       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.

      Explanation of Commands:
       1- Select DAC: Select one of four DACs to test : 0 to 3

       2- Write to DAC input register: Value is stored in the DAC for updating
          later, allowing multiple channels to be updated at once, either
          through a software "Update All" command or by asserting the LDAC# pin.
          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.

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

       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 shut down are preserved.

       6- Set reference mode, either internal or external: Selecting external
          mode powers down the internal reference voltage. It is the users
          responsibility to apply a 2.5V reference.

       7- Set SoftSpan: There are four options. In external mode, it is the users
          responsibility to compensate for the desired voltage.

       8- Toggle Selected Word: Switch between register A or B for DAC code.

       9- Set MUX: Enables / disables the MUX and sets the channel.

       10- Global Toggle Bit Settings - Enabling this feature sets the DAC to
           toggle from register A(when TGL pin is LOW) and register b(when TGL pin
           is HIGH). TGL pin is set HIGH with an internal pull up when the global toggle bit
           is set, and TGL pin is set LOW with an internal pull down when the global toggle bit
           is not set.

       11- Enable, disable, or store to EEPROM: To store to EEROM ensure all
           registers are set to their desired settings. Next, go to the store
           setting EEPROM menu and select it. Upon Linduino power up, the
           previously stored settings will be restored.

       12- Voltage Ramp: Sets a voltage ramp to all the channels. CH0 = 0V, CH1 = 0.1V,
           CH2 = 0.2V, CH3 = 0.4V, ect.

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

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

http://www.linear.com/product/LTC2664#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 DC2376A.ino.

Go to the source code of this file.

## Data Structures
union | eeprom_data_union
| Used to manipulate EEPROM data. More...
struct | eeprom_data_union::data_struct_type
| EEPROM data structure. More...

## Functions
static void | restore_dac_from_eeprom ()
| Read the alert settings from EEPROM. More...
static void | print_title ()
| Prints the title block when program first starts. More...
static void | print_prompt (int8_t selected_dac)
| Prints main menu. More...
static int16_t | prompt_voltage_or_code (uint8_t selected_dac)
| Prompt user to enter a voltage or digital code to send to DAC. More...
static uint16_t | get_voltage (uint8_t selected_dac)
| Get voltage from user input, calculate DAC code based on lsb, offset. More...
static uint16_t | get_code ()
| Get code to send to DAC directly, in decimal, hex, or binary. More...
static void | menu_1_select_dac (uint8_t *selected_dac)
| Select which DAC to operate on. More...
static void | menu_2_write_to_input_register (uint8_t selected_dac)
| Write data to input register, but do not update DAC output. More...
static void | menu_3_write_and_update_dac (uint8_t selected_dac)
| Write data to DAC register (which updates output immediately) More...
static void | menu_4_update_power_up_dac (uint8_t selected_dac)
| Update DAC with data that is stored in input register, power up if sleeping. More...
static void | menu_5_power_down_dac (uint8_t selected_dac)
| Power down DAC. More...
static void | menu_6_set_reference_mode (void)
| Set reference mode. More...
static void | menu_7_set_softspan_range (uint8_t selected_dac)
| Set SoftSpan Range. More...
static void | menu_8_toggle_select_word ()
| Enter toggle select word, which also sets the register that will be written if bit is 0, register A is written, if 1, register B is written. More...
static void | menu_9_set_mux ()
| Enable / Disable and sets the channel for the MUX. More...
static void | menu_10_global_toggle_settings ()
| Enable / Disable the global toggle bit. More...
static void | menu_11_enable_disable_eeprom_restore ()
| Enable / Disable restoration of DAC values from EEPROM Use with caution - behaviour is undefined if you enable restoration and data has NOT been previously stored from a known state. More...
static void | menu_12_voltage_ramp ()
| Sets a voltage ramp to all the channels. More...
static void | menu_13_demo_board_test ()
static void | menu_14_loopback_test ()
static void | setup ()
| Initialize Linduino. More...
static void | loop ()
| Repeats Linduino loop. More...

## Macros
#define | REF_EXTERNAL LTC2664_REF_DISABLE
| External mode. More...
#define | REF_INTERNAL 0
| Internal mode. 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...
eeprom_data_union | eeprom

## Function Documentation

## ◆ get_code()

static uint16_t get_code | ( |  | ) |
| static

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

Returns
  code from user

Definition at line 735 of file DC2376A.ino.

## ◆ get_voltage()

static uint16_t get_voltage | ( | uint8_t | selected_dac | ) |
| static

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

Returns
  the DAC code

Definition at line 713 of file DC2376A.ino.

## ◆ loop()

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

Repeats Linduino loop.

Definition at line 211 of file DC2376A.ino.

## ◆ menu_10_global_toggle_settings()

static void menu_10_global_toggle_settings | ( |  | ) |
| static

Enable / Disable the global toggle bit.

Definition at line 495 of file DC2376A.ino.

## ◆ menu_11_enable_disable_eeprom_restore()

static void menu_11_enable_disable_eeprom_restore | ( |  | ) |
| static

Enable / Disable restoration of DAC values from EEPROM Use with caution - behaviour is undefined if you enable restoration and data has NOT been previously stored from a known state.

Definition at line 515 of file DC2376A.ino.

## ◆ menu_12_voltage_ramp()

static void menu_12_voltage_ramp | ( |  | ) |
| static

Sets a voltage ramp to all the channels.

Definition at line 542 of file DC2376A.ino.

## ◆ menu_13_demo_board_test()

static void menu_13_demo_board_test | ( |  | ) |
| static

Definition at line 554 of file DC2376A.ino.

## ◆ menu_14_loopback_test()

static void menu_14_loopback_test | ( |  | ) |
| static

Definition at line 657 of file DC2376A.ino.

## ◆ menu_1_select_dac()

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

Select which DAC to operate on.

Definition at line 280 of file DC2376A.ino.

## ◆ menu_2_write_to_input_register()

static void menu_2_write_to_input_register | ( | uint8_t | selected_dac | ) |
| static

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

Definition at line 292 of file DC2376A.ino.

## ◆ menu_3_write_and_update_dac()

static void menu_3_write_and_update_dac | ( | uint8_t | selected_dac | ) |
| static

Write data to DAC register (which updates output immediately)

Definition at line 329 of file DC2376A.ino.

## ◆ menu_4_update_power_up_dac()

static void menu_4_update_power_up_dac | ( | uint8_t | selected_dac | ) |
| static

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

Definition at line 367 of file DC2376A.ino.

## ◆ menu_5_power_down_dac()

static void menu_5_power_down_dac | ( | uint8_t | selected_dac | ) |
| static

Power down DAC.

Definition at line 377 of file DC2376A.ino.

## ◆ menu_6_set_reference_mode()

static void menu_6_set_reference_mode | ( | void |  | ) |
| static

Set reference mode.

Definition at line 387 of file DC2376A.ino.

## ◆ menu_7_set_softspan_range()

static void menu_7_set_softspan_range | ( | uint8_t | selected_dac | ) |
| static

Set SoftSpan Range.

Definition at line 413 of file DC2376A.ino.

## ◆ menu_8_toggle_select_word()

static void menu_8_toggle_select_word | ( |  | ) |
| static

Enter toggle select word, which also sets the register that will be written if bit is 0, register A is written, if 1, register B is written.

Definition at line 447 of file DC2376A.ino.

## ◆ menu_9_set_mux()

static void menu_9_set_mux | ( |  | ) |
| static

Enable / Disable and sets the channel for the MUX.

Definition at line 465 of file DC2376A.ino.

## ◆ print_prompt()

static void print_prompt | ( | int8_t | selected_dac | ) |
| static

Prints main menu.

Definition at line 763 of file DC2376A.ino.

## ◆ print_title()

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

Prints the title block when program first starts.

Definition at line 748 of file DC2376A.ino.

## ◆ prompt_voltage_or_code()

static int16_t prompt_voltage_or_code | ( | uint8_t | selected_dac | ) |
| static

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

Returns
  user input

Definition at line 680 of file DC2376A.ino.

## ◆ restore_dac_from_eeprom()

static void restore_dac_from_eeprom | ( |  | ) |
| static

Read the alert settings from EEPROM.

Definition at line 807 of file DC2376A.ino.

## ◆ setup()

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

Initialize Linduino.

Definition at line 191 of file DC2376A.ino.

## Macro Definition Documentation

## ◆ REF_EXTERNAL

#define REF_EXTERNAL LTC2664_REF_DISABLE

External mode.

Definition at line 132 of file DC2376A.ino.

## ◆ REF_INTERNAL

#define REF_INTERNAL 0

Internal mode.

Definition at line 133 of file DC2376A.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 184 of file DC2376A.ino.

## Variable Documentation

## ◆ demo_board_connected

uint8_t demo_board_connected
| static

Set to 1 if the board is connected.

Definition at line 159 of file DC2376A.ino.

## ◆ eeprom

eeprom_data_union eeprom

Definition at line 179 of file DC2376A.ino.