Changeset - 1614c3d5e9cd
[Not reviewed]
default
0 5 0
kripperger@CL-SEC241-09.cedarville.edu - 12 years ago 2013-01-10 14:45:18
kripperger@CL-SEC241-09.cedarville.edu
Optimizations and setting up loop timer
5 files changed with 6 insertions and 7 deletions:
0 comments (0 inline, 0 general)
slave/slave/lib/geiger.c
Show inline comments
 
@@ -41,9 +41,9 @@ uint16_t geiger_getCpm()
 
{
 
	return cpm;
 
}
 
 
uint8_t geiger_getCount()	//DEBUG
 
{
 
	return seconds;
 
	return counts;
 
}
 
slave/slave/lib/loopTimer.c
Show inline comments
 
@@ -12,16 +12,15 @@
 
#include <util/delay.h>
 
#include "loopTimer.h"
 
 
volatile uint32_t millis = 0; // Milliseconds since initialization
 

	
 

	
 

	
 
void time_setup()
 
{
 
	DDRA = 0xff;
 
	DDRA = 0xFF;
 
	
 
	// Generic microcontroller config options
 
	OCR0A = 173; // Approx 172.7969 ticks per ms with 64 prescaler
 
	
 
	TCCR0A |= (1 << WGM01) | (1 << WGM00); // Count until OCR0A, then overflow (wgm02 in the next line specifies this as well)
 
	TCCR0B |= (1 << CS01) | (1 << CS00) | (1 << WGM02); // clock div by 64
slave/slave/lib/loopTimer.h
Show inline comments
 
@@ -8,12 +8,10 @@
 
 
#ifndef LOOPTIMER_H_
 
#define LOOPTIMER_H_
 
 

	
 
void time_setup();
 

	
 
uint32_t time_millis();
 
 
 
 
#endif /* LOOPTIMER_H_ */
 
\ No newline at end of file
slave/slave/lib/sensors.c
Show inline comments
 
@@ -45,13 +45,13 @@ void sensors_readSpiTemp()
 
}
 

	
 
void sensors_readBoardTemp()
 
{
 
	boardTemp = i2c_read(BOARDTEMP_ADDR, 0x00);		// Read only the first byte of data (we don't need the resolution here)
 
	boardTemp = ((boardTemp*18)/10) + (32);			// Converting Celsius to Fahrenheit
 
	boardTemp = boardTemp - 1;						// Linear offset
 
	boardTemp = boardTemp - 3;						// Linear offset
 
}
 

	
 
int16_t sensors_getSpiTemp(void)	// Gets spi temperature from variable
 
{
 
	return spiTemp;
 
}
slave/slave/slave.c
Show inline comments
 
@@ -39,21 +39,23 @@ void micro_setup()
 
 
 
int main(void)
 
{
 
	// Initialize		
 
	micro_setup();			// Generic microcontroller config options
 
	time_setup();
 
	led_configure();		// Configure ports and registers for LED operation
 
	io_configure();			// Configure IO ports and registers
 
	
 
	i2c_init();				// Setup I2C
 
	serial0_setup();		// Config serial port
 
	
 
	uint8_t moduleID = io_getModuleId();	// Slave Module ID from rotary dip switch
 
	modules_setup(moduleID);				// Run setup functions for specific module
 
	
 
	uint32_t milliseconds;
 
	
 
	uint8_t test;	//Debug
 
	uint8_t test2;	//Debug	
 
	
 
 
	
 
@@ -96,13 +98,13 @@ int main(void)
 
		
 
		
 
		**************************************************************/
 
		
 
		
 
		test2 = sensors_getBoardTemp();	//DEBUG///////////////////////////////////////////////////////////////////////////
 
 
		time_millis();
 
 
		sprintf(buff, "|ModuleID: %u |BoardTemp: %u |Seconds: %u\r\n",moduleID,test2,test); //DEBUG
 
		serial0_sendString(buff); //DEBUG
 
 
    }
 
	
0 comments (0 inline, 0 general)