Changeset - 093e89a79a88
[Not reviewed]
default
0 2 0
mkroening@CL-ENS241-07.cedarville.edu - 12 years ago 2013-02-21 15:11:52
mkroening@CL-ENS241-07.cedarville.edu
ADC - merge
2 files changed with 4 insertions and 5 deletions:
0 comments (0 inline, 0 general)
slave/slave/lib/inputOutput.c
Show inline comments
 
@@ -25,9 +25,7 @@ int8_t	moduleID;	// Slave Module ID from
 
	
 
	
 
	DDRA &= ~(1 << DDA7);		// Set PA7 to input for battery voltage divider
 
	// I bit of SREG needs to be set?  Global interrupt.
 
	ADCSRA |= (1 << ADEN);									// Enable ADC
 
	
 
 
	ADCSRA |= (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0);	// Set prescaler for ADC, 128 gives ADC freq of 125 KHz
 
	ADMUX |= (1 << REFS0);									// Set ADC reference voltage to AVCC
 
	ADMUX |= (1 << ADLAR);									// Sets 10 bit ADC to 8 bit
 
@@ -35,7 +33,8 @@ int8_t	moduleID;	// Slave Module ID from
 
	ADCSRA |= (1 << ADATE);									// Enables auto trigger, determined in ADCSRB bits ADTS
 
	//ADCSRA |= (1 << ADIF);									// 
 
//ADCSRA |= (1 << ADIE);									// ADC interrupt enable set
 
	ADCSRB |= (0 << ADTS2) | (0 << ADTS1) | (0 << ADTS0);	// Set ADC auto trigger source to free running mode
 
	ADCSRB &= ~(1 << ADTS2) | (1 << ADTS1) | (1 << ADTS0);	// Set ADC auto trigger source to free running mode
 
	ADCSRA |= (1 << ADEN);									// Enable ADC
 
	ADCSRA |= (1 << ADSC);									// Start ADC measurements.  ADC should now continuously run conversions, which are stored in ADCH 0x79
 
	
 
slave/slave/slave.c
Show inline comments
 
@@ -82,7 +82,7 @@ int main(void)
 
			
 
			io_regulateTemp();			// Gets board temperature and enables heater if below threshold
 

	
 
			snprintf(buff,128,"|ModuleID: %u |BoardTemp: %i |Heater: %u |Millis: %lu |Lux: %lu |Pressure: %lu |Altitude: %lu \r\n",io_getModuleId(),sensors_getBoardTemp(),io_heaterStatus(),time_millis(),sensors_getLux(),sensors_getPressure(),sensors_getAltitude()); //DEBUG
 
			snprintf(buff,128,"|ModuleID: %u |BoardTemp: %i |Millis: %lu |Lux: %lu |Pressure: %lu |Altitude: %lu |Battery: %u \r\n ",io_getModuleId(),sensors_getBoardTemp(),time_millis(),sensors_getLux(),sensors_getPressure(),sensors_getAltitude(),sensors_getBatt()); //DEBUG
 
			serial0_sendString(buff); //DEBUG
 

	
 
			_delay_ms(2);		// Delay to prevent the sensor loop from running again before time_millis changes
0 comments (0 inline, 0 general)