Changeset - 9157d20ee6c6
[Not reviewed]
default
0 0 2
mkanning@CL-SEC241-09.cedarville.edu - 12 years ago 2012-10-25 15:14:23
mkanning@CL-SEC241-09.cedarville.edu
First pass on firmware
2 files changed with 123 insertions and 0 deletions:
0 comments (0 inline, 0 general)
master/master/master/master.c
Show inline comments
 
new file 100644
 
/*
 
 * master.c
 
 *
 
 * Created: 10/25/2012 2:48:04 PM
 
 *  Author: mkanning
 
 */ 
 
 
 
#include <avr/io.h>
 
 
void SendChar( char byte ) 
 
{
 
	while (!(UCSR0A & (1<<UDRE0)));
 
	UDR0 = byte;
 
}
 
 
void SendCommand( char moduleID, char measureType, uint8_t dataLength, char* data ) 
 
{
 
	char checkSum = 0x00; //initialize checksum
 
	
 
	SendChar("["); //bracket indicates start of command
 
	SendChar(moduleID);
 
	checkSum+=moduleID;
 
	
 
	SendChar(measureType);
 
	checkSum+=measureType;
 
	
 
	//send each character of data individually
 
	for (int i=0; i<dataLength; i++)
 
	{
 
		SendChar(data[i]);
 
		checkSum+=data[i];
 
	}
 
	
 
	SendChar(checkSum);
 
	SendChar("]"); //bracket indicates end of command
 
}
 
 
void SendResponseData(){
 
	
 
}
 
 
int main(void)
 
{
 
    while(1)
 
    {
 
        //TODO:: Please write your application code 
 
					
 
    }
 
}
 
\ No newline at end of file
master/master/master/master.cproj
Show inline comments
 
new file 100644
 
<?xml version="1.0" encoding="utf-8"?>
 
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 
  <PropertyGroup>
 
    <SchemaVersion>2.0</SchemaVersion>
 
    <ProjectVersion>6.0</ProjectVersion>
 
    <ToolchainName>com.Atmel.AVRGCC8</ToolchainName>
 
    <ProjectGuid>{8579ec2d-5815-40db-84e0-1d14239c7aea}</ProjectGuid>
 
    <avrdevice>ATmega644P</avrdevice>
 
    <avrdeviceseries>none</avrdeviceseries>
 
    <OutputType>Executable</OutputType>
 
    <Language>C</Language>
 
    <OutputFileName>$(MSBuildProjectName)</OutputFileName>
 
    <OutputFileExtension>.elf</OutputFileExtension>
 
    <OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
 
    <AssemblyName>master</AssemblyName>
 
    <Name>master</Name>
 
    <RootNamespace>master</RootNamespace>
 
    <ToolchainFlavour>Native</ToolchainFlavour>
 
    <KeepTimersRunning>true</KeepTimersRunning>
 
    <OverrideVtor>false</OverrideVtor>
 
    <OverrideVtorValue />
 
    <eraseonlaunchrule>0</eraseonlaunchrule>
 
    <AsfVersion>3.1.3</AsfVersion>
 
  </PropertyGroup>
 
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
 
    <ToolchainSettings>
 
      <AvrGcc>
 
  <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
 
  <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
 
  <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
 
  <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
 
  <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
 
  <avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
 
  <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
 
  <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
 
  <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
 
  <avrgcc.linker.libraries.Libraries>
 
    <ListValues>
 
      <Value>m</Value>
 
    </ListValues>
 
  </avrgcc.linker.libraries.Libraries>
 
</AvrGcc>
 
    </ToolchainSettings>
 
  </PropertyGroup>
 
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
 
    <ToolchainSettings>
 
      <AvrGcc>
 
  <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
 
  <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
 
  <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
 
  <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
 
  <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
 
  <avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
 
  <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
 
  <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
 
  <avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
 
  <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
 
  <avrgcc.linker.libraries.Libraries>
 
    <ListValues>
 
      <Value>m</Value>
 
    </ListValues>
 
  </avrgcc.linker.libraries.Libraries>
 
  <avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
 
</AvrGcc>
 
    </ToolchainSettings>
 
  </PropertyGroup>
 
  <ItemGroup>
 
    <Compile Include="master.c">
 
      <SubType>compile</SubType>
 
    </Compile>
 
  </ItemGroup>
 
  <Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
 
</Project>
 
\ No newline at end of file
0 comments (0 inline, 0 general)