Changeset - bff9c47f83da
[Not reviewed]
default
0 4 0
kripperger@CL-SEC241-09.cedarville.edu - 12 years ago 2013-04-03 17:04:10
kripperger@CL-SEC241-09.cedarville.edu
Configuring Geiger
4 files changed with 24 insertions and 6 deletions:
0 comments (0 inline, 0 general)
slave/slave/lib/geiger.c
Show inline comments
 
@@ -38,12 +38,29 @@ ISR(PCINT0_vect)    // Interrupt on PA0
 
}
 
 
uint16_t geiger_getCpm()
 
{
 
	return cpm;
 
}
 
 
uint8_t geiger_getCount()	//DEBUG
 
{
 
	return counts;
 
}
 
 
void geiger_on();
 
{
 
	// Turn the Flyback Transformer on
 
	PORTA |= (1 << PA1);	//ON
 
	}
 
}
 
 
void geiger_refresh();
 
{
 
	// Turn the Flyback Transformer off
 
	PORTA &= ~(1 << PA1);	//OFF
 
	_delay_ms(1);
 
 
	// Turn the Flyback Transformer on
 
	PORTA |= (1 << PA1);	//ON
 
}
 
}
slave/slave/lib/geiger.h
Show inline comments
 
@@ -2,14 +2,15 @@
 
 * geiger.h
 
 *
 
 * Created: 11/19/2012 9:24:17 PM
 
 *  Author: kripperger
 
 */ 
 
 
 
#ifndef GEIGER_H_
 
#define GEIGER_H_
 
 
uint16_t geiger_getCpm();
 
uint8_t geiger_getCount();	//DEBUG
 
void led_on(void);
 
 
#endif /* GEIGER_H_ */
 
\ No newline at end of file
slave/slave/lib/inputOutput.c
Show inline comments
 
@@ -34,42 +34,42 @@ int8_t	moduleID;	// Slave Module ID from
 
	//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
 
	
 
 }
 
 
 
  
 
 void io_readModuleId()
 
 {
 
	// Get ID from rotary dip and return it. 
 
	moduleID = 0;
 
	moduleID = 2;
 
	
 
	/*
 
	// 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
 
	
 
	moduleID = ((PINC & 0b00011100) >> 2);		// Read Dip Encoder
 
	moduleID = ~moduleID;						//Invert Dip reading
 
	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);
 
//	}
 
 }
 
 
 
 
 
 uint8_t io_getModuleId()
 
 {
 
	return moduleID;
 
 }
 
 
 
 
 
 void io_heaterOn()
 
 {		
 
	PORTB |= (1 << PB4);	//ON
slave/slave/modules.c
Show inline comments
 
@@ -82,25 +82,25 @@
 
  
 
 void modules_sensors_setup()
 
 {
 
	DESELECT_TEMP;
 
	setup_spi();
 
	sensors_setupPressure();
 
 }
 
  
 
 void modules_geiger_setup()
 
 {
 
	// Pin setup
 
	DDRA &= ~(1 << DDA0);	// PA0 is an input
 
	
 
	DDRA |= (1 << DDA1);	// PA1 is an output	
 
	
 
	 
 
	// Setup for interrupt input on PA0 (PCINT0)
 
	PCMSK0 |= (1 << PCINT0);	// Enable interrupt for PA0
 
	PCICR |= (1 << PCIE0);		// Enable ioc section PCIF0
 
	
 
	// Setup for interrupt from Timer2
 
	ASSR &= ~(1 << EXCLK);	// Disable external clock input (enabling crystal use)
 
	ASSR |= (1 << AS2);		// Enable timer2 async mode with an external crystal	
 
	_delay_ms(250);			// Let external 32KHz crystal stabilize
 
	TCCR2B = 0x05;			// Set the prescaler to 128: 32.768kHz / 128 = 1Hz overflow
 
	TIFR2 = 0x01;			// Reset timer2 overflow interrupt flag
0 comments (0 inline, 0 general)