Changeset - c94a78f71a9a
[Not reviewed]
default
0 5 0
kripperger@CL-SEC241-09.cedarville.edu - 12 years ago 2013-02-08 20:00:33
kripperger@CL-SEC241-09.cedarville.edu
Got spi temperature sensor operational.
5 files changed with 13 insertions and 8 deletions:
0 comments (0 inline, 0 general)
slave/slave/lib/spi.c
Show inline comments
 
@@ -14,10 +14,10 @@
 
void setup_spi()
 
{
 
	// specify pin directions for SPI pins on port B
 
	DDRB |= (1<<SPI_MOSI_PIN);	// output
 
	DDRB &= ~(1<<SPI_MISO_PIN); // input
 
	DDRB |= (1<<SPI_SCK_PIN);	// output
 
	DDRA |= (1<<SPI_SS_PIN);	// output
 
	DDRB |= (1<<SPI_MOSI_PORT);	// Output
 
	DDRB &= ~(1<<SPI_MISO_PORT); // Input
 
	DDRB |= (1<<SPI_SCK_PORT);	// Output
 
	DDRA |= (1<<SPI_SS_PORT);	// Output
 
		
 
	// initialize SPI with lowest frequency; max. 400kHz during identification mode of card
 
	SPCR = (0 << SPIE) | // SPI Interrupt Enable
slave/slave/lib/spi.h
Show inline comments
 
@@ -18,6 +18,11 @@
 
#define SPI_MOSI_PIN PB5
 
#define SPI_MISO_PIN PB6
 

	
 
#define SPI_SS_PORT DDA1
 
#define SPI_SCK_PORT DDB7
 
#define SPI_MOSI_PORT DDB5
 
#define SPI_MISO_PORT DDB6
 

	
 
#define SELECT_TEMP PORTA &= ~(1<<PA1)
 
#define DESELECT_TEMP PORTA |= (1<<PA1)
 

	
slave/slave/modules.c
Show inline comments
 
@@ -122,7 +122,7 @@
 
 {
 
	// Gathers data and performs functions for sensor daughter board
 
	sensors_readBoardTemp();		//Data Read
 
	//sensors_readSpiTemp();			//Data Read
 
	sensors_readSpiTemp();			//Data Read
 
	//sensors_readPressure();			//Data Read
 
	//sensors_readHumid();				//Data Read
 
	//sensors_readLight();				//Data Read
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,64,"|ModuleID: %u |BoardTemp: %i |Millis: %lu |Batt: %u\r\n",io_getModuleId(),sensors_getBoardTemp(),time_millis(),sensors_getBatt()); //DEBUG
 
			snprintf(buff,64,"|ModuleID: %u |BoardTemp: %i |Millis: %lu |SpiTemp: %i\r\n",io_getModuleId(),sensors_getBoardTemp(),time_millis(),sensors_getSpiTemp()); //DEBUG
 
			serial0_sendString(buff); //DEBUG
 

	
 
			_delay_ms(2);		// Delay to prevent the sensor loop from running again before time_millis changes
slave/slave/slave.cproj
Show inline comments
 
@@ -70,14 +70,14 @@
 
    <com_atmel_avrdbg_tool_avrdragon>
 
      <ToolType>com.atmel.avrdbg.tool.avrdragon</ToolType>
 
      <ToolName>AVR Dragon</ToolName>
 
      <ToolNumber>00A200035347</ToolNumber>
 
      <ToolNumber>00A200035378</ToolNumber>
 
      <KeepTimersRunning>true</KeepTimersRunning>
 
      <OverrideVtor>false</OverrideVtor>
 
      <OverrideVtorValue>
 
      </OverrideVtorValue>
 
      <Channel>
 
        <host>127.0.0.1</host>
 
        <port>58610</port>
 
        <port>55792</port>
 
        <ssl>False</ssl>
 
      </Channel>
 
      <ToolOptions>
0 comments (0 inline, 0 general)