Changeset - 88a84e3b4dd9
[Not reviewed]
default
0 6 0
kripperger@CL-SEC241-09.cedarville.edu - 12 years ago 2013-04-08 17:21:07
kripperger@CL-SEC241-09.cedarville.edu
Fixed Geiger
6 files changed with 18 insertions and 12 deletions:
0 comments (0 inline, 0 general)
slave/slave/lib/geiger.c
Show inline comments
 
@@ -33,8 +33,14 @@ ISR(TIMER2_OVF_vect)    // Timer 2 overf
 
 
ISR(PCINT0_vect)    // Interrupt on PA0
 
{
 
	// Interrupts when pulse received from Geiger tube
 
	counts++;	// Increment counter.
 
	if(((PINA & 0b00000001))==1)
 
	{
 
		// Interrupts when pulse received from Geiger tube
 
		counts++;	// Increment counter.
 
		led_toggle(2);
 
		_delay_ms(5);
 
	}
 
 
}
 
 
uint16_t geiger_getCpm()
slave/slave/lib/inputOutput.c
Show inline comments
 
@@ -43,7 +43,7 @@ int8_t	moduleID;	// Slave Module ID from
 
 void io_readModuleId()
 
 {
 
	// Get ID from rotary dip and return it. 
 
	moduleID = 1;
 
	moduleID = 2;
 
	
 
	/*
 
	// This method is temporary as the next release will read the module ID from EEPROM
slave/slave/lib/masterComm.c
Show inline comments
 
@@ -111,7 +111,7 @@ void masterComm_modules()
 
			// Sensors
 
			
 
			// Send SPI Temperature (Air)
 
			masterComm_packetSend_unsigned(3,sensors_getSpiTemp());
 
			masterComm_packetSend_signed(3,sensors_getSpiTemp());
 
			
 
			// Send Ambient Light (Needs to be formatted)
 
			masterComm_packetSend_unsigned(4,sensors_getLux());
slave/slave/lib/watchdog.c
Show inline comments
 
@@ -17,7 +17,7 @@ void watchdog_setup(void)
 
	// Set change enable bit, enable the WDT
 
	WDTCSR = (1<<WDCE)|(1<<WDE);
 
	// Start watchdog, 4 second timeout
 
	WDTCSR = (1<<WDE)|(1<<WDP3)|(1<<WDP0);
 
	WDTCSR = (1<<WDE)|(1<<WDP2)|(1<<WDP1);
 
	sei();
 
}
 
slave/slave/modules.c
Show inline comments
 
@@ -18,7 +18,7 @@
 
 #include "lib/led.h"
 
 
 
 uint32_t lastPicture;
 
// uint32_t lastRefresh;	// Time in ms when last geiger refresh occurred 
 
 uint32_t lastRefresh;	// Time in ms when last geiger refresh occurred 
 
 
 
 void modules_setup(uint8_t id)
 
 {
 
@@ -90,14 +90,14 @@
 
 void modules_geiger_setup()
 
 {
 
	// Pin setup
 
	//DDRA &= ~(1 << DDA0);	// PA0 is an input
 
	//DDRA |= (1 << DDA1);	// PA1 is an output	///////////
 
	DDRA &= ~(1 << DDA0);	// PA0 is an input
 
	DDRA |= (1 << DDA1);	// PA1 is an output
 
	
 
	//geiger_on();	// Turn on HV supply	//////////////
 
	geiger_on();	// Turn on HV supply
 
	
 
	// Setup for interrupt input on PA0 (PCINT0)
 
	//PCMSK0 |= (1 << PCINT0);	// Enable interrupt for PA0
 
	//PCICR |= (1 << PCIE0);		// Enable ioc section PCIF0
 
	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)
slave/slave/slave.c
Show inline comments
 
@@ -44,6 +44,7 @@ void micro_setup()
 
	WDTreset = ((MCUSR & 0b00001000) > 0);	// Check if WDT reset occured
 
	MCUSR = 0;		// Clear reset flags
 
	wdt_disable();	// Disable WDT
 
	watchdog_setup();		// Setup watchdog timer
 
	_delay_ms(50);	// Power debounce
 
	sei();			// Enable interrupts
 
}
 
@@ -57,7 +58,6 @@ int main(void)
 
	// Initialize	
 
	micro_setup();			// Generic microcontroller config options
 
	time_setup();			// Setup loop timer and interrupts (TIMER0)
 
	watchdog_setup();		// Setup watchdog timer
 
	led_configure();		// Configure ports and registers for LED operation
 
	io_configure();			// Configure IO ports and registers
 
	i2c_init();				// Setup I2C
0 comments (0 inline, 0 general)