Reviewed Task2 and added README's

parent 47a517dc
......@@ -22,4 +22,4 @@ Task 4: (OPTIONAL)
Add the OLED board.
Find out where the buttons and LEDs connect.
Do something fun with the additional leds and buttons.
\ No newline at end of file
Do something fun with the additional leds and buttons.
---Session 1---
Task 1:
Learn how to open Atmel Studio.
Read the code, what do you think it does?
Learn how to upload code.
Task 2:
Set up a button with pullup. Use this to control the led.
Task 3:
Add aditional logic so that the button toggles the led.
Task 4: (OPTIONAL)
Add the OLED board.
Find out where the buttons and LEDs connect.
Do something fun with the additional leds and buttons.
......@@ -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,21 +15,25 @@
#include <util/delay.h>
/*
* Check out the ATtiny4809 datasheet to find the correct ports and pins
*/
* Take a look at the Atmega4809 Curiosity Nano board and locate "SW0" and "LED0".
* Right below each of them you can see which pin they are connected to. For example, if it said PD5, this would mean Port D and Pin 5.
* This info can also be found in the ATmega4809 Curiosity Nano Hardware User Guide here: http://ww1.microchip.com/downloads/en/DeviceDoc/ATmega4809-Curiosity-Nano-HW-UG-DS50002804A.pdf to find the correct ports and pins
*/
//Fill in the defines with the information you found on the board/in the user guide.
// LED
#define LED0 4 //On port D
#define LED0 //Fill in pin number
// Button
#define SW0 2 //On port C
#define SW0 //Fill in pin number
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 PORTD.DIR and PORTC.DIR)
* This is done by setting bits in the PORTx.DIR register (in this case PORTF.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,7 +45,7 @@ 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 ATtiny4809, we enable pull-up by setting the "PORT_PULLUPEN" flag in "PORTx.PINnCTRL" high.
* On the ATmega4809, we enable pull-up by setting the "PORT_PULLUPEN" flag in "PORTx.PINnCTRL" high.
* See datasheet section 15 (I/O-ports).
*/
......
---Session 2---
Task 1: Timer
Get hands on with timers and interupts to toggle a led at exact times.
Task 2: PWM
Continuing with timers, use them for pulse width modulation of LEDs
Task 3: UART
Write a UART driver to communicate with the PC.
Preferably interrupt based.
\ No newline at end of file
---Session 3---
Task 1:
Use the ADC to read the value of the light sensor on I/O 1 and send it over uart.
Task 2:
Write an SPI driver and and test it with the OLED screen and provided image.
Task 3: (OPTIONAL)
Use the screen and buttons to make a game! (Suggestion: Simon says)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment