102 Serial.begin(115200);
117 if (Serial.available())
120 if (user_command !=
'm')
121 Serial.println(user_command);
122 switch (user_command)
137 Serial.println(F(
"Invalid Option"));
161 display_code = adc_code >> 4;
162 display_code = display_code & 0xFFFF;
164 Serial.print(F(
" Received Code: 0x"));
165 Serial.println(display_code, HEX);
170 if (adc_code & 0x100000)
173 adc_voltage = adc_voltage * (-1);
176 Serial.print(F(
" Equivalent voltage: "));
177 Serial.print(adc_voltage, 4);
178 Serial.println(F(
" V"));
188 Serial.print(F(
" Select a gain (1, 4, 8, 16, 32, 64, 128, 256): "));
191 Serial.println(user_command);
192 switch (user_command)
197 Serial.println(F(
" Gain = 1"));
202 Serial.println(F(
" Gain = 4"));
207 Serial.println(F(
" Gain = 8"));
212 Serial.println(F(
" Gain = 16"));
217 Serial.println(F(
" Gain = 32"));
222 Serial.println(F(
" Gain = 64"));
227 Serial.println(F(
" Gain = 128"));
232 Serial.println(F(
" Gain = 256"));
236 Serial.println(F(
" Invalid Option"));
250 Serial.println(F(
" 0: Simultaneous 50Hz/60Hz rejection"));
251 Serial.println(F(
" 1: 50Hz Rejection"));
252 Serial.println(F(
" 2: 60Hz Rejection"));
253 Serial.print(F(
" Enter the required rejection mode: "));
256 Serial.println(user_command);
258 switch (user_command)
261 Serial.println(F(
"Selected simultaneous 50Hz/60Hz rejection"));
265 Serial.println(F(
"Selected 50Hz Rejection"));
269 Serial.println(F(
"Selected 60Hz rejection"));
274 Serial.println(F(
" Invalid Option"));
284 Serial.print(F(
"\n Enter the reference voltage: "));
287 Serial.println(F(
" V"));
295 Serial.print(F(
"\n*****************************************************************\n"));
296 Serial.print(F(
"* DC798B Demonstration Program *\n"));
297 Serial.print(F(
"* *\n"));
298 Serial.print(F(
"* This program demonstrates how to send data and receive data *\n"));
299 Serial.print(F(
"* from the 16-bit ADC. *\n"));
300 Serial.print(F(
"* *\n"));
301 Serial.print(F(
"* *\n"));
302 Serial.print(F(
"* Set the baud rate to 115200 and select the newline terminator.*\n"));
303 Serial.print(F(
"* *\n"));
304 Serial.print(F(
"*****************************************************************\n"));
310 Serial.print(F(
"\n1-Read Input\n"));
311 Serial.print(F(
"2-Select Gain\n"));
312 Serial.print(F(
"3-Select Rejection\n"));
313 Serial.print(F(
"4-Change reference voltage\n"));
314 Serial.print(F(
"\nEnter a Command: "));
static void print_title()
Prints the title block when program first starts.
static void loop()
Repeats Linduino loop.
unsigned char user_command
void LTC2480_read(uint8_t cs, uint32_t *ptr_adc_code)
Reads the LTC2480 and returns 24-bit data.
static float LTC2480_range
Header File for Linduino Libraries and Demo Code.
#define LTC2480_CS
Define the SPI CS pin.
static float LTC2480_vref
static void setup()
Initialize Linduino.
LTC2480: 16-Bit Delta-Sigma ADC with Easy Drive Input Current Cancellation.
static uint8_t LTC2480_gain_selection
LTC24XX General Library: Functions and defines for all SINC4 Delta Sigma ADCs.
static void menu_3_select_rejection()
Select frequency rejection.
void quikeval_SPI_init(void)
Configure the SPI port for 4Mhz SCK.
int8_t discover_demo_board(char *demo_name)
Read the ID string from the EEPROM and determine if the correct board is connected.
static void menu_2_select_gain()
Select number of bits.
void LTC2480_set_modes(uint8_t cs, uint8_t gain_selection, uint8_t rejection_mode)
Function to set the input voltage gain and frequency rejection mode.
LT_SPI: Routines to communicate with ATmega328P's hardware SPI port.
static void menu_4_reference_voltage()
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.
static uint8_t LTC2480_rejection_mode
static void print_prompt()
Prints main menu.
static void menu_1_read_input()
Read channel.
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...
static int32_t display_code
float LTC2480_code_to_voltage(uint32_t adc_code, float vref, uint8_t gain)
Calculates the LTC2480 input voltage given the binary data, reference voltage and input gain...
void quikeval_I2C_init(void)
Initializes Linduino I2C port.
static uint8_t demo_board_connected
Set to 1 if the board is connected.
static uint8_t LTC2480_gain