Commit 47a517dc authored by Johan Vaarlid - M19939's avatar Johan Vaarlid - M19939
Browse files

Reviewed Task1

parent ac61bd30
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
			<Description></Description>
			<Files xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
				<d4p1:anyType i:type="FileInfo">
					<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include</AbsolutePath>
					<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\Atmel\ATmega_DFP\1.2.272\include</AbsolutePath>
					<Attribute></Attribute>
					<Category>include</Category>
					<Condition>C</Condition>
@@ -26,18 +26,18 @@
					<SourcePath></SourcePath>
				</d4p1:anyType>
				<d4p1:anyType i:type="FileInfo">
					<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include\avr\iom4809.h</AbsolutePath>
					<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\Atmel\ATmega_DFP\1.2.272\include\avr\iom4809.h</AbsolutePath>
					<Attribute></Attribute>
					<Category>header</Category>
					<Condition>C</Condition>
					<FileContentHash>mWiFIOAGwUPlW0rYsXcjkg==</FileContentHash>
					<FileContentHash>fQaG1DJ4X5qUUwRvErAbNQ==</FileContentHash>
					<FileVersion></FileVersion>
					<Name>include/avr/iom4809.h</Name>
					<SelectString></SelectString>
					<SourcePath></SourcePath>
				</d4p1:anyType>
				<d4p1:anyType i:type="FileInfo">
					<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\templates\main.c</AbsolutePath>
					<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\Atmel\ATmega_DFP\1.2.272\templates\main.c</AbsolutePath>
					<Attribute>template</Attribute>
					<Category>source</Category>
					<Condition>C Exe</Condition>
@@ -48,7 +48,7 @@
					<SourcePath></SourcePath>
				</d4p1:anyType>
				<d4p1:anyType i:type="FileInfo">
					<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\templates\main.cpp</AbsolutePath>
					<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\Atmel\ATmega_DFP\1.2.272\templates\main.cpp</AbsolutePath>
					<Attribute>template</Attribute>
					<Category>source</Category>
					<Condition>C Exe</Condition>
@@ -59,7 +59,7 @@
					<SourcePath></SourcePath>
				</d4p1:anyType>
				<d4p1:anyType i:type="FileInfo">
					<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega4809</AbsolutePath>
					<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\Atmel\ATmega_DFP\1.2.272\gcc\dev\atmega4809</AbsolutePath>
					<Attribute></Attribute>
					<Category>libraryPrefix</Category>
					<Condition>GCC</Condition>
@@ -71,8 +71,8 @@
				</d4p1:anyType>
			</Files>
			<PackName>ATmega_DFP</PackName>
			<PackPath>C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/Atmel.ATmega_DFP.pdsc</PackPath>
			<PackVersion>1.2.209</PackVersion>
			<PackPath>C:/Program Files (x86)/Atmel/Studio/7.0/Packs/Atmel/ATmega_DFP/1.2.272/Atmel.ATmega_DFP.pdsc</PackPath>
			<PackVersion>1.2.272</PackVersion>
			<PresentInProject>true</PresentInProject>
			<ReferenceConditionId>ATmega4809</ReferenceConditionId>
			<RteComponents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
+15 −15
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <ToolchainSettings>
      <AvrGcc>
  <avrgcc.common.Device>-mmcu=atmega4809 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega4809"</avrgcc.common.Device>
  <avrgcc.common.Device>-mmcu=atmega4809 -B "%24(PackRepoDir)\Atmel\ATmega_DFP\1.2.272\gcc\dev\atmega4809"</avrgcc.common.Device>
  <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>
@@ -99,7 +99,7 @@
  </avrgcc.compiler.symbols.DefSymbols>
  <avrgcc.compiler.directories.IncludePaths>
    <ListValues>
      <Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include</Value>
      <Value>%24(PackRepoDir)\Atmel\ATmega_DFP\1.2.272\include</Value>
    </ListValues>
  </avrgcc.compiler.directories.IncludePaths>
  <avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
