84 #define HARDCODED_CONSTANTS 85 #include <LiquidCrystal.h> 96 #define CS 9 // REMAPPED - requires a cut trace 100 const int16_t
RS = 3;
102 const int16_t
D4 = A0;
103 const int16_t
D5 = A1;
104 const int16_t
D6 = A2;
105 const int16_t
D7 = A3;
171 Serial.begin(115200);
174 lcd.print(
"LTC2492 Type K TC Meter");
175 Serial.println(
"LTC2492 Type K TC Meter");
197 float ch0_voltage, ch0_temp, ch1_voltage, ch1_temp;
207 Serial.println(
"Reading ADC...");
212 Serial.print(
"Got Code: "); Serial.println(
x, BIN);
213 Serial.println(
"Calculating Temp");
241 Serial.print(
"0T "); Serial.println(ch0_temp, 1);
243 Serial.print(
"1T "); Serial.println(ch1_temp, 1);
246 Serial.print(
"0V "); Serial.println(ch0_voltage,3);
248 Serial.print(
"1V "); Serial.println(ch1_voltage,3);
255 Serial.print(
"CJ TEMP %01.1f "); Serial.print(cj_temp, 1);
258 Serial.print(
"PT V "); Serial.print(
ptat_voltage,2); Serial.print(
"CJ V "); Serial.println(
cj_voltage, 2);
333 while(digitalRead(MISO)) {}
336 adc_code.by.te3 =
spi_read(channel);
343 adc_code.bits32 -= 536870912;
344 return adc_code.bits32;
369 Serial.print(
"vin_c dummy");
372 Serial.print(
"ptat_c dummy");
416 EEPROM.write(4,
vin_cal.by.te0);
417 EEPROM.write(5,
vin_cal.by.te1);
418 EEPROM.write(6,
vin_cal.by.te2);
419 EEPROM.write(7,
vin_cal.by.te3);
426 #ifdef HARDCODED_CONSTANTS 443 vin_cal.by.te0 = EEPROM.read(4);
444 vin_cal.by.te1 = EEPROM.read(5);
445 vin_cal.by.te2 = EEPROM.read(6);
446 vin_cal.by.te3 = EEPROM.read(7);
LiquidCrystal lcd(RS, E, D4, D5, D6, D7)
static void calibrate(void)
#define output_high(pin)
Set "pin" high.
#define LTC24XX_MULTI_CH_P1_N0
Header File for Linduino Libraries and Demo Code.
int8_t LTC24XX_EOC_timeout(uint8_t cs, uint16_t miso_timeout)
Checks for EOC with a specified timeout.
static void read_calibration(void)
static uint8_t channel
LTC2305 Channel selection.
static int32_t read_LTC2492(char channel, char config)
LTC24XX General Library: Functions and defines for all SINC4 Delta Sigma ADCs.
void LTC24XX_SPI_16bit_command_32bit_data(uint8_t cs, uint8_t adc_command_high, uint8_t adc_command_low, int32_t *adc_code)
Reads from LTC24XX ADC that accepts a 16 bit configuration and returns a 32 bit result.
#define LTC24XX_MULTI_CH_P3_N2
#define output_low(pin)
Set "pin" low.
void quikeval_SPI_init(void)
Configure the SPI port for 4Mhz SCK.
LT_SPI: Routines to communicate with ATmega328P's hardware SPI port.
#define LTC24XX_EZ_MULTI_PTAT
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.
#define LTC24XX_EZ_MULTI_SLOW
float LTC24XX_diff_code_to_voltage(int32_t adc_code, float vref)
Calculates the voltage corresponding to an ADC code, given the reference voltage. ...
void quikeval_SPI_connect()
Connect SPI pins to QuikEval connector through the Linduino MUX. This will disconnect I2C...
int8_t spi_read(int8_t data)
The data byte to be written.
static float type_K_V2C(float tc_voltage, float cj_voltage)
#define QUIKEVAL_CS
QuikEval CS pin (SPI chip select on QuikEval connector pin 6) connects to Arduino SS pin...
#define LTC24XX_EZ_MULTI_R55
#define LTC24XX_EZ_MULTI_VIN