Commit a11e0b3d authored by Martin Vítek's avatar Martin Vítek
Browse files

Add supply voltage ADC conversion

parent b1216078
......@@ -108,8 +108,13 @@ class ADC
ADCA.CTRLA |= ADC_CH0START_bm;
break;
default:
default: convert_adc_values();
break;
}
}
void convert_adc_values()
{
results[SUPPLY_VOLTAGE] = 244UL * (uint32_t)adc_results[SUPPLY_VOLTAGE] * 28UL / 1079UL / 10UL;
}
};
......@@ -125,9 +125,10 @@ void SafeSolderingStation::test_adc()
adc.start_conversion();
_delay_ms(20);
lcd.gotoxy_new(0,5);
lcd.gotoxy_new(0,4);
lcd.write_num(adc.adc_results[adc.AVCC]);
lcd.gotoxy_new(1,5);
lcd.write_num(adc.adc_results[adc.SUPPLY_VOLTAGE]);
lcd.gotoxy_new(1,4);
//lcd.write_num(adc.adc_results[adc.SUPPLY_VOLTAGE]);
lcd.write_num(adc.results[adc.SUPPLY_VOLTAGE]);
}
......@@ -12,10 +12,10 @@ int main()
sss.wellcome();
sss.lcd.gotoxy_new(0,0);
sss.lcd.write_text("3V4: ");
sss.lcd.write_text("3V4: ");
sss.lcd.gotoxy_new(1,0);
sss.lcd.write_text("24V: ");
sss.lcd.write_text("24V: V");
for(;;)
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment