106 Serial.begin(115200);
119 if (Serial.available())
122 if (user_command !=
'm')
123 Serial.println(user_command);
124 switch (user_command)
136 Serial.println(
"Incorrect Option");
154 Serial.print(F(
"\n Data : 0x"));
155 Serial.println(code, HEX);
156 Serial.print(F(
" DF : "));
158 Serial.print(F(
" Input Voltage : "));
159 Serial.print(voltage, 9);
160 Serial.println(F(
" V"));
168 Serial.print(F(
"\n Enter the new DF option (1-4, 2-8, 3-16, 4-32) : "));
170 Serial.println(user_command);
171 switch (user_command)
190 Serial.println(
"Incorrect Option");
200 Serial.println(F(
"\n Remove the R37 resistor and probe in the new reference voltage at VREF"));
201 Serial.print(F(
"\n Enter the new reference voltage : "));
204 Serial.println(F(
" V"));
216 uint8_t i2c_data[48];
224 for (i = 0; i < 48; ++
i)
246 uint8_t *p = i2c_data;
247 for (i = 0; i < 16; ++
i)
249 set_bit = (value >>
i) & 0x01;
279 Serial.print(F(
"\n************************************************************************\n"));
280 Serial.print(F(
"* DC2222AB Demonstration Program *\n"));
281 Serial.print(F(
"* *\n"));
282 Serial.print(F(
"* This program demonstrates how to configure LTC2512 to set DF value, *\n"));
283 Serial.print(F(
"* and to read out 24 bits of data and configuration information *\n"));
284 Serial.print(F(
"* *\n"));
285 Serial.print(F(
"* Setup: *\n"));
286 Serial.print(F(
"* Set the baud rate to 115200 and select the newline terminator. *\n"));
287 Serial.print(F(
"* Power the board with +/- 9V or 10 V. *\n"));
288 Serial.print(F(
"* *\n"));
289 Serial.print(F(
"* NOTES: *\n"));
290 Serial.print(F(
"* Please note that LTC2512 requires 10 samples to settle and hence, *\n"));
291 Serial.print(F(
"* the first few samples do not reflect the exact input voltage. *\n"));
292 Serial.print(F(
"* *\n"));
293 Serial.print(F(
"************************************************************************\n"));
299 Serial.print(F(
"\nMain Menu:\n"));
300 Serial.print(F(
" 1-Read Voltage input\n"));
301 Serial.print(F(
" 2-Change DF\n"));
302 Serial.print(F(
" 3-Set VREF\n"));
303 Serial.print(F(
"\nEnter a command:"));
static void initialise_i2c_data(uint16_t value, uint8_t i2c_data[48])
unsigned char user_command
int8_t i2c_write_byte(uint8_t address, uint8_t value)
Write "value" byte to device at "address".
static void menu_3_set_VREF()
Function to change the voltage reference.
Header File for Linduino Libraries and Demo Code.
static uint16_t decode_DF_value(uint8_t byte0)
static uint16_t global_config_data
float LTC2512_code_to_voltage(int32_t code, float vref)
Calculates the output voltage from the given digital code and reference voltage.
static uint16_t num_of_mclk_pulses
static void print_prompt()
Prints main menu.
#define QUIKEVAL_GPIO
Linduino QuikEval GPIO pin (QuikEval connector pin 14) connects to Arduino pin 9. ...
static void menu_1_read_voltage()
Displays the ADC output and calculated voltage.
void quikeval_SPI_init(void)
Configure the SPI port for 4Mhz SCK.
static void menu_2_change_DF()
Function to change the DF value for filter.
static void sneaker_port_init()
Send configuration data through sneaker port.
LT_SPI: Routines to communicate with ATmega328P's hardware SPI port.
LTC2512: 24-Bit Over-Sampling ADC with Configurable Digital Filter.
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.
static float code_to_voltage(uint8_t rx[5])
void quikeval_SPI_connect()
Connect SPI pins to QuikEval connector through the Linduino MUX. This will disconnect I2C...
uint32_t LTC2512_read_data(uint8_t QUIKEVAL_CS, uint16_t *DF)
Reads 4 bytes of data on SPI - D23:D0 + W7:W0.
static int8_t i2c_write_block_data_no_command(uint8_t address, uint8_t length, uint8_t *values)
void quikeval_I2C_init(void)
Initializes Linduino I2C port.
void quikeval_I2C_connect(void)
Switch MUX to connect I2C pins to QuikEval connector.
#define QUIKEVAL_CS
QuikEval CS pin (SPI chip select on QuikEval connector pin 6) connects to Arduino SS pin...
static void print_title()
Prints the title block when program first starts.
#define SNEAKER_PORT_ADDRESS
void send_pulses(uint8_t pin, uint16_t num_of_pulses)
Send n num of pulses on pin given.