Changeset - 0fb8009f1a0a
[Not reviewed]
default
0 3 0
mkroening@CL-ENS241-07.cedarville.edu - 12 years ago 2013-02-28 17:00:49
mkroening@CL-ENS241-07.cedarville.edu
EEPROM testing
3 files changed with 5 insertions and 12 deletions:
0 comments (0 inline, 0 general)
slave/slave/lib/inputOutput.c
Show inline comments
 
@@ -24,16 +24,15 @@ int8_t	moduleID;	// Slave Module ID from
 
	DDRC &= ~(1 << DDC5);		// Set PC5 to input for rotary dip
 
	
 
	DDRA &= ~(1 << DDA7);		// Set PA7 to input for battery voltage divider
 
	
 
 
	//ADC register configurations for battery level detection on PA7
 
	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
 
	//ADMUX |= (1 << ADLAR);								// Sets 10 bit ADC to 8 bit
 
	ADMUX |= (1 << MUX2) | (1 << MUX1) | (1 << MUX0);		// Select ADC7 as the conversion channel
 
	ADCSRA |= (1 << ADATE);									// Enables auto trigger, determined in ADCSRB bits ADTS
 
		//ADCSRA |= (1 << ADIF);								// 
 
		//ADCSRA |= (1 << ADIE);								// ADC interrupt enable set
 
	//ADCSRA |= (1 << ADIF);								// 
 
	//ADCSRA |= (1 << ADIE);								// ADC interrupt enable set
 
	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
 
@@ -58,16 +57,10 @@ int8_t	moduleID;	// Slave Module ID from
 
	moduleID = (moduleID & 0b0111);				//Mask bits
 
	*/
 
 
	/*
 
	while(moduleID==0)
 
	{
 
		moduleID = i2c_read(EEPROM_ADDR, 0x05);
 
	}
 
	*/
 
	
 
	//moduleID = i2c_read(EEPROM_ADDR, 0x05);
 
 
 
 }
 
 
 
 
slave/slave/lib/sensors.h
Show inline comments
 
@@ -16,7 +16,7 @@ void sensors_readBoardTemp(void);	// Rea
 
void sensors_readPressure(void);	// Reads pressure
 
void sensors_readHumid(void);		// Reads humidity
 
void sensors_readLux(void);			// Reads lux
 
void sensors_readBatt(void);
 
void sensors_readBatt(void);		// Reads battery voltage from ADC
 
 
int16_t sensors_getSpiTemp(void);	// Gets spi temperature from variable
 
int8_t sensors_getBoardTemp(void);	// Gets board temperature from variable
slave/slave/slave.c
Show inline comments
 
@@ -47,7 +47,7 @@ int main(void)
 
{
 
	// Writes ID to EEPROM, change for all modules and delete after programming
 
	// 0 is for generic setup, 1 is for sensors, 2 is for Geiger, 3 is for cameras
 
	//i2c_write(EEPROM_ADDR, 0x05, 0x01);
 
	//i2c_write(EEPROM_ADDR, 0x05, 0x03);
 
		
 
	// Initialize		
 
	micro_setup();			// Generic microcontroller config options
0 comments (0 inline, 0 general)