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 24 insertions and 6 deletions:
0 comments (0 inline, 0 general)
slave/slave/config.h
Show inline comments
 
@@ -13,17 +13,18 @@
 
 
#define USART0_BAUDRATE 115200
 
#define USART1_BAUDRATE 115200 
 
 
#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 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 EEPROM_ADDR 0xA0		// Read 0xA1 - Write 0xA0
 
 #define BOARDTEMP_ADDR 0x90	// Read 0x91 - Write 0x90
 
 #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
 
 
 
 
 #endif /* CONFIG_H_ */
 
\ No newline at end of file
slave/slave/lib/inputOutput.c
Show inline comments
 
@@ -24,22 +24,29 @@
 
 uint8_t io_getModuleId()
 
 {
 
	// Get ID from rotary dip and return it. 
 
	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
 
	PORTC |= (1 << PC4);	// Pull pins on rotary dip high
 
	PORTC |= (1 << PC5);	// Pull pins on rotary dip high
 
	
 
	id = ((PINC & 0b00011100) >> 2);	// Read Dip Encoder
 
	id = ~id;							//Invert Dip reading
 
	id = (id & 0b0111);					//Mask bits
 
 
 
	//id = i2c_read(EEPROM_ADDR, 0x04);
 
 
 
	return id;
 
 }
 
 
 
 void io_heaterOn()
 
 {		
 
	PORTB |= (1 << PB4);	//ON
 
@@ -47,12 +54,21 @@
 
 
 
 void io_heaterOff()
 
 {
 
	PORTB &= ~(1 << PB4);	//OFF
 
 }
 
 
 
 uint8_t io_heaterStatus()
 
 {
 
	 uint8_t state;
 
	 state = 0;
 
	 
 
	 state = ((PORTB & 0b00010000) >> 4);
 
	 
 
	 return state;
 
 }
 
 
 
  void io_regulateTemp()
 
  {
 
	  // Gets board temperature and enables heater if below threshold
 
	  if (sensors_getBoardTemp() <= HEATER_THRESHOLD)
 
	  {
slave/slave/lib/inputOutput.h
Show inline comments
 
@@ -11,10 +11,11 @@
 
 
 
void io_configure();
 
uint8_t io_getModuleId();	// Get ID from rotary dip and return it.
 
 
 
void io_heaterOn();
 
void io_heaterOff();
 
uint8_t io_heaterStatus();
 
 
void io_regulateTemp();		// Gets board temperature and enables heater if below threshold
 
 
#endif /* IO_H_ */
 
\ No newline at end of file
slave/slave/slave.c
Show inline comments
 
@@ -68,13 +68,13 @@ int main(void)
 
		{
 
			sensors_readBoardTemp();	// Read board temperature sensor (Common on all slaves) (Data Read)
 
			modules_run(moduleID);		// Runs specific module functions (like data reading)
 
			
 
			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)