Commit ef0b307a authored by kaspems's avatar kaspems
Browse files

Update Session2-LF/Timer/Timer/TIMER-LF.c

parent eed87fa2
......@@ -12,8 +12,7 @@
#include <util/delay.h>
#include <avr/interrupt.h>
#define LED1 4 // port D
#define LED2 5 // port D
#define LED0 5 // port D
......@@ -23,8 +22,7 @@ int main(void)
First set up the LEDs like in the previous exercise. You can either copy paste from the previous exercise or start fresh.
*/
PORTD.DIR = (1 << LED1) | (1 << LED2);
PORTD.OUTTGL = (1 << LED1); //Starting with only 1 LED on
PORTF.DIR = (1 << LED0);
/*We will be using timer A that will trigger an overflow interupt.
This is a 16 bit timer that can run in 2 modes
......@@ -61,7 +59,7 @@ int main(void)
ISR(TCA0_OVF_vect){
//Do something with the led(s), like toggle.
PORTD.OUTTGL = (1 << LED1) | (1 << LED2);
PORTF.OUTTGL = (1 << LED0);
//Clear the interrupt flag.
//If we do not clear the flag, we will instantly jump back into the ISR again
......
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