107 Serial.begin(115200);
123 Serial.println(F(
"\nPress any key when ready to start\n"));
131 Serial.println(F(
"*****************************************************************"));
132 Serial.println(F(
"* DC2025 Demonstration Program *"));
133 Serial.println(F(
"* *"));
134 Serial.println(F(
"* This program demonstrates the application noted at the end *"));
135 Serial.println(F(
"* of the LTC2668 16/12-bit DAC datasheet. The purpose of this *"));
136 Serial.println(F(
"* program is to demonstrate the use of the MUX pin on the *"));
137 Serial.println(F(
"* LTC2668. *"));
138 Serial.println(F(
"* *"));
139 Serial.println(F(
"* Set the baud rate to 115200 and select the newline terminator.*"));
140 Serial.println(F(
"* *"));
141 Serial.println(F(
"*****************************************************************"));
151 float full_scale = 10.24;
156 for (uint8_t
i = 0;
i <= 15; ++
i)
165 for (uint8_t
i = 1;
i <= 15; ++
i)
173 for (uint8_t
i = 0;
i<=15; ++
i)
177 Serial.print(F(
"Channel "));
181 Serial.print(F(
" : Ideal Voltage - "));
182 if (ideal_voltage >= 0)
184 Serial.print(ideal_voltage, 6);
185 if ((ideal_voltage < 10.0) && (ideal_voltage > -10.0))
187 Serial.print(F(
" V Measured Voltage - "));
190 Serial.print(voltage[i],6);
191 if ((voltage[i] < 10.0) && (voltage[i] > -10.0))
193 Serial.print(F(
" V difference - "));
194 if ((ideal_voltage-voltage[i]) >= 0)
196 Serial.print((ideal_voltage-voltage[i]),6);
197 Serial.println(
" V");
201 Serial.println(
"Test Complete\n");
#define LTC2668_SPAN_PLUS_MINUS_10V
#define LTC2668_CMD_MUX
Select MUX channel (controlled by 5 LSbs in data word)
static void print_title()
Prints the title block when program first starts.
static void loop()
Repeats Linduino loop.
float LTC2668_code_to_voltage(uint16_t dac_code, float min_output, float max_output)
Calculate the LTC2668 DAC output voltage given the DAC code, offset, and LSB.
Header File for Linduino Libraries and Demo Code.
int8_t LTC2668_write(uint8_t cs, uint8_t dac_command, uint8_t dac_address, uint16_t dac_code)
Write the 16-bit dac_code to the LTC2668.
float LTC2378_code_to_voltage(int32_t adc_code, uint8_t gain_compression, float vref)
Calculates the LTC2378 input voltage given the binary data and lsb weight.
LTC2376-20: 20-Bit, 250Ksps ADC LTC2377-20: 20-Bit, 500Ksps ADC LTC2378-20: 20-Bit, 1Msps ADC.
static void demo_board_test()
Set DAC's From -10V to 10V, Reads DAC Channels Through MUX, and Displays The Results.
void LTC2378_read(uint8_t cs, int32_t *ptr_adc_code)
Reads the LTC2378 and returns 32-bit data in 2's complement format.
LTC2668: 16-Channel SPI 16-/12-Bit +/-10V Vout SoftSpan DACs with 10ppm/C Max Reference.
#define LTC2668_CMD_SPAN_ALL
Set span for all DACs.
void quikeval_SPI_init(void)
Configure the SPI port for 4Mhz SCK.
LT_SPI: Routines to communicate with ATmega328P's hardware SPI port.
static void setup()
Initialize Linduino.
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.
void quikeval_SPI_connect()
Connect SPI pins to QuikEval connector through the Linduino MUX. This will disconnect I2C...
#define LTC2668_CMD_WRITE_N_UPDATE_N
Write to input register n, update (power-up)
void quikeval_I2C_init(void)
Initializes Linduino I2C port.
static void print_prompt()
Displays The Prompt.
#define LTC2668_MUX_ENABLE
#define LTC2668_CS
Define the SPI CS pin.