calib_settings.nominal_offset = eeprom_read(8);
calib_settings.gain_current = eeprom_read(9);
calib_settings.period = eeprom_read(10);
+ calib_settings.uselcd = eeprom_read(11);
}
/******************
next_step = 0;
if (measurement_active) {do_measurement_step();}
if (next_second && !measurement_active) {
- lcd_update();
+ if(calib_settings.uselcd)
+ lcd_update();
next_second = 0;
}
if(key_was_pressed(1<<KEY_1)) {}
uint16_t nominal_offset; //approximate offset resistor, in Ohm, 100 as default
uint16_t gain_current; //2^29 / (gain * current[uA]) (about 53700)
uint16_t period; //measurement period in timer ticks (2ms)
+ uint16_t uselcd; //set to 0 to disable LCD
};
uint8_t measurement_step = 0;
uint8_t current_channel = 0;
uint8_t num_connected_sensors = 8;
-const uint16_t connect_threshold = 0xd000;
+uint16_t connect_threshold = 0xffff;
//factors: gain_current has 2^29, ADC has 2^7 steps per mV
//hence shift by 36 necessary, 6 as part of multiplication by 1E6
//35 send ADC temperature
// should be
- // (5 - 2.2E3 * 410E-6) / 2 = 2.049 V if on
- // (5 - 2.2E3 * 10E-6) / 2 = 2.489 V if off
+ // (5 - 2.2E3 * 400E-6) / 2 = 2.049 V if on
+ // (5 - 2.2E3 * 400E-6) / 2 = 2.489 V if off
// -> compare to 2.27 V or (2.27/2.56)*2^16 = 58112
void do_measurement_step(void) {
}
current_channel += 1;
}
+ else if(measurement_step == 33) {
+ ADCSRA |= (1<<ADSC); //start ADC conversion
+ }
+ else if(measurement_step == 34) {
+ con = ADCL;
+ con += (ADCH<<8);
+ connect_threshold = con - 7000;
+ }
measurement_step += 1;
if(measurement_step == 36) {
measurement_step = 0;