65 #define LTC2970_I2C_ADDRESS 0x5B //global 7-bit address 112 if (Serial.available())
115 if (user_command !=
'm')
116 Serial.println(user_command);
118 switch (user_command)
122 Serial.print(F(
"\n****INITIALIZING THE LTC2970****\n"));
127 Serial.print(F(
"\n****ENABLE LTC2970 CHANNEL 0 AND CHANNEL 1****\n"));
136 Serial.print(F(
"\n****SOFT CONNECT LTC2970 DAC0 and DAC1****\n"));
142 Serial.print(F(
"\n****SERVO CHANNEL 0 and 1 VOLTAGES 10% LOW****\n"));
148 Serial.print(F(
"\n****SERVO CHANNEL 0 and 1 VOLTAGES TO NOMINAL****\n"));
154 Serial.print(F(
"\n****ADC CH_0 VOLTAGE = (HEX VALUE)\n"));
156 Serial.println(((return_val & 0x7FFF)*500e-6), DEC);
157 Serial.println(return_val, HEX);
159 Serial.print(F(
"\n****ADC CH_1 VOLTAGE = (HEX VALUE)\n"));
161 Serial.println(((return_val & 0x7FFF)*500e-6), DEC);
162 Serial.println(return_val, HEX);
166 Serial.print(F(
"\n****ADC CH_0 CURRENT = (HEX VALUE)\n"));
168 Serial.println((((return_val & 0x7FFF)*500e-6)/0.007), DEC);
169 Serial.println(return_val, HEX);
171 Serial.print(F(
"\n****ADC CH_1 CURRENT = (HEX VALUE)\n"));
173 Serial.println((((return_val & 0x7FFF)*500e-6)/0.008), DEC);
174 Serial.println(return_val, HEX);
178 Serial.print(F(
"\n****PRINT FAULTS, CLEAR LATCHED FAULTS \n"));
183 Serial.print(F(
"\n****PRINT DIE TEMPERATURE \n"));
188 Serial.println(F(
"Incorrect Option"));
203 Serial.print(F(
"\n***************************************************************\n"));
204 Serial.print(F(
"* DC980 Regulator Control Program *\n"));
205 Serial.print(F(
"* *\n"));
206 Serial.print(F(
"* This program provides a simple interface to control the *\n"));
207 Serial.print(F(
"* the DC980 regulators through the LTC2970 *\n"));
208 Serial.print(F(
"* *\n"));
209 Serial.print(F(
"* Set the baud rate to 115200 and select the newline terminator.*\n"));
210 Serial.print(F(
"* *\n"));
211 Serial.print(F(
"*****************************************************************\n"));
218 Serial.print(F(
"\n"));
219 Serial.print(F(
" 1 - Reset the LTC2970, Disable Regulators\n"));
220 Serial.print(F(
" 2 - Enable Channel 0 and Channel 1; DACs disconnected\n"));
221 Serial.print(F(
" 3 - Soft-Connect DAC0 and DAC1, and Confirm Connection\n"));
222 Serial.print(F(
" 4 - Servo Channel 0 and Channel 1 Voltages 10% low\n"));
223 Serial.print(F(
" 5 - Servo Channel 0 and Channel 1 Voltages to nominal\n"));
224 Serial.print(F(
" 6 - Print Channel 0 & 1 Voltages\n"));
225 Serial.print(F(
" 7 - Print Channel 0 & 1 Currents\n"));
226 Serial.print(F(
" 8 - Print Fault Register Contents\n"));
227 Serial.print(F(
" 9 - Print LTC2970 Temperature\n"));
228 Serial.print(F(
"\nEnter a command number:"));
static void ltc2970_configure()
Writes configuration values to the LTC2970 registers.
static uint8_t ltc2970_i2c_address
unsigned char user_command
#define LTC2970_CH1_A_SERVO
static uint16_t servo0_value_marg
static void loop()
Main Linduino loop.
void writeWord(uint8_t address, uint8_t command, uint16_t data)
SMBus write word command.
static void print_title()
Prints the title block when program first starts.
Header File for Linduino Libraries and Demo Code.
#define LTC2970_CH0_A_SERVO
void ltc2970_print_die_temp(LT_SMBus *smbus, uint8_t ltc2970_i2c_address)
Prints die temperature on the LTC2970.
void ltc2970_read_faults(LT_SMBus *smbus, uint8_t ltc2970_i2c_address)
Read FAULT, FAULT_LA, and FAULT_LA_INDEX registers print the results.
#define LTC2970_I2C_ADDRESS
#define LTC2970_CH0_B_ADC
static uint16_t servo1_value_marg
#define LTC2970_CH0_A_ADC
static LT_SMBusNoPec * smbus
static uint16_t servo1_value_nom
void ltc2970_dac_disconnect(LT_SMBus *smbus, uint8_t ltc2970_i2c_address, int dac_number)
Disconnect a DAC from its channel.
void ltc2970_servo_to_adc_val(LT_SMBus *smbus, uint8_t ltc2970_i2c_address, int channel_number, uint16_t code)
Servo once to a given ADC value.
#define LTC2970_CH0_A_IDAC
LTC SMBus Support: Implementation for a shared SMBus layer.
Header for LTC2970: Dual I2C Power Supply Monitor and Margining Controller.
static void setup()
Initialize Linduino.
int ltc2970_soft_connect_dac(LT_SMBus *smbus, uint8_t ltc2970_i2c_address, int dac_number)
soft-connect DACn to its controlled node
#define LTC2970_CH1_B_ADC
#define LTC2970_CH1_A_IDAC
#define LTC2970_CH1_A_ADC
void ltc2970_gpio_up(LT_SMBus *smbus, uint8_t ltc2970_i2c_address, int gpio_number)
Set GPIO_n high.
static uint16_t servo0_value_nom
static void print_prompt()
Prints main menu.
uint16_t readWord(uint8_t address, uint8_t command)
SMBus read word command.