Changeset - a7b1f3353188
[Not reviewed]
default
0 3 0
ethanzonca@CL-ENS241-08.cedarville.edu - 12 years ago 2013-03-15 16:31:12
ethanzonca@CL-ENS241-08.cedarville.edu
Calibrated battery voltage measurement for master
3 files changed with 8 insertions and 4 deletions:
0 comments (0 inline, 0 general)
master/master/config.h
Show inline comments
 
@@ -35,7 +35,7 @@
 
#define BLACKOUT_TIMEOUT 300000 // Blackout after 5 minutes (hopefully after fix)
 
 
// Board heater setpoint
 
#define HEATER_THRESHOLD 60
 
#define HEATER_THRESHOLD 80
 
 
// Touchdown buzzer
 
#define BUZZER_RATE 3000
master/master/lib/sensors.c
Show inline comments
 
@@ -27,7 +27,6 @@ void sensors_setup()
 
}
 
 
int8_t	boardTemp = 255;	// Board Temperature (from i2c)
 

	
 
void sensors_readBoardTemp()
 
{
 
	boardTemp = i2c_read(BOARDTEMP_ADDR, 0x00);		// Read only the first byte of data (we don't need the resolution here)
 
@@ -41,16 +40,17 @@ int8_t sensors_getBoardTemp(void)
 
}
 
 
uint16_t batt;		// Battery voltage (from ADC)
 
 
uint16_t vBatt;
 
void sensors_readBatt()
 
{
 
	uint8_t battL = ADCL;					// Read low battery byte from ADC (all 8 bits)
 
	batt = ADCH;					// Read high battery byte from ADC (only two LSBs)
 
	batt = batt << 8;
 
	batt |= battL;
 
	vBatt = (batt * 10.0) / 67.4;
 
}
 
 
uint16_t sensors_getBatt(void)		// Gets battery voltage from variable
 
{
 
	return batt;
 
	return vBatt;
 
}
 
\ No newline at end of file
master/master/master.c
Show inline comments
 
@@ -107,6 +107,10 @@ int main(void)
 
			
 
			sensors_readBoardTemp();
 
			sensors_readBatt();
 
			
 
			//char buftmp[15];
 
			//snprintf(buftmp, 15, "vbatt: %u\r\n", sensors_getBatt());
 
			//serial0_sendString(buftmp);
 
		
 
			// Write CSV header and log data values
 
			sensordata_logvalues();			
0 comments (0 inline, 0 general)