I'm trying to use a linduino and a DC2376A-A demo board with the LTC2664A 16 bit DAC. I'm trying to convert a 0-5V signal to a 0-5V AC signal. I plan to use only 1 channel, but have a +/- 10V span. (I'm trying to emulate an AC input into a conductivity analyzer.)
If you have LTSketch book you have the example files:
I’ve also attached the file if you need it.
After some head scratching, I've done this with my code.
Will this work?
I put the +/- 10V span code in the setup, will this maintain this span? I know the answer is obvious, I'm at the level where I might think something is obvious and will work only to find some unknown detail will keep it from working.
char demo_name = "DC2376"; // Demo Board Name stored in QuikEval EEPROM
quikeval_SPI_init(); // Configure the spi port for 4MHz SCK
quikeval_SPI_connect(); // Connect SPI to main data port
//quikeval_I2C_init(); // Configure the EEPROM I2C port for 100kHz
Serial.begin(115200); // Initialize the serial port to the PC
demo_board_connected = discover_demo_board(demo_name);
LTC2664_write(LTC2664_CS, LTC2664_CMD_SPAN_ALL, 0, LTC2664_SPAN_PLUS_MINUS_10V);
metervoltage = analogRead(meterpin);
doublemetervoltage = 2 * mete+-
digitalcoeff = (5 / 1023);
flowrate = 0.00488759 * doublemetervoltage; // 0.00488759=digitalcoeff;
dac_voltage = flowrate;
LTC2664_voltage_to_code(dac_voltage, (float)min_output, (float)max_output);
Once you set the span, it will stay there until you cycle power or reprogram the span