Commit 9788a10e authored by BuildTools's avatar BuildTools

Merge branch 'master' into fixurd

Different fixes in each, so merging should be fine.
parents 11fb15c0 293ffe09
/*
* Task1-LF.c
* Task1.c
*
* Created: 29.01.2017 23:43:39
* Created: 11.02.2017 23:37:53
* Author : Petter
*/
/**
* F_CPU tells the timer what the CPU's clock frequency is, such that the timer will count correctly.
* Note that this DOES NOT set the clock speed, it just informs the timer.
......@@ -13,7 +15,7 @@
* F_CPU must be defined before including headers.
*/
#define F_CPU 3333333UL //The ATtiny817 operates at 20MHz with a default scaling factor of 6: 20/6 = 3.333333MHz
#define F_CPU 3333333UL //The ATtiny4809 operates at 20MHz with a default scaling factor of 6: 20/6 = 3.333333MHz
/**
* System headers bellow
......@@ -24,26 +26,31 @@
/**
* Define helpers for pin bit positions.
* The LED0 on the ATmega324PB main board is connected to pin 4 on port B.
* The LED0 on the ATtiny4809 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.
*/
#define LED0 4 // LED0 is connected to pin 4 on port B (PIN4_bp)
#define LED0 4 // LED 1 is connected to pin 4 on PORTD
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
* 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
* 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
*/
PORTB.DIR |= (1 << LED0); // Set LED0 as output - Using "B" in PORTx.DIR since the LED is connected to port B 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
......@@ -51,8 +58,9 @@ int main(void){
while (1)
{
PORTB.OUT ^= (1 << LED0); // Changes the state of LED0 by XOR-ing the last state. Check the XOR-table to find out how this works.
// Non-compressed: PORTB_OUT = PORTB.OUT ^ (1 << LED0);
PORTD.OUT ^= (1 << LED0); // Changes the state of LED0 by XOR-ing the last state. Check the XOR-table to find out how this works.
// Non-compressed: PORTD.OUT = PORTD.OUT ^ (1 << LED0);
//Can also refer to toogle register: PORTD.OUTTGL = (1 << LED0). IMPORTANT: only use equal sign here (=)
_delay_ms(500);
}
}
/*
* Task2-LF.c
* Task2.c
*
* Created: 29.01.2017 23:43:39
* Created: 11.02.2017 23:39:47
* Author : Petter
*/
......@@ -15,59 +15,74 @@
#include <util/delay.h>
/*
* Checkout the ATtiny817 datasheet to find the correct ports and pins
* Check out the ATtiny4809 datasheet to find the correct ports and pins
*/
// LED
#define LED0 4 //On port B
#define LED0 4 //On port D
// Button
#define SW0 5 //On port B
#define SW0 2 //On port C
int main(void)
{
/*
* We want to send signals to the LEDs, in order to turn it off and on.
* We also want to be able to read the switches.
* This is done by setting bits in the PORTx.DIR register (in this case PORTB.DIR)
* This is done by setting bits in the PORTx.DIR register (in this case PORTD.DIR and PORTC.DIR)
* PORTx.DIR: 1 is output, 0 is input
* LED: 1 LED is off, 0 LED is on
* Button: 1 Button is open, 0 button is pressed
* Bit set logic:
* Set to 1: FLAG |= ( 1 << BIT_POS )
* Set to 0: FLAG &= ~( 1 << BIT_POS )
* Set to 1: REG |= ( 1 << BIT_POS )
* Set to 0: REG &= ~( 1 << BIT_POS )
*/
/**
* In order to read from the switches, we need to give it a ground reference, via a pull-up resistor.
* If we don't, the switch will have a floating ground, and hence its value will be undefined.
* On the ATtiny817, we enable pull-up by setting the "PORT_PULLUPEN_bp" flag in "PORTx.PINnCTRL" high.
* See datasheet section 16 (I/O-ports) and user guide section 4 (Hardware User Guide).
* On the ATtiny4809, we enable pull-up by setting the "PORT_PULLUPEN" flag in "PORTx.PINnCTRL" high.
* See datasheet section 15 (I/O-ports).
*/
/*
* It's your time to do some stuff! Do the following:
* 1 - Set LED0 as output
* 2 - Set SW0 as input
* 3 - Enable pull-up on button SW0
*/
PORTB.DIR |= (1 << LED0); // Set LED0 as output
PORTB.DIR &= ~(1 << SW0); //Set SW0 as input
PORTB.PIN5CTRL |= (1 << PORT_PULLUPEN_bp); //Enable pull-up on button SW0 (pin5)
PORTD.DIR |= (1 << LED0); // Set LED0 as output
PORTC.DIR &= ~(1 << SW0); //Set SW0 as input
PORTB.PIN2CTRL |= (1 << PORT_PULLUPEN_bp); //Enable pull-up on button SW0 (pin5)
while (1)
{
/*
* Here, you want to check if a button is pressed, and if yes, turn on the LED.
* If no, then do the opposite.
* Similar to setting pins with PORTx_OUT, we can read pins with PORTx.IN
* Similar to setting pins with PORTx.OUT, we can read pins with PORTx.IN
* In order to check a pin value, mask out that particular bit. (use bitwise AND)
* Bit masking is done like this:
* (REGISTER & (1 << BIT_POS)), which selects bit BIT_POS from register.
* If that bit is 0, the result will be 0. If it is 1, the result will be other than 0 (depending on bit pos).
*/
if(!(PORTB.IN & (1 << SW0))){ // If button is pressed (0 - LOW
PORTB.OUT &= ~(1 << LED0); // Sets output to 0, turns LED0 on
/*
* Do the following:
* 1 - check if button SW0 is pressed
* 2 - if so, turn the LED on
* 3 - if not, turn the LED off
*/
if(!(PORTC.IN & (1 << SW0))){ // If button is pressed (0 - LOW
PORTD.OUT &= ~(1 << LED0); // Sets output to 0, turns LED0 on
}
else{
PORTB.OUT |= (1 << LED0); // Sets output to 1, turns LED off
PORTD.OUT |= (1 << LED0); // Sets output to 1, turns LED off
}
}
......
......@@ -12,10 +12,10 @@
#include <stdbool.h>
//LED
#define LED0 4 //on port B
#define LED0 4 //on port D
//Button
#define SW0 5 //on port B
#define SW0 2 //on port C
int main(void)
{
......@@ -29,10 +29,10 @@ int main(void)
* Set to 0: REG &= ~( 1 << BIT_POS )
* This is called "read-modify-write".
*
* The ATtiny817 also has special port registers that can do some of this for you.
* The ATtiny4809 also has special port registers that can do some of this for you.
* Read what PORTx.DIRSET, .DIRCLR and .DIRTGL do to the PORTx.DIR register,
* And similarly what PORTx.OUTSET, .OUTCLR and .OUTTGL do to PORTx.OUT
* (HINT: see chapter 16.5 of the datasheet)
* (HINT: see chapter 15.5 of the datasheet)
LF: They set clear and toggle bit in the register. eks: PORTB.DIRCLR = (1 << 5); to clear bit 5
......@@ -40,13 +40,16 @@ int main(void)
*/
PORTB.DIRSET = (1 << LED0); // Set LED0 as output
//Alt: PORTB.DIR |= (1 << LED0);
PORTD.DIRSET = (1 << LED0); // Set LED0 as output
//Alt: PORTD.DIR |= (1 << LED0);
PORTD.OUTSET = (1 << LED0); // Set LED0 output high (turns off the led, since the led is active low)
//Alt: PORTD.OUT |= (1 << LED0);
PORTB.DIRCLR = (1 << SW0); // Set SW0 as input (default)
//Alt: PORTB.DIR &= ~(1 << SW0);
PORTC.DIRCLR = (1 << SW0); // Set SW0 as input (default)
//Alt: PORTC.DIR &= ~(1 << SW0);
PORTB.PIN5CTRL |= (1 << 3); // Enable pull-up on button SW
PORTC.PIN2CTRL |= (1 << 3); // Enable pull-up on button SW
//eller bruk PORT_PULLUPEN_bp som er lik 3 (_bp = Bit Position)
......@@ -54,11 +57,11 @@ int main(void)
while (1)
{
if(!(PORTB.IN & (1 << SW0))){
if(!(PORTC.IN & (1 << SW0))){
if(buttonState == 0){
PORTB.OUTTGL = ( 1 << LED0);
//Alt: PORTB.OUT ^= (1 << LED0);
PORTD.OUTTGL = ( 1 << LED0);
//Alt: PORTD.OUT ^= (1 << LED0);
buttonState = 1;
}
......
......@@ -9,13 +9,13 @@
<CSub></CSub>
<CVariant></CVariant>
<CVendor>Atmel</CVendor>
<CVersion>1.1.0</CVersion>
<DefaultRepoPath>D:/Atmel\7.0\Packs</DefaultRepoPath>
<CVersion>1.2.0</CVersion>
<DefaultRepoPath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs</DefaultRepoPath>
<DependentComponents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
<Description></Description>
<Files xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>D:/Atmel\7.0\Packs\atmel\ATtiny_DFP\1.1.102\include</AbsolutePath>
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include</AbsolutePath>
<Attribute></Attribute>
<Category>include</Category>
<Condition>C</Condition>
......@@ -26,29 +26,29 @@
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>D:/Atmel\7.0\Packs\atmel\ATtiny_DFP\1.1.102\include\avr\iotn817.h</AbsolutePath>
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include\avr\iom4809.h</AbsolutePath>
<Attribute></Attribute>
<Category>header</Category>
<Condition>C</Condition>
<FileContentHash>GzsE/dwQAz37AkZENa/sHg==</FileContentHash>
<FileContentHash>mWiFIOAGwUPlW0rYsXcjkg==</FileContentHash>
<FileVersion></FileVersion>
<Name>include/avr/iotn817.h</Name>
<Name>include/avr/iom4809.h</Name>
<SelectString></SelectString>
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>D:/Atmel\7.0\Packs\atmel\ATtiny_DFP\1.1.102\templates\main.c</AbsolutePath>
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\templates\main.c</AbsolutePath>
<Attribute>template</Attribute>
<Category>source</Category>
<Condition>C Exe</Condition>
<FileContentHash>NtrFFJHqGYFgQ+e154IDwQ==</FileContentHash>
<FileContentHash>GD1k8YYhulqRs6FD1B2Hog==</FileContentHash>
<FileVersion></FileVersion>
<Name>templates/main.c</Name>
<SelectString>Main file (.c)</SelectString>
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>D:/Atmel\7.0\Packs\atmel\ATtiny_DFP\1.1.102\templates\main.cpp</AbsolutePath>
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\templates\main.cpp</AbsolutePath>
<Attribute>template</Attribute>
<Category>source</Category>
<Condition>C Exe</Condition>
......@@ -59,22 +59,22 @@
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>D:/Atmel\7.0\Packs\atmel\ATtiny_DFP\1.1.102\gcc\dev\attiny817</AbsolutePath>
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega4809</AbsolutePath>
<Attribute></Attribute>
<Category>libraryPrefix</Category>
<Condition>GCC</Condition>
<FileContentHash i:nil="true" />
<FileVersion></FileVersion>
<Name>gcc/dev/attiny817</Name>
<Name>gcc/dev/atmega4809</Name>
<SelectString></SelectString>
<SourcePath></SourcePath>
</d4p1:anyType>
</Files>
<PackName>ATtiny_DFP</PackName>
<PackPath>D:/Atmel/7.0/Packs/atmel/ATtiny_DFP/1.1.102/Atmel.ATtiny_DFP.pdsc</PackPath>
<PackVersion>1.1.102</PackVersion>
<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>
<PresentInProject>true</PresentInProject>
<ReferenceConditionId>ATtiny817</ReferenceConditionId>
<ReferenceConditionId>ATmega4809</ReferenceConditionId>
<RteComponents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:string></d4p1:string>
</RteComponents>
......
......@@ -5,7 +5,7 @@
<ProjectVersion>7.0</ProjectVersion>
<ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName>
<ProjectGuid>dce6c7e3-ee26-4d79-826b-08594b9ad897</ProjectGuid>
<avrdevice>ATtiny817</avrdevice>
<avrdevice>ATmega4809</avrdevice>
<avrdeviceseries>none</avrdeviceseries>
<OutputType>Executable</OutputType>
<Language>C</Language>
......@@ -20,29 +20,71 @@
<OverrideVtor>false</OverrideVtor>
<CacheFlash>true</CacheFlash>
<ProgFlashFromRam>true</ProgFlashFromRam>
<RamSnippetAddress />
<RamSnippetAddress>0x20000000</RamSnippetAddress>
<UncachedRange />
<preserveEEPROM>true</preserveEEPROM>
<OverrideVtorValue />
<OverrideVtorValue>exception_table</OverrideVtorValue>
<BootSegment>2</BootSegment>
<eraseonlaunchrule>0</eraseonlaunchrule>
<AsfFrameworkConfig>
<framework-data xmlns="">
<framework-data>
<options />
<configurations />
<files />
<documentation help="" />
<offline-documentation help="" />
<dependencies>
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.32.0" />
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.34.1" />
</dependencies>
</framework-data>
</AsfFrameworkConfig>
<ResetRule>0</ResetRule>
<EraseKey />
<avrtool>com.atmel.avrdbg.tool.nedbg</avrtool>
<avrtoolserialnumber>ATML3094051800000431</avrtoolserialnumber>
<avrdeviceexpectedsignature>0x1E9651</avrdeviceexpectedsignature>
<custom>
<ToolOptions>
<InterfaceProperties>
</InterfaceProperties>
<InterfaceName>
</InterfaceName>
</ToolOptions>
<ToolType>custom</ToolType>
<ToolNumber>
</ToolNumber>
<ToolName>Custom Programming Tool</ToolName>
</custom>
<avrtoolinterface>UPDI</avrtoolinterface>
<com_atmel_avrdbg_tool_simulator>
<ToolOptions xmlns="">
<InterfaceProperties>
</InterfaceProperties>
<InterfaceName>
</InterfaceName>
</ToolOptions>
<ToolType xmlns="">com.atmel.avrdbg.tool.simulator</ToolType>
<ToolNumber xmlns="">
</ToolNumber>
<ToolName xmlns="">Simulator</ToolName>
</com_atmel_avrdbg_tool_simulator>
<com_atmel_avrdbg_tool_nedbg>
<ToolOptions>
<InterfaceProperties>
<UpdiClock>750000</UpdiClock>
</InterfaceProperties>
<InterfaceName>UPDI</InterfaceName>
</ToolOptions>
<ToolType>com.atmel.avrdbg.tool.nedbg</ToolType>
<ToolNumber>ATML3094051800000431</ToolNumber>
<ToolName>nEDBG</ToolName>
</com_atmel_avrdbg_tool_nedbg>
<avrtoolinterfaceclock>750000</avrtoolinterfaceclock>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=attiny817 -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.1.102\gcc\dev\attiny817"</avrgcc.common.Device>
<avrgcc.common.Device>-mmcu=atmega4809 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\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>
......@@ -57,7 +99,7 @@
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.1.102\include</Value>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
......@@ -71,7 +113,7 @@
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.1.102\include</Value>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
</AvrGcc>
......@@ -80,7 +122,7 @@
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=attiny817 -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.1.102\gcc\dev\attiny817"</avrgcc.common.Device>
<avrgcc.common.Device>-mmcu=atmega4809 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\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>
......@@ -95,7 +137,7 @@
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.1.102\include</Value>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
......@@ -110,7 +152,7 @@
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.1.102\include</Value>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
......
......@@ -14,7 +14,7 @@
* F_CPU must be defined before including headers.
*/
#define F_CPU 3333333UL //The ATtiny817 operates at 20MHz with a default scaling factor of 6: 20/6 = 3.333333MHz
#define F_CPU 3333333UL //The ATtiny4809 operates at 20MHz with a default scaling factor of 6: 20/6 = 3.333333MHz
/**
* System headers bellow
......@@ -25,11 +25,15 @@
/**
* Define helpers for pin bit positions.
* The LED0 on the ATtiny817 main board is connected to pin 4 on port B.
* The LED0 on the ATtiny4809 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.
*/
#define LED0 4 // LED0 is connected to pin 4 on port B
#define LED0 4 // LED 1 is connected to pin 4 on PORTD
int main(void){
/**
......@@ -40,11 +44,12 @@ int main(void){
* 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
* 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
*/
PORTB.DIR |= (1 << LED0); // Set LED0 as output - Using "B" in PORTx.DIR since the LED is connected to port B 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
......@@ -52,8 +57,9 @@ int main(void){
while (1)
{
PORTB.OUT ^= (1 << LED0); // Changes the state of LED0 by XOR-ing the last state. Check the XOR-table to find out how this works.
// Non-compressed: PORTB.OUT = PORTB.OUT ^ (1 << LED0);
PORTD.OUT ^= (1 << LED0); // Changes the state of LED0 by XOR-ing the last state. Check the XOR-table to find out how this works.
// Non-compressed: PORTD.OUT = PORTD.OUT ^ (1 << LED0);
//Can also refer to toogle register: PORTD.OUTTGL = (1 << LED0). IMPORTANT: only use equal sign here (=)
_delay_ms(500);
}
}
......@@ -9,13 +9,13 @@
<CSub></CSub>
<CVariant></CVariant>
<CVendor>Atmel</CVendor>
<CVersion>1.1.0</CVersion>
<DefaultRepoPath>D:/Atmel\7.0\Packs</DefaultRepoPath>
<CVersion>1.2.0</CVersion>
<DefaultRepoPath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs</DefaultRepoPath>
<DependentComponents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
<Description></Description>
<Files xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>D:/Atmel\7.0\Packs\atmel\ATtiny_DFP\1.1.102\include</AbsolutePath>
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include</AbsolutePath>
<Attribute></Attribute>
<Category>include</Category>
<Condition>C</Condition>
......@@ -26,29 +26,29 @@
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>D:/Atmel\7.0\Packs\atmel\ATtiny_DFP\1.1.102\include\avr\iotn817.h</AbsolutePath>
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include\avr\iom4809.h</AbsolutePath>
<Attribute></Attribute>
<Category>header</Category>
<Condition>C</Condition>
<FileContentHash>GzsE/dwQAz37AkZENa/sHg==</FileContentHash>
<FileContentHash>mWiFIOAGwUPlW0rYsXcjkg==</FileContentHash>
<FileVersion></FileVersion>
<Name>include/avr/iotn817.h</Name>
<Name>include/avr/iom4809.h</Name>
<SelectString></SelectString>
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>D:/Atmel\7.0\Packs\atmel\ATtiny_DFP\1.1.102\templates\main.c</AbsolutePath>
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\templates\main.c</AbsolutePath>
<Attribute>template</Attribute>
<Category>source</Category>
<Condition>C Exe</Condition>
<FileContentHash>9Sja2uJ3CnNJ4jsn5JQvZw==</FileContentHash>
<FileContentHash>GD1k8YYhulqRs6FD1B2Hog==</FileContentHash>
<FileVersion></FileVersion>
<Name>templates/main.c</Name>
<SelectString>Main file (.c)</SelectString>
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>D:/Atmel\7.0\Packs\atmel\ATtiny_DFP\1.1.102\templates\main.cpp</AbsolutePath>
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\templates\main.cpp</AbsolutePath>
<Attribute>template</Attribute>
<Category>source</Category>
<Condition>C Exe</Condition>
......@@ -59,22 +59,22 @@
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>D:/Atmel\7.0\Packs\atmel\ATtiny_DFP\1.1.102\gcc\dev\attiny817</AbsolutePath>
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega4809</AbsolutePath>
<Attribute></Attribute>
<Category>libraryPrefix</Category>
<Condition>GCC</Condition>
<FileContentHash i:nil="true" />
<FileVersion></FileVersion>
<Name>gcc/dev/attiny817</Name>
<Name>gcc/dev/atmega4809</Name>
<SelectString></SelectString>
<SourcePath></SourcePath>
</d4p1:anyType>
</Files>
<PackName>ATtiny_DFP</PackName>
<PackPath>D:/Atmel/7.0/Packs/atmel/ATtiny_DFP/1.1.102/Atmel.ATtiny_DFP.pdsc</PackPath>
<PackVersion>1.1.102</PackVersion>
<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>
<PresentInProject>true</PresentInProject>
<ReferenceConditionId>ATtiny817</ReferenceConditionId>
<ReferenceConditionId>ATmega4809</ReferenceConditionId>
<RteComponents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:string></d4p1:string>
</RteComponents>
......
......@@ -5,7 +5,7 @@
<ProjectVersion>7.0</ProjectVersion>
<ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName>
<ProjectGuid>dce6c7e3-ee26-4d79-826b-08594b9ad897</ProjectGuid>
<avrdevice>ATtiny817</avrdevice>
<avrdevice>ATmega4809</avrdevice>
<avrdeviceseries>none</avrdeviceseries>
<OutputType>Executable</OutputType>
<Language>C</Language>
......@@ -27,22 +27,25 @@
<BootSegment>2</BootSegment>
<eraseonlaunchrule>0</eraseonlaunchrule>
<AsfFrameworkConfig>
<framework-data xmlns="">
<framework-data>
<options />
<configurations />
<files />
<documentation help="" />
<offline-documentation help="" />
<dependencies>
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.32.0" />
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.34.1" />
</dependencies>
</framework-data>
</AsfFrameworkConfig>
<ResetRule>0</ResetRule>
<EraseKey />
<avrtool />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=attiny817 -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.1.102\gcc\dev\attiny817"</avrgcc.common.Device>
<avrgcc.common.Device>-mmcu=atmega4809 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\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>
......@@ -57,7 +60,7 @@
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.1.102\include</Value>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
......@@ -71,7 +74,7 @@
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.1.102\include</Value>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
</AvrGcc>
......@@ -80,7 +83,7 @@
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=attiny817 -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.1.102\gcc\dev\attiny817"</avrgcc.common.Device>
<avrgcc.common.Device>-mmcu=atmega4809 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\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>
......@@ -95,7 +98,7 @@
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.1.102\include</Value>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
......@@ -110,7 +113,7 @@
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.1.102\include</Value>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
......
......@@ -15,21 +15,21 @@
#include <util/delay.h>
/*
* Check out the ATtiny817 datasheet to find the correct ports and pins
* Check out the ATtiny4809 datasheet to find the correct ports and pins
*/
// LED
#define LED0 4 //On port B
#define LED0 4 //On port D
// Button
#define SW0 5 //On port B
#define SW0 2 //On port C
int main(void)
{
/*
* We want to send signals to the LEDs, in order to turn it off and on.
* We also want to be able to read the switches.
* This is done by setting bits in the PORTx.DIR register (in this case PORTB.DIR)
* This is done by setting bits in the PORTx.DIR register (in this case PORTD.DIR and PORTC.DIR)
* PORTx.DIR: 1 is output, 0 is input
* LED: 1 LED is off, 0 LED is on
* Button: 1 Button is open, 0 button is pressed
......@@ -41,8 +41,8 @@ int main(void)
/**
* In order to read from the switches, we need to give it a ground reference, via a pull-up resistor.
* If we don't, the switch will have a floating ground, and hence its value will be undefined.
* On the ATtiny817, we enable pull-up by setting the "PORT_PULLUPEN" flag in "PORTx.PINnCTRL" high.
* See datasheet section 16 (I/O-ports) and user guide section 4 (Hardware User Guide).
* On the ATtiny4809, we enable pull-up by setting the "PORT_PULLUPEN" flag in "PORTx.PINnCTRL" high.
* See datasheet section 15 (I/O-ports).
*/
/*
......
</
......@@ -9,13 +9,13 @@
<CSub></CSub>
<CVariant></CVariant>
<CVendor>Atmel</CVendor>
<CVersion>1.1.0</CVersion>
<DefaultRepoPath>D:/Atmel\7.0\Packs</DefaultRepoPath>
<CVersion>1.2.0</CVersion>
<DefaultRepoPath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs</DefaultRepoPath>
<DependentComponents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
<Description></Description>
<Files xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>D:/Atmel\7.0\Packs\atmel\ATtiny_DFP\1.1.102\include</AbsolutePath>
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include</AbsolutePath>
<Attribute></Attribute>
<Category>include</Category>
<Condition>C</Condition>
......@@ -26,29 +26,29 @@
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>D:/Atmel\7.0\Packs\atmel\ATtiny_DFP\1.1.102\include\avr\iotn817.h</AbsolutePath>
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include\avr\iom4809.h</AbsolutePath>
<Attribute></Attribute>
<Category>header</Category>
<Condition>C</Condition>
<FileContentHash>GzsE/dwQAz37AkZENa/sHg==</FileContentHash>
<FileContentHash>mWiFIOAGwUPlW0rYsXcjkg==</FileContentHash>
<FileVersion></FileVersion>
<Name>include/avr/iotn817.h</Name>
<Name>include/avr/iom4809.h</Name>
<SelectString></SelectString>
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>D:/Atmel\7.0\Packs\atmel\ATtiny_DFP\1.1.102\templates\main.c</AbsolutePath>
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\templates\main.c</AbsolutePath>
<Attribute>template</Attribute>
<Category>source</Category>
<Condition>C Exe</Condition>
<FileContentHash>zz/ElODBfy/fHwp9vidNjg==</FileContentHash>
<FileContentHash>GD1k8YYhulqRs6FD1B2Hog==</FileContentHash>
<FileVersion></FileVersion>
<Name>templates/main.c</Name>
<SelectString>Main file (.c)</SelectString>
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>D:/Atmel\7.0\Packs\atmel\ATtiny_DFP\1.1.102\templates\main.cpp</AbsolutePath>
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\templates\main.cpp</AbsolutePath>
<Attribute>template</Attribute>
<Category>source</Category>
<Condition>C Exe</Condition>