160 Serial.begin(115200);
176 uint8_t acknowledge = 0;
177 if (Serial.available())
180 if (user_command !=
'm')
181 Serial.println(user_command);
183 switch (user_command)
192 Serial.println(F(
"Incorrect Option"));
195 Serial.println(F(
"***** I2C ERROR *****"));
196 Serial.print(F(
"\n****************************** Press Enter to Continue ******************************\n"));
208 value = value & 0x7F;
209 value = value | 0x04;
218 Serial.print(F(
"\nChecking EEPROM contents..."));
225 Serial.print(
"Demo Board Name: ");
227 Serial.print(
"Product Name: ");
231 Serial.print(
"Demo Board Option: ");
234 Serial.println(F(
"Demo board connected"));
235 Serial.println(F(
"\n\n\t\t\t\tPress Enter to Continue..."));
241 Serial.print(
"Demo board ");
242 Serial.print(demo_name);
243 Serial.print(
" not found, \nfound ");
245 Serial.println(
" instead. \nConnect the correct demo board, then press the reset button.");
253 Serial.print(F(
"\n*****************************************************************\n"));
254 Serial.print(F(
"* DC2094A Demonstration Program *\n"));
255 Serial.print(F(
"* *\n"));
256 Serial.print(F(
"* This program demonstrates how to send data and receive data *\n"));
257 Serial.print(F(
"* from the 18-bit ADC. *\n"));
258 Serial.print(F(
"* *\n"));
259 Serial.print(F(
"* *\n"));
260 Serial.print(F(
"* Set the baud rate to 115200 and select the newline terminator.*\n"));
261 Serial.print(F(
"* *\n"));
262 Serial.print(F(
"*****************************************************************\n"));
268 Serial.println(F(
"\n\n\n\t\t\t\tCONFIGURATION SETTINGS (Vref = 4.096V)\n"));
269 Serial.println(F(
"|Config Number| SS2 | SS1 | SS0 | ANALOG INPUT RANGE | DIGITAL COMPRESSION | RESULT BINARY FORMAT |"));
270 Serial.println(F(
"|-------------|-----------------|-------------------------|---------------------|----------------------|"));
271 Serial.println(F(
"| 0 | 0 | 0 | 0 | Disable Channel | N/A | All Zeros |"));
272 Serial.println(F(
"| 1 | 0 | 0 | 1 | 0 - 1.25 Vref | 1 | Straight Binary |"));
273 Serial.println(F(
"| 2 | 0 | 1 | 0 | -1.25 Vref - +1.25 Vref | 1/1.024 | Two's Complement |"));
274 Serial.println(F(
"| 3 | 0 | 1 | 1 | -1.25 Vref - +1.25 Vref | 1 | Two's Complement |"));
275 Serial.println(F(
"| 4 | 1 | 0 | 0 | 0 - 2.5 Vref | 1/1.024 | Straight Binary |"));
276 Serial.println(F(
"| 5 | 1 | 0 | 1 | 0 - 2.5 Vref | 1 | Straight Binary |"));
277 Serial.println(F(
"| 6 | 1 | 1 | 0 | -2.5 Vref - +2.5 Vref | 1/1.024 | Two's Complement |"));
278 Serial.println(F(
"| 7 | 1 | 1 | 1 | -2.5 Vref - +2.5 Vref | 1 | Two's Complement |"));
280 Serial.print(F(
"\n\n\n\t\t\t\tOPTIONS\n"));
281 Serial.print(F(
"\n1 - Display ADC output\n"));
282 Serial.print(F(
"2 - Change configuration setting\n"));
284 Serial.print(F(
"\nENTER A COMMAND: "));
289 uint8_t
channel, config_number;
294 config_number = channel_data &
SOFTSPAN;
295 code = (channel_data & 0xFFFFC0) >> 6;
298 Serial.print(F(
"\nChannel : "));
299 Serial.print(channel);
300 Serial.print(F(
"\t\tData : 0x"));
301 Serial.println(code, HEX);
302 Serial.print(F(
"Voltage : "));
303 Serial.print(voltage, 6);
304 Serial.print(F(
" V"));
305 Serial.print(F(
"\tConfig Number: "));
306 Serial.println(config_number);
312 uint8_t display_channels;
317 Serial.print(
"\nEnter the number of channels to be displayed: ");
319 if (display_channels < 1)
320 display_channels = 1;
324 while (!Serial.available())
327 Serial.println(F(
"\n********************************************"));
330 for (
int i = 0;
i < display_channels; ++
i)
344 uint32_t config_word = 0;
348 Serial.print(F(
"\nEnter configuration number for channel "));
350 Serial.print(F(
": "));
359 Serial.print(
"\nConfig word: 0x");
360 Serial.println(config_word, HEX);
362 Serial.print(F(
"\nCONFIGURATION CHANGED!"));
struct demo_board_type demo_board
Instantiate demo board structure.
char option
Demo Circuit option (A)
static uint8_t demo_board_connected
Set to 1 if the board is connected.
unsigned char user_command
int8_t i2c_write_byte(uint8_t address, uint8_t value)
Write "value" byte to device at "address".
uint8_t LT_byte[4]
4 bytes (unsigned 8-bit integers) to be converted to a 32-bit signed or unsigned integer ...
char name[15]
Demo Circuit number (DC1678)
static uint8_t num_of_bits
Header File for Linduino Libraries and Demo Code.
uint32_t LT_uint32
32-bit unsigned integer to be converted to four bytes
static uint8_t channel
LTC2305 Channel selection.
static void print_title()
Prints the title block when program first starts.
void LTC23XX_create_config_word(uint8_t channel, uint8_t config_number, uint32_t *config_word)
Creates 24-bit configuration word for the 8 channels.
static uint8_t num_of_channels
float LTC23XX_voltage_calculator(uint32_t data, uint8_t channel_configuration)
Calculates the voltage from ADC output data depending on the channel configuration.
static void menu1_display_adc_output()
Displays the ADC output and calculated voltage for all channels.
union LT_union_int32_4bytes data
static void print_prompt()
Prints main menu.
static uint8_t discover_DC2094(char *demo_name)
Read the ID string from the EEPROM and determine if the correct board is connected.
void LTC23XX_read(uint8_t cs_pin, uint32_t config_word, uint8_t data_array[24])
Transmits 24 bits (3 bytes) of configuration information and reads back 24 bytes of data (3 bytes/ 24...
static void menu2_change_softspan_range()
Function to change the configuration setting.
void quikeval_SPI_init(void)
Configure the SPI port for 4Mhz SCK.
LT_SPI: Routines to communicate with ATmega328P's hardware SPI port.
LTC2348-18: Octal, 18-Bit, 200ksps Differential ±10.24V Input SoftSpan ADC with Wide Input Common Mod...
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.
char demo_name[]
Demo Board Name stored in QuikEval EEPROM.
void quikeval_SPI_connect()
Connect SPI pins to QuikEval connector through the Linduino MUX. This will disconnect I2C...
This union splits one int32_t (32-bit signed integer) or uint32_t (32-bit unsigned integer) four uint...
char product_name[15]
LTC Product (LTC2654-L16)
static void setup()
Initialize Linduino.
void quikeval_I2C_init(void)
Initializes Linduino I2C port.
static void loop()
Repeats Linduino Loop.
#define SNEAKER_PORT_I2C_ADDRESS
static void sneaker_port_init()
Configure sneaker port to talk to the ADC.
#define QUIKEVAL_CS
QuikEval CS pin (SPI chip select on QuikEval connector pin 6) connects to Arduino SS pin...
uint8_t read_quikeval_id_string(char *buffer)
Read the id string from the EEPROM, then parse the product name, demo board name, and demo board opti...
char ui_buffer[UI_BUFFER_SIZE]
int8_t i2c_read_byte(uint8_t address, uint8_t *value)
Read a byte, store in "value".
static void decode_values(uint32_t channel_data)
union LT_union_int32_4bytes configuration_bits