Programing for a LTC2664 DAC

Hi Guys:

I'm trying to work out how to convert a 0-5V signal to a +/- 5V signal. I'm using an LTC 2664. it is a 16bit, 4 channel programmable DAC which can be programmed to generate a +/- 10V output. )(i'm trying to emulate an AC input into a conductivity analyzer.)

The 2664 DAC uses SPI, and there is a Ketchbook that has several header files.

http://www.linear.com/docs/43958

https://www.digikey.com/products/en?mpart=DC2376A-B&v=855

I'm guessing that all I need to do is incorporate the header files, and then call the functions in the headers by sending the digitalized value generated from the 0-5V input. Is this correct?

does anyone have an experience in this regard?

I have no experience with this DAC but you realize a -5V (negative) supply is needed and to get a +/- 5V sine wave out you will need to input numbers from 0(-5V) to 32768 (0V) to 65535 (+5V), probably from a lookup table.
graph.png

I saw that graphic in the data sheet.

I understand what I need to do, but now how to do it.

Sample code for this is pretty sparse.

The download that I mentioned has this bit that builds the SPI transfer array in the the LTC2664.h file:

int8_t LTC2664_write(uint8_t cs, uint8_t dac_command, uint8_t dac_address, uint16_t dac_code)
// Write the 16-bit dac_code to the LTC2664
{
static uint8_t last_data_array[4];
uint8_t data_array[4], rx_array[4];
int8_t ret;
LT_union_int16_2bytes data;

data.LT_int16 = dac_code; // Copy DAC code to union
data_array[3] = 0; // Only required for 32 byte readback transaction
data_array[2] = dac_command | dac_address; // Build command / address byte
data_array[1] = data.LT_byte[1]; // MS Byte
data_array[0] = data.LT_byte[0]; // LS Byte

it also has this bit that converts the float form of the voltage date into an unsigned integer:

uint16_t LTC2664_voltage_to_code(float dac_voltage, float min_output, float max_output)
// Calculate a LTC2664 DAC code given the desired output voltage and the minimum / maximum
// outputs for a given softspan range.
{
uint16_t dac_code;
float float_code;
float_code = 65535.0 * (dac_voltage - min_output) / (max_output - min_output); // Calculate the DAC code
float_code = (float_code > (floor(float_code) + 0.5)) ? ceil(float_code) : floor(float_code); // Round
if (float_code < 0.0) float_code = 0.0;
if (float_code > 65535.0) float_code = 65535.0;
dac_code = (uint16_t) (float_code); // Convert to unsigned integer
return (dac_code);
}

I'm guessing this is a function that the main sketch calls. do I still need a look-up table?

Take a read through this tutorial and keep checking here 'til one of the big guns drop by. :confused:

Look at the waveform tables, those are the types of numbers to send to the DAC in sequence to create different waveforms.