| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

Data Structures | Functions | Macros | Enumerations | Variables
DC2692A.ino File Reference
Digital-to-Analog Converters (DAC) » LTC2662 5-Channel 16-/12-Bit 300mA SoftSpan Current Source DACs

Linear Technology DC2692A Demonstration Board. More...

## Detailed Description

Linear Technology DC2692A Demonstration Board.

LTC2662: 5-Channel 16-/12-Bit 300mA SoftSpan Current Source DACs

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

       An external +7V - 5V power supply is required to power the circuit.

       The program displays calculated currents which are based on the voltage
       of the reference used and Radj resistor, be it internal or external. A
       precision voltmeter is needed to verify the actual measured voltages
       against the calculated current 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 five DACs to test : 0 to 4

       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
          current. If a current 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 shutdown 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 1.25v reference.

       7- Set SoftSpan: There are ten options.

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

       9- Set MUX: 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 th store
           setting EEPROM menu and select it. Upon Linduinos power up, the
           previously stored settings will be restored.

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

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

http://www.linear.com/product/LTC2662#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 DC2692A.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_current_or_code (uint8_t selected_dac)
| Prompt user to enter a current or digital code to send to DAC. More...
static uint16_t | get_current (uint8_t selected_dac)
| Get current 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 | display_fault (uint8_t fault)
| Display fault conditions. More...
static void | menu_1_select_dac (uint8_t *selected_dac)
| Select which DAC to operate on. More...
static uint8_t | menu_2_write_to_input_register (uint8_t selected_dac)
| Write data to input register, but do not update DAC output. More...
static uint8_t | menu_3_write_and_update_dac (uint8_t selected_dac)
| Write data to DAC register (which updates output immediately) More...
static uint8_t | 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 uint8_t | menu_5_power_down_dac (uint8_t selected_dac)
| Power down DAC. More...
static uint8_t | menu_6_set_reference_mode (void)
| Set reference mode. More...
static uint8_t | menu_7_set_softspan_range (uint8_t selected_dac)
| Set SoftSpan Range. More...
static uint8_t | 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 uint8_t | menu_9_set_mux ()
| Sets the channel for the MUX. More...
static uint8_t | 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_13_settling_test ()
static void | menu_14_demo_board_test ()
static void | setup ()
| Initialize Linduino. More...
static void | loop ()
| Repeats Linduino loop. More...

## Macros
#define | REF_EXTERNAL LTC2662_REF_DISABLE
| External mode. More...
#define | REF_INTERNAL 0
| Internal mode. More...
#define | INTEGRATOR_CONTROL 2
#define | SETTLE_TRIGGER 3

## Enumerations
enum | { PROMPT_CURRENT = 0, PROMPT_CODE = 1 }
| Used to keep track to print current 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

## ◆ display_fault()

static void display_fault | ( | uint8_t | fault | ) |
| static

Display fault conditions.

Definition at line 859 of file DC2692A.ino.

## ◆ 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 711 of file DC2692A.ino.

## ◆ get_current()

static uint16_t get_current | ( | uint8_t | selected_dac | ) |
| static

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

Returns
  the DAC code

Definition at line 681 of file DC2692A.ino.

## ◆ loop()

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

Repeats Linduino loop.

Definition at line 209 of file DC2692A.ino.

## ◆ menu_10_global_toggle_settings()

static uint8_t menu_10_global_toggle_settings | ( |  | ) |
| static

Enable / Disable the global toggle bit.

Returns
  fault code

Definition at line 531 of file DC2692A.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 553 of file DC2692A.ino.

## ◆ menu_13_settling_test()

static void menu_13_settling_test | ( |  | ) |
| static

Definition at line 898 of file DC2692A.ino.

## ◆ menu_14_demo_board_test()

static void menu_14_demo_board_test | ( |  | ) |
| static

Definition at line 582 of file DC2692A.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 276 of file DC2692A.ino.

## ◆ menu_2_write_to_input_register()

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

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

Returns
  fault code

Definition at line 289 of file DC2692A.ino.

## ◆ menu_3_write_and_update_dac()

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

Write data to DAC register (which updates output immediately)

Returns
  fault code

Definition at line 329 of file DC2692A.ino.

## ◆ menu_4_update_power_up_dac()

static uint8_t 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.

Returns
  fault code

Definition at line 370 of file DC2692A.ino.

## ◆ menu_5_power_down_dac()

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

Power down DAC.

Returns
  fault code

Definition at line 383 of file DC2692A.ino.

## ◆ menu_6_set_reference_mode()

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

Set reference mode.

Returns
  fault code

Definition at line 396 of file DC2692A.ino.

## ◆ menu_7_set_softspan_range()

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

Set SoftSpan Range.

Returns
  fault code

Definition at line 425 of file DC2692A.ino.

## ◆ menu_8_toggle_select_word()

static uint8_t 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.

Returns
  fault code

Definition at line 469 of file DC2692A.ino.

## ◆ menu_9_set_mux()

static uint8_t menu_9_set_mux | ( |  | ) |
| static

Sets the channel for the MUX.

Returns
  fault code

Definition at line 487 of file DC2692A.ino.

## ◆ print_prompt()

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

Prints main menu.

Definition at line 739 of file DC2692A.ino.

## ◆ print_title()

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

Prints the title block when program first starts.

Definition at line 724 of file DC2692A.ino.

## ◆ prompt_current_or_code()

static int16_t prompt_current_or_code | ( | uint8_t | selected_dac | ) |
| static

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

Returns
  user input

Definition at line 648 of file DC2692A.ino.

## ◆ restore_dac_from_eeprom()

static void restore_dac_from_eeprom | ( |  | ) |
| static

Read the alert settings from EEPROM.

Definition at line 815 of file DC2692A.ino.

## ◆ setup()

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

Initialize Linduino.

Definition at line 189 of file DC2692A.ino.

## Macro Definition Documentation

## ◆ INTEGRATOR_CONTROL

#define INTEGRATOR_CONTROL 2

Definition at line 892 of file DC2692A.ino.

## ◆ REF_EXTERNAL

#define REF_EXTERNAL LTC2662_REF_DISABLE

External mode.

Definition at line 128 of file DC2692A.ino.

## ◆ REF_INTERNAL

#define REF_INTERNAL 0

Internal mode.

Definition at line 129 of file DC2692A.ino.

## ◆ SETTLE_TRIGGER

#define SETTLE_TRIGGER 3

Definition at line 895 of file DC2692A.ino.

## Enumeration Type Documentation

## ◆ anonymous enum

anonymous enum

Used to keep track to print current or print code.

Enumerator
PROMPT_CURRENT | 0
PROMPT_CODE | 1

Definition at line 182 of file DC2692A.ino.

## Variable Documentation

## ◆ demo_board_connected

uint8_t demo_board_connected
| static

Set to 1 if the board is connected.

Definition at line 157 of file DC2692A.ino.

## ◆ eeprom

eeprom_data_union eeprom

Definition at line 177 of file DC2692A.ino.