uint8_t connected_sensors = 0x1a;
+uint8_t measurement_step;
//measurement_active gets set once per second
//do_measurement_step is called once every 2ms by main as long as measurement_active is set.
-//'time' gives the number of the current step
+//'measurement_step' gives the number of the current step
//when done, set measurement_active to 0
//calibration data is in 'calib_settings'
//2 send information
//3 sleep
//... repeat 8 times
-//32 read ADC temperature as 9th channel
-//33 send ADC temperature, finished
+//32 read ADCinput 3 (VCC)
+//33 send ADCinput 3
+//34 read ADC temperature as 9th channel
+//35 send ADC temperature
+
void do_measurement_step(void) {
- if(time == 0) {
+ if(measurement_step == 0) {
LED1_ON();
}
- else if(time == 34) {
+ else if(measurement_step == 36) {
measurement_active = 0;
LED1_OFF();
+ measurement_step = 0;
}
}
//answers: message is started with b=0, increased with every step
//c: Channel
-//10 words send for each measurement:
+//11 words send for each measurement:
//ATbcXXXXXX -- Measured temperature. value is temperature in mK
//ATb800XXXX -- Temperature given by ADC
//AIb0FFFFCC -- Firmware version & connected channels (bitmask) in last byte
+//AVb000XXXX -- Vcc from ADC channel 3, in mV
//Commands sent by user
//WEb0AAXXXX -- write int16 to eeprom at address AA*2