98 if (Serial.available())
101 if (user_command !=
'm')
102 Serial.println(user_command);
104 switch (user_command)
113 Serial.println(F(
"Invalid Option"));
117 Serial.println(F(
"*************************\n"));
131 adc_code = (adc_code >> 4) & 0x0FFF;
133 Serial.print(
"\nMeasured Voltage = ");
134 Serial.println(voltage);
142 Serial.println(F(
"\n 0 = Bipolar"));
143 Serial.println(F(
" 1 = Unipolar"));
144 Serial.print(F(
" Enter an option: "));
147 Serial.println(user_command);
148 switch (user_command)
151 Serial.println(F(
"\n Bipolar mode selected"));
155 Serial.println(F(
"\n Unipolar mode selected"));
159 Serial.println(
"\n Invalid Option");
169 Serial.println(F(
"*****************************************************************"));
170 Serial.println(F(
"* DC1339A Demonstration Program *"));
171 Serial.println(F(
"* *"));
172 Serial.println(F(
"* This program demonstrates how to send data and receive data *"));
173 Serial.println(F(
"* from the LTC2302 12-bit ADC. *"));
174 Serial.println(F(
"* *"));
175 Serial.println(F(
"* Set the baud rate to 115200 and select the newline terminator.*"));
176 Serial.println(F(
"* *"));
177 Serial.println(F(
"*****************************************************************"));
184 Serial.println(F(
" OPTIONS\n"));
185 Serial.println(F(
"1-Read ADC Input "));
186 Serial.println(F(
"2-Select Unipolar / Bipolar measurement (default is Unipolar)"));
188 Serial.print(F(
"Enter a command: "));
static void print_prompt()
Prints main menu.
unsigned char user_command
void LTC2302_read(uint8_t cs, uint16_t adc_command, uint16_t *adc_code)
Reads the ADC and returns 16-bit data.
static uint8_t adc_command
static void loop()
Repeats Linduino loop.
LTC2302: 12-Bit, 1-Channel 500ksps SAR ADC with SPI Interface.
static float LTC2302_vref
static void menu_1_read_input()
Read ADC code and display the measured voltage.
Header File for Linduino Libraries and Demo Code.
static void print_title()
Prints the title block when program first starts.
float LTC2302_code_to_voltage(uint16_t adc_code, float vref, uint8_t uni_bipolar)
Calculates the LTC2302 input voltage given the data, range, and unipolar/bipolar status.
static uint16_t uni_bipolar
Default set for unipolar mode.
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 menu_2_select_uni_bipolar()
Select unipolar (0-VREF) or bipolar (+/- 0.5 x VREF) mode.
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...
static void setup()
Initialize Linduino.
void quikeval_I2C_init(void)
Initializes Linduino I2C port.
#define QUIKEVAL_CS
QuikEval CS pin (SPI chip select on QuikEval connector pin 6) connects to Arduino SS pin...