@@ -113,7 +113,7 @@
  </avrgcc.linker.libraries.Libraries>
  <avrgcc.assembler.general.IncludePaths>
    <ListValues>
      <Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include</Value>
      <Value>%24(PackRepoDir)\Atmel\ATmega_DFP\1.2.272\include</Value>
    </ListValues>
  </avrgcc.assembler.general.IncludePaths>
</AvrGcc>
@@ -122,7 +122,7 @@
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <ToolchainSettings>
      <AvrGcc>
  <avrgcc.common.Device>-mmcu=atmega4809 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega4809"</avrgcc.common.Device>
  <avrgcc.common.Device>-mmcu=atmega4809 -B "%24(PackRepoDir)\Atmel\ATmega_DFP\1.2.272\gcc\dev\atmega4809"</avrgcc.common.Device>
  <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>
@@ -137,7 +137,7 @@
  </avrgcc.compiler.symbols.DefSymbols>
  <avrgcc.compiler.directories.IncludePaths>
    <ListValues>
      <Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include</Value>
      <Value>%24(PackRepoDir)\Atmel\ATmega_DFP\1.2.272\include</Value>
    </ListValues>
  </avrgcc.compiler.directories.IncludePaths>
  <avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
@@ -152,7 +152,7 @@
  </avrgcc.linker.libraries.Libraries>
  <avrgcc.assembler.general.IncludePaths>
    <ListValues>
      <Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include</Value>
      <Value>%24(PackRepoDir)\Atmel\ATmega_DFP\1.2.272\include</Value>
    </ListValues>
  </avrgcc.assembler.general.IncludePaths>
  <avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
+9 −9
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
 * Task1.c
 *
 * Created: 11.02.2017 23:37:53
 * Author : Petter
 * Author : Petter Breedveld
 */ 


@@ -25,7 +25,7 @@

/**
 * Define helpers for pin bit positions.
 * The LED0 on the ATtiny4809 main board is connected to pin 4 on port D.
 * The LED0 on the ATmega4809 main board is connected to pin 4 on port D.
 * Check the datasheet to find out which pins on which ports the different LEDs and buttons are connected to.
 */

@@ -39,17 +39,17 @@ int main(void){
	/**
	 * We want to send signals to the LEDs, in order to turn the off and on.
	 * In the AVR world we have the following:
	 * PORTx.DIR: 1 is output, 0 is input
 	 * LED: 1 LED is off, 0 LED is on, this is called active-low
	 * Button: 1 button is open, 0 button is pressed, this is called active-low
	 * PORTx.DIR: 1 is output, 0 is input.
 	 * LED: 1 LED is off, 0 LED is on, this is called active-low.
	 * Button: 1 button is open, 0 button is pressed, this is called active-low.
	 *
	 * Remember bit set logic:
	 * Set to 1:	FLAG |= ( 1 << BIT_POS ) - using 'or' so we only change the one we want and leave the others untouched
	 * Set to 0:	FLAG &= ~( 1 << BIT_POS ) - same thing here but using 'and', find paper and a logic-table, and try it out if you want to know how it works
	 * Toogle bit:	FLAG ^= ( 1 << BIT_POS ) - using bitwise xor, toogles the bit at BIT_POS
	 * Set to 1:	Register |= ( 1 << BIT_POS ) - using the 'or'('|') operator so we only change the one we want and leave the others untouched.
	 * Set to 0:	Register &= ~( 1 << BIT_POS ) - same thing here but using the 'and'('&') and 'not'('~') operators, find paper and a logic-table, and try it out if you want to know how it works.
	 * Toogle bit:	Register ^= ( 1 << BIT_POS ) - using bitwise the 'xor'('^') operator, toogles the bit at BIT_POS.
	 */

	PORTD.DIR |= (1 << LED0); // Set LED0 as output - Using "D" in PORTx.DIR since the LED is connected to port D on the microcontroller
	PORTD.DIR |= (1 << LED0); // Set LED0 as output - Using "D" in PORTx.DIR since the LED is connected to port D on the microcontroller.
	
	/*
	* The usual way to run microcontrollers is using a simple infinite loop