Changeset - 6b25c240180b
[Not reviewed]
default
0 4 0
kripperger@CL-SEC241-09.cedarville.edu - 12 years ago 2013-01-21 19:39:31
kripperger@CL-SEC241-09.cedarville.edu
Heater configurations
4 files changed with 23 insertions and 5 deletions:
0 comments (0 inline, 0 general)
slave/slave/config.h
Show inline comments
 
@@ -16,13 +16,14 @@
 
 
#define SENSOR_LOOP 100				// Frequency of sensor reads (in ms)
 
 
#define HEATER_THRESHOLD 70			// Temperature threshold in Fahrenheit where heater is activated
 
#define HEATER_THRESHOLD 40			// Temperature threshold in Fahrenheit where heater is activated
 
 
 //I2C Addresses
 
 #define EEPROM_ADDR 0xA0		// Read 0xA1 - Write 0xA0
 
 #define BOARDTEMP_ADDR 0x90		// Read 0x91 - Write 0x90
 
 #define PRESSURE_ADDR 0xA1		//THIS VALUE IS WRONG
 
 #define HUMID_ADDR 0xA4		//THIS VALUE IS WRONG
 
 #define RTC_ADDR 0xA2			//DEBUG [Used for testing]      // Read 0xA3 - Write 0xA2
 
 #define PRESSURE_ADDR 0xB1		//THIS VALUE IS WRONG
 
 #define HUMID_ADDR 0xB4		//THIS VALUE IS WRONG
 
 #define RTC_ADDR 0xB2			//DEBUG [Used for testing]      // Read 0xA3 - Write 0xA2
 
 
 
slave/slave/lib/inputOutput.c
Show inline comments
 
@@ -27,6 +27,9 @@
 
	uint8_t id;
 
	id = 0;
 
	
 
	
 
	
 
	
 
	// This method is temporary as the next release will read the module ID from EEPROM
 
	PORTC |= (1 << PC2);	// Pull pins on rotary dip high
 
	PORTC |= (1 << PC3);	// Pull pins on rotary dip high
 
@@ -37,6 +40,10 @@
 
	id = ~id;							//Invert Dip reading
 
	id = (id & 0b0111);					//Mask bits
 
 
 
	//id = i2c_read(EEPROM_ADDR, 0x04);
 
 
 
	return id;
 
 }
 
 
 
@@ -50,6 +57,15 @@
 
	PORTB &= ~(1 << PB4);	//OFF
 
 }
 
 
 
 uint8_t io_heaterStatus()
 
 {
 
	 uint8_t state;
 
	 state = 0;
 
	 
 
	 state = ((PORTB & 0b00010000) >> 4);
 
	 
 
	 return state;
 
 }
 
 
 
  void io_regulateTemp()
 
  {
slave/slave/lib/inputOutput.h
Show inline comments
 
@@ -14,6 +14,7 @@ uint8_t io_getModuleId();	// Get ID from
 
 
 
void io_heaterOn();
 
void io_heaterOff();
 
uint8_t io_heaterStatus();
 
 
void io_regulateTemp();		// Gets board temperature and enables heater if below threshold
 
slave/slave/slave.c
Show inline comments
 
@@ -71,7 +71,7 @@ int main(void)
 
			
 
			io_regulateTemp();			// Gets board temperature and enables heater if below threshold
 
			
 
			snprintf(buff,64,"|ModuleID: %u |BoardTemp: %i |Millis: %lu\r\n",moduleID,sensors_getBoardTemp(),time_millis()); //DEBUG
 
			snprintf(buff,64,"|ModuleID: %u |BoardTemp: %i |Millis: %lu |Heater: %u\r\n",moduleID,sensors_getBoardTemp(),time_millis(),io_heaterStatus()); //DEBUG
 
			serial0_sendString(buff); //DEBUG
 
			
 
			led_toggle(0);		// Toggle LED0(Blue) to show loop running	
0 comments (0 inline, 0 general)