93 const char ack_error[] =
"Error: No Acknowledge. Check I2C Address.";
108 Serial.begin(115200);
113 Serial.println(F(
"Demo board not detected, will attempt to proceed"));
130 if (Serial.available())
133 if (user_command !=
'm')
134 Serial.println(user_command);
137 switch (user_command)
146 Serial.println(
"Incorrect Option");
151 Serial.print(F(
"*************************"));
163 Serial.println(F(
"\n*****************************************************************"));
164 Serial.print(F(
"* DC2156 Demonstration Program *\n"));
165 Serial.print(F(
"* *\n"));
166 Serial.print(F(
"* This program demonstrates the functionality of the LTC4316 *\n"));
167 Serial.print(F(
"* which is a Single/Dual I2C SMBus Remappper. The program *\n"));
168 Serial.print(F(
"* scans the addresses present on the bus and controls the *\n"));
169 Serial.print(F(
"* onboard remapped DACs to light LEDs *\n"));
170 Serial.print(F(
"* *\n"));
171 Serial.print(F(
"*****************************************************************\n"));
177 Serial.print(F(
"\n1- Scan Bus for Addresses\n"));
178 Serial.print(F(
"2- Control On Board DACs\n"));
179 Serial.print(F(
"\n"));
180 Serial.print(F(
"Enter a command: "));
190 for (
int addr = 0x00; addr <= maxAddr; addr++)
195 Serial.print(F(
"Bus is Busy. Aborting..."));
204 Serial.print(F(
"\n Address Found - #"));
205 Serial.print(addrCount);
206 Serial.print(F(
": "));
207 Serial.print(addr, HEX);
213 Serial.print(F(
" - Onboard EEPROM Address."));
216 Serial.print(F(
" - Through Global Address of LTC2631"));
219 Serial.print(F(
" - Remapped Global Address of LTC2631"));
222 Serial.print(F(
" - Through Jumper Setting of Onboard LTC2631"));
225 Serial.print(F(
" - Through Jumper Setting of Onboard LTC2631"));
228 Serial.print(F(
" - Through Jumper Setting of Onboard LTC2631"));
231 Serial.print(F(
" - Remapped Address of Onboard LTC2631 Based On Jumper Setting 12h"));
234 Serial.print(F(
" - Remapped Address of Onboard LTC2631 Based On Jumper Setting 11h"));
237 Serial.print(F(
" - Remapped Address of Onboard LTC2631 Based On Jumper Setting 11h"));
240 Serial.print(F(
" - Unknown Address Found. Possible external device connected and/or Non-Factory address selected."));
243 Serial.print(
"\n\n");
248 Serial.println(F(
"Nothing Found on Bus"));
260 uint8_t LTC2631_CMD_WRITE_UPDATE = 0x30;
261 uint16_t LTC2631_FULLSCALE_OUTPUT = 0xFFC0;
262 uint8_t through_address = 0;
263 uint8_t remapped_address = 0;
265 for (
int addr = 0x00; addr <= maxAddr; addr++)
271 Serial.print(F(
"Bus is Busy. Aborting..."));
284 through_address = addr;
289 remapped_address = addr;
296 Serial.print(F(
" - Unknown Address Found. Possible external device connected and/or Non-Factory address selected."));
299 Serial.print(
"\n\n");
305 Serial.print(F(
"*************************\n\n"));
306 Serial.print(F(
"Turn on DACs\n"));
307 Serial.print(F(
"1-Turn on Through DAC\n"));
308 Serial.print(F(
"2-Turn on Remapped DAC\n"));
309 Serial.print(F(
"3-Turn off Through DAC\n"));
310 Serial.print(F(
"4-Turn off Through DAC\n"));
311 Serial.print(F(
"m-Main Menu\n\n"));
312 Serial.print(F(
"Enter a command: "));
315 if (user_command !=
'm')
316 Serial.println(user_command);
317 if (user_command ==
'm')
321 switch (user_command)
324 ack |=
i2c_write_word_data(through_address,LTC2631_CMD_WRITE_UPDATE, LTC2631_FULLSCALE_OUTPUT);
327 ack |=
i2c_write_word_data(remapped_address,LTC2631_CMD_WRITE_UPDATE, LTC2631_FULLSCALE_OUTPUT);
335 if (user_command !=
'm')
336 Serial.println(
"Incorrect Option");
339 while (!(user_command ==
'm' || (ack)));
const int LTC4316_OFFSET
Demoboard offset.
unsigned char user_command
static void menu_1_scan_addresses()
Scan I2C Bus for addresses.
static void print_title()
Print the title block.
Header File for Linduino Libraries and Demo Code.
const int LTC2631_GLOBAL_ADDRESS
Global address of LTC2631 DAC.
void i2c_stop()
Write stop bit to the hardware I2C port.
int8_t i2c_start()
Write start bit to the hardware I2C port.
static uint8_t menu_2_DAC()
DAC Control Menu.
static int8_t demo_board_connected
Set to 1 if the board is connected.
const int EEPROM_ADDRESS
EEPROM Address on Demoboard.
int8_t i2c_write_word_data(uint8_t address, uint8_t command, uint16_t value)
Write a 16-bit word of data to register specified by "command".
int8_t i2c_write(uint8_t data)
Send a data byte to hardware I2C port.
static void setup()
Initialize Linduino.
const int LTC2631_JP_ADDRESS_3
Jumper Setting 3 on Demoboard.
const int LTC2631_JP_ADDRESS_2
Jumper Setting 2 on Demoboard.
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.
char demo_name[]
Demo Board Name stored in QuikEval EEPROM.
static void loop()
Repeats Linduino Loop.
const char ack_error[]
Error message.
const int LTC2631_JP_ADDRESS_1
Jumper Setting 1 on Demoboard.
void quikeval_I2C_init(void)
Initializes Linduino I2C port.
void quikeval_I2C_connect(void)
Switch MUX to connect I2C pins to QuikEval connector.
static void print_prompt()
Print the main menu prompt.