Changeset - 6646841229cc
[Not reviewed]
default
0 3 0
mkroening@CL-ENS241-07.cedarville.edu - 12 years ago 2013-04-04 17:01:04
mkroening@CL-ENS241-07.cedarville.edu
Humid and press
3 files changed with 10 insertions and 10 deletions:
0 comments (0 inline, 0 general)
slave/slave/lib/i2c.c
Show inline comments
 
@@ -345,10 +345,8 @@ uint16_t i2c_humidRead()
 
	
 
	i2c_start(HUMID_ADDR+I2C_READ);		// Measurement Request	
 
 
	i2c_readAck();               // read one byte
 
	i2c_readNak();
 
	data = i2c_readAck();               // read one byte
 
	dataL = i2c_readAck();	
 
	dataL = i2c_readNak();
 
	i2c_stop();
 
	
 
	data = data << 8;
slave/slave/lib/inputOutput.c
Show inline comments
 
@@ -43,7 +43,7 @@ int8_t	moduleID;	// Slave Module ID from
 
 void io_readModuleId()
 
 {
 
	// Get ID from rotary dip and return it. 
 
	moduleID = 2;
 
	moduleID = 0;
 
	
 
	/*
 
	// This method is temporary as the next release will read the module ID from EEPROM
 
@@ -57,10 +57,10 @@ int8_t	moduleID;	// Slave Module ID from
 
	moduleID = (moduleID & 0b0111);				//Mask bits
 
	*/
 
 
	//while(moduleID==0)           //UNCOMMENT ALL THIS
 
	//{
 
	//	moduleID = i2c_read(EEPROM_ADDR, 0x05);
 
	//}
 
	while(moduleID==0)           //UNCOMMENT ALL THIS
 
	{
 
		moduleID = i2c_read(EEPROM_ADDR, 0x05);
 
	}
 
 }
 
 
 
 
slave/slave/lib/sensors.c
Show inline comments
 
@@ -186,9 +186,10 @@ void sensors_readPressure()
 
	x1 = (x1 * 3038) >> 16;
 
	x2 = (-7357 * pressure) >> 16;
 
	pressure += (x1 + x2 + 3791) >> 4;				//This is the final value for our pressure
 
	pressure = pressure - 21000;	// Linear Offset (Debug?)
 
	pressure = pressure - 21000;	// Linear Offset for actual pressure
 
	
 
	altitude = (float)44330 * (1 - pow(((float) pressure/101325), 0.190295));	// 101325
 
	altitude = (float)44330 * (1 - pow(((float) pressure/101325), 0.190295));	// 101325 THIS IS IN METERS
 
	altitude = altitude * 3.2804;	//THIS IS IN FEET
 
}
 
 
void sensors_readHumid()
 
@@ -200,6 +201,7 @@ void sensors_readHumid()
 
 
	//calculations to relative humidity: humid = (humid/((2^14) - 1))*100%       >> is divide by power, << is multiply by power, 2^14-1 = 16383
 
	 //humid = (humid / 16383) * 100;
 
	 humid = (humid / 10100) * 100;
 
}
 
 
void sensors_readLux()
0 comments (0 inline, 0 general)