P3 initial

This commit is contained in:
S170H
2023-11-22 18:25:14 +01:00
parent ec783fd3b6
commit be0247a93b
40 changed files with 2406 additions and 303 deletions

52
.gitignore vendored
View File

@@ -1,52 +0,0 @@
# Prerequisites
*.d
# Object files
*.o
*.ko
*.obj
*.elf
# Linker output
*.ilk
*.map
*.exp
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf

Binary file not shown.

View File

@@ -0,0 +1,68 @@
/*
* P2 Interrups.c
*
* Created: 11.11.2023 21:07:41
* Author : Safak
*/
#include <avr/io.h>
#define F_CPU 16000000UL
#include <avr/interrupt.h>
#include <util/delay.h>
#include <stdbool.h> // boolean type and values
#define LED0 PINB0
#define LED9 PINB1
#define SW1 PIND2
#define SW2 PIND3
volatile int activeLED = LED0;
volatile bool blink = true;
void setupPorts() {
DDRB = 0xff;
PORTB = 0x00;
DDRD = 0x00;
PORTD |= (1 << SW1) | (1 << SW2); // Activate pull-up resistors
// Falling edge of INT0 and INT1 generates an interrupt request
EICRA |= (1 << ISC11) | (1 << ISC01);
EIMSK |= (1 << INT0) | (1 << INT1); // Enable external interrupt request
sei(); // Set global interrupt enable
}
// SW1 is pressed
ISR(INT0_vect) {
if (activeLED == LED0) { // if D0 is already on, switching from blink to steady light or vice versa
blink = !blink;
}
else { // else D9 is on, turn off D9 and turn on D0
PORTB = (1 << LED0);
}
activeLED = LED0;
}
// SW2 is pressed
ISR(INT1_vect) {
if (activeLED == LED9) {
blink = !blink;
}
else {
PORTB = (1 << LED9);
}
activeLED = LED9;
}
int main(void) {
setupPorts();
while (1) {
if (blink) {
PORTB ^= (1 << activeLED); // Toggle active LED
}
_delay_ms(50);
}
}

View File

@@ -0,0 +1,62 @@
/*
* P2 Pooling.c
*
* Created: 11.11.2023 21:06:54
* Author : Safak
*/
#include <avr/io.h>
#define F_CPU 16000000UL
#include <util/delay.h>
#include <stdbool.h>
#define LED0 PINB0
#define LED9 PINB1
#define SW1 PIND2
#define SW2 PIND3
int activeLED = LED0;
bool blinking = true;
void setupPorts() {
DDRB = 0xff; // DDRB as output
PORTB = 0x00;
DDRD = 0x00; // DDRD as input
PORTD = 0xff;
}
void isButtonPressed() {
if ( !(PIND & (1 << SW1)) ) { // SW1 is pressed
if (activeLED == LED0) { // if D0 is on
blinking = !blinking; // toggle blinking
}
else { // switch LED
PORTB = (1 << LED0);
}
activeLED = LED0;
}
else if ( !(PIND & (1 << SW2))) { // SW2 is pressed
if (activeLED == LED9) { // if D9 is on
blinking = !blinking; // toggle blinking
}
else { // switch LED
PORTB = (1 << LED9);
}
activeLED = LED9;
}
}
int main(void) {
setupPorts();
while (1) {
isButtonPressed();
if (blinking) {
PORTB ^= (1 << activeLED);
}
else {
PORTB = (1 << activeLED);
}
_delay_ms(250);
}
}

Binary file not shown.

Binary file not shown.

View File

@@ -1,18 +0,0 @@
{
"configurations": [
{
"name": "windows-msvc-x64",
"includePath": [
"${workspaceFolder}/**"
],
"compilerPath": "cl.exe",
"cStandard": "c11",
"cppStandard": "c++14",
"intelliSenseMode": "windows-msvc-x64",
"compilerArgs": [
""
]
}
],
"version": 4
}

View File

@@ -1,15 +0,0 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "C/C++ Runner: Debug Session",
"type": "cppvsdbg",
"request": "launch",
"args": [],
"stopAtEntry": false,
"console": "externalTerminal",
"cwd": ".",
"program": "build/Debug/outDebug"
}
]
}

View File

@@ -1,59 +0,0 @@
{
"C_Cpp_Runner.cCompilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat",
"C_Cpp_Runner.cppCompilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat",
"C_Cpp_Runner.debuggerPath": "gdb",
"C_Cpp_Runner.cStandard": "",
"C_Cpp_Runner.cppStandard": "c++14",
"C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat",
"C_Cpp_Runner.useMsvc": true,
"C_Cpp_Runner.warnings": [
"-Wall",
"-Wextra",
"-Wpedantic",
"-Wshadow",
"-Wformat=2",
"-Wcast-align",
"-Wconversion",
"-Wsign-conversion",
"-Wnull-dereference"
],
"C_Cpp_Runner.msvcWarnings": [
"/W4",
"/permissive-",
"/w14242",
"/w14287",
"/w14296",
"/w14311",
"/w14826",
"/w44062",
"/w44242",
"/w14905",
"/w14906",
"/w14263",
"/w44265",
"/w14928"
],
"C_Cpp_Runner.enableWarnings": true,
"C_Cpp_Runner.warningsAsError": false,
"C_Cpp_Runner.compilerArgs": [],
"C_Cpp_Runner.linkerArgs": [],
"C_Cpp_Runner.includePaths": [],
"C_Cpp_Runner.includeSearch": [
"*",
"**/*"
],
"C_Cpp_Runner.excludeSearch": [
"**/build",
"**/build/**",
"**/.*",
"**/.*/**",
"**/.vscode",
"**/.vscode/**"
],
"C_Cpp_Runner.useAddressSanitizer": false,
"C_Cpp_Runner.useUndefinedSanitizer": false,
"C_Cpp_Runner.useLeakSanitizer": false,
"C_Cpp_Runner.showCompilationTime": false,
"C_Cpp_Runner.useLinkTimeOptimization": false,
"C_Cpp_Runner.msvcSecureNoWarnings": false
}

8
P1/P1/Debug/P1.hex Normal file
View File

@@ -0,0 +1,8 @@
:020000020000FC
:1000000000C00FEF0DBF08E00EBF1FEF1AB923E0CD
:1000100024B911E01BB918D0110F1030D9F71BB952
:1000200021E025B911D0220F2230D9F725B90CD003
:1000300026952030D9F725B910E81BB905D01695BB
:100040001130D9F70C940A0031E14CE35CEC5A957D
:0C005000F1F74A95E1F73A95D1F70895D1
:00000001FF

View File

@@ -1,10 +1,10 @@
AVRASM ver. 2.2.7 C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm Tue Oct 31 15:07:47 2023
AVRASM ver. 2.2.7 C:\Users\Safak\SynologyDrive\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm Tue Nov 14 00:02:30 2023
[builtin](2): Including file 'C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\avrasm\inc\m328pdef.inc'
C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm(8): Including file 'C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\avrasm\inc\m328pdef.inc'
C:\Users\Safak\SynologyDrive\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm(8): Including file 'C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\avrasm\inc\m328pdef.inc'
[builtin](2): Including file 'C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\avrasm\inc\m328pdef.inc'
C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm(8): Including file 'C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\avrasm\inc\m328pdef.inc'
C:\Users\Safak\SynologyDrive\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm(8): Including file 'C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\avrasm\inc\m328pdef.inc'
;

704
P1/P1/Debug/P1.map Normal file
View File

@@ -0,0 +1,704 @@
AVRASM ver. 2.2.7 C:\Users\Safak\SynologyDrive\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm Tue Nov 14 00:02:30 2023
EQU SIGNATURE_000 0000001e
EQU SIGNATURE_001 00000095
EQU SIGNATURE_002 0000000f
EQU UDR0 000000c6
EQU UBRR0L 000000c4
EQU UBRR0H 000000c5
EQU UCSR0C 000000c2
EQU UCSR0B 000000c1
EQU UCSR0A 000000c0
EQU TWAMR 000000bd
EQU TWCR 000000bc
EQU TWDR 000000bb
EQU TWAR 000000ba
EQU TWSR 000000b9
EQU TWBR 000000b8
EQU ASSR 000000b6
EQU OCR2B 000000b4
EQU OCR2A 000000b3
EQU TCNT2 000000b2
EQU TCCR2B 000000b1
EQU TCCR2A 000000b0
EQU OCR1BL 0000008a
EQU OCR1BH 0000008b
EQU OCR1AL 00000088
EQU OCR1AH 00000089
EQU ICR1L 00000086
EQU ICR1H 00000087
EQU TCNT1L 00000084
EQU TCNT1H 00000085
EQU TCCR1C 00000082
EQU TCCR1B 00000081
EQU TCCR1A 00000080
EQU DIDR1 0000007f
EQU DIDR0 0000007e
EQU ADMUX 0000007c
EQU ADCSRB 0000007b
EQU ADCSRA 0000007a
EQU ADCH 00000079
EQU ADCL 00000078
EQU TIMSK2 00000070
EQU TIMSK1 0000006f
EQU TIMSK0 0000006e
EQU PCMSK1 0000006c
EQU PCMSK2 0000006d
EQU PCMSK0 0000006b
EQU EICRA 00000069
EQU PCICR 00000068
EQU OSCCAL 00000066
EQU PRR 00000064
EQU CLKPR 00000061
EQU WDTCSR 00000060
EQU SREG 0000003f
EQU SPL 0000003d
EQU SPH 0000003e
EQU SPMCSR 00000037
EQU MCUCR 00000035
EQU MCUSR 00000034
EQU SMCR 00000033
EQU ACSR 00000030
EQU SPDR 0000002e
EQU SPSR 0000002d
EQU SPCR 0000002c
EQU GPIOR2 0000002b
EQU GPIOR1 0000002a
EQU OCR0B 00000028
EQU OCR0A 00000027
EQU TCNT0 00000026
EQU TCCR0B 00000025
EQU TCCR0A 00000024
EQU GTCCR 00000023
EQU EEARH 00000022
EQU EEARL 00000021
EQU EEDR 00000020
EQU EECR 0000001f
EQU GPIOR0 0000001e
EQU EIMSK 0000001d
EQU EIFR 0000001c
EQU PCIFR 0000001b
EQU TIFR2 00000017
EQU TIFR1 00000016
EQU TIFR0 00000015
EQU PORTD 0000000b
EQU DDRD 0000000a
EQU PIND 00000009
EQU PORTC 00000008
EQU DDRC 00000007
EQU PINC 00000006
EQU PORTB 00000005
EQU DDRB 00000004
EQU PINB 00000003
EQU UDR0_0 00000000
EQU UDR0_1 00000001
EQU UDR0_2 00000002
EQU UDR0_3 00000003
EQU UDR0_4 00000004
EQU UDR0_5 00000005
EQU UDR0_6 00000006
EQU UDR0_7 00000007
EQU MPCM0 00000000
EQU U2X0 00000001
EQU UPE0 00000002
EQU DOR0 00000003
EQU FE0 00000004
EQU UDRE0 00000005
EQU TXC0 00000006
EQU RXC0 00000007
EQU TXB80 00000000
EQU RXB80 00000001
EQU UCSZ02 00000002
EQU TXEN0 00000003
EQU RXEN0 00000004
EQU UDRIE0 00000005
EQU TXCIE0 00000006
EQU RXCIE0 00000007
EQU UCPOL0 00000000
EQU UCSZ00 00000001
EQU UCPHA0 00000001
EQU UCSZ01 00000002
EQU UDORD0 00000002
EQU USBS0 00000003
EQU UPM00 00000004
EQU UPM01 00000005
EQU UMSEL00 00000006
EQU UMSEL0 00000006
EQU UMSEL01 00000007
EQU UMSEL1 00000007
EQU UBRR8 00000000
EQU UBRR9 00000001
EQU UBRR10 00000002
EQU UBRR11 00000003
EQU _UBRR0 00000000
EQU _UBRR1 00000001
EQU UBRR2 00000002
EQU UBRR3 00000003
EQU UBRR4 00000004
EQU UBRR5 00000005
EQU UBRR6 00000006
EQU UBRR7 00000007
EQU TWAM0 00000001
EQU TWAMR0 00000001
EQU TWAM1 00000002
EQU TWAMR1 00000002
EQU TWAM2 00000003
EQU TWAMR2 00000003
EQU TWAM3 00000004
EQU TWAMR3 00000004
EQU TWAM4 00000005
EQU TWAMR4 00000005
EQU TWAM5 00000006
EQU TWAMR5 00000006
EQU TWAM6 00000007
EQU TWAMR6 00000007
EQU TWBR0 00000000
EQU TWBR1 00000001
EQU TWBR2 00000002
EQU TWBR3 00000003
EQU TWBR4 00000004
EQU TWBR5 00000005
EQU TWBR6 00000006
EQU TWBR7 00000007
EQU TWIE 00000000
EQU TWEN 00000002
EQU TWWC 00000003
EQU TWSTO 00000004
EQU TWSTA 00000005
EQU TWEA 00000006
EQU TWINT 00000007
EQU TWPS0 00000000
EQU TWPS1 00000001
EQU TWS3 00000003
EQU TWS4 00000004
EQU TWS5 00000005
EQU TWS6 00000006
EQU TWS7 00000007
EQU TWD0 00000000
EQU TWD1 00000001
EQU TWD2 00000002
EQU TWD3 00000003
EQU TWD4 00000004
EQU TWD5 00000005
EQU TWD6 00000006
EQU TWD7 00000007
EQU TWGCE 00000000
EQU TWA0 00000001
EQU TWA1 00000002
EQU TWA2 00000003
EQU TWA3 00000004
EQU TWA4 00000005
EQU TWA5 00000006
EQU TWA6 00000007
EQU TOIE1 00000000
EQU OCIE1A 00000001
EQU OCIE1B 00000002
EQU ICIE1 00000005
EQU TOV1 00000000
EQU OCF1A 00000001
EQU OCF1B 00000002
EQU ICF1 00000005
EQU WGM10 00000000
EQU WGM11 00000001
EQU COM1B0 00000004
EQU COM1B1 00000005
EQU COM1A0 00000006
EQU COM1A1 00000007
EQU CS10 00000000
EQU CS11 00000001
EQU CS12 00000002
EQU WGM12 00000003
EQU WGM13 00000004
EQU ICES1 00000006
EQU ICNC1 00000007
EQU FOC1B 00000006
EQU FOC1A 00000007
EQU PSRSYNC 00000000
EQU TSM 00000007
EQU TOIE2 00000000
EQU TOIE2A 00000000
EQU OCIE2A 00000001
EQU OCIE2B 00000002
EQU TOV2 00000000
EQU OCF2A 00000001
EQU OCF2B 00000002
EQU WGM20 00000000
EQU WGM21 00000001
EQU COM2B0 00000004
EQU COM2B1 00000005
EQU COM2A0 00000006
EQU COM2A1 00000007
EQU CS20 00000000
EQU CS21 00000001
EQU CS22 00000002
EQU WGM22 00000003
EQU FOC2B 00000006
EQU FOC2A 00000007
EQU TCNT2_0 00000000
EQU TCNT2_1 00000001
EQU TCNT2_2 00000002
EQU TCNT2_3 00000003
EQU TCNT2_4 00000004
EQU TCNT2_5 00000005
EQU TCNT2_6 00000006
EQU TCNT2_7 00000007
EQU OCR2A_0 00000000
EQU OCR2A_1 00000001
EQU OCR2A_2 00000002
EQU OCR2A_3 00000003
EQU OCR2A_4 00000004
EQU OCR2A_5 00000005
EQU OCR2A_6 00000006
EQU OCR2A_7 00000007
EQU OCR2B_0 00000000
EQU OCR2B_1 00000001
EQU OCR2B_2 00000002
EQU OCR2B_3 00000003
EQU OCR2B_4 00000004
EQU OCR2B_5 00000005
EQU OCR2B_6 00000006
EQU OCR2B_7 00000007
EQU TCR2BUB 00000000
EQU TCR2AUB 00000001
EQU OCR2BUB 00000002
EQU OCR2AUB 00000003
EQU TCN2UB 00000004
EQU AS2 00000005
EQU EXCLK 00000006
EQU PSRASY 00000001
EQU PSR2 00000001
EQU MUX0 00000000
EQU MUX1 00000001
EQU MUX2 00000002
EQU MUX3 00000003
EQU ADLAR 00000005
EQU REFS0 00000006
EQU REFS1 00000007
EQU ADPS0 00000000
EQU ADPS1 00000001
EQU ADPS2 00000002
EQU ADIE 00000003
EQU ADIF 00000004
EQU ADATE 00000005
EQU ADSC 00000006
EQU ADEN 00000007
EQU ADTS0 00000000
EQU ADTS1 00000001
EQU ADTS2 00000002
EQU ACME 00000006
EQU ADCH0 00000000
EQU ADCH1 00000001
EQU ADCH2 00000002
EQU ADCH3 00000003
EQU ADCH4 00000004
EQU ADCH5 00000005
EQU ADCH6 00000006
EQU ADCH7 00000007
EQU ADCL0 00000000
EQU ADCL1 00000001
EQU ADCL2 00000002
EQU ADCL3 00000003
EQU ADCL4 00000004
EQU ADCL5 00000005
EQU ADCL6 00000006
EQU ADCL7 00000007
EQU ADC0D 00000000
EQU ADC1D 00000001
EQU ADC2D 00000002
EQU ADC3D 00000003
EQU ADC4D 00000004
EQU ADC5D 00000005
EQU ACIS0 00000000
EQU ACIS1 00000001
EQU ACIC 00000002
EQU ACIE 00000003
EQU ACI 00000004
EQU ACO 00000005
EQU ACBG 00000006
EQU ACD 00000007
EQU AIN0D 00000000
EQU AIN1D 00000001
EQU PORTB0 00000000
EQU PB0 00000000
EQU PORTB1 00000001
EQU PB1 00000001
EQU PORTB2 00000002
EQU PB2 00000002
EQU PORTB3 00000003
EQU PB3 00000003
EQU PORTB4 00000004
EQU PB4 00000004
EQU PORTB5 00000005
EQU PB5 00000005
EQU PORTB6 00000006
EQU PB6 00000006
EQU PORTB7 00000007
EQU PB7 00000007
EQU DDB0 00000000
EQU DDB1 00000001
EQU DDB2 00000002
EQU DDB3 00000003
EQU DDB4 00000004
EQU DDB5 00000005
EQU DDB6 00000006
EQU DDB7 00000007
EQU PINB0 00000000
EQU PINB1 00000001
EQU PINB2 00000002
EQU PINB3 00000003
EQU PINB4 00000004
EQU PINB5 00000005
EQU PINB6 00000006
EQU PINB7 00000007
EQU PORTC0 00000000
EQU PC0 00000000
EQU PORTC1 00000001
EQU PC1 00000001
EQU PORTC2 00000002
EQU PC2 00000002
EQU PORTC3 00000003
EQU PC3 00000003
EQU PORTC4 00000004
EQU PC4 00000004
EQU PORTC5 00000005
EQU PC5 00000005
EQU PORTC6 00000006
EQU PC6 00000006
EQU DDC0 00000000
EQU DDC1 00000001
EQU DDC2 00000002
EQU DDC3 00000003
EQU DDC4 00000004
EQU DDC5 00000005
EQU DDC6 00000006
EQU PINC0 00000000
EQU PINC1 00000001
EQU PINC2 00000002
EQU PINC3 00000003
EQU PINC4 00000004
EQU PINC5 00000005
EQU PINC6 00000006
EQU PORTD0 00000000
EQU PD0 00000000
EQU PORTD1 00000001
EQU PD1 00000001
EQU PORTD2 00000002
EQU PD2 00000002
EQU PORTD3 00000003
EQU PD3 00000003
EQU PORTD4 00000004
EQU PD4 00000004
EQU PORTD5 00000005
EQU PD5 00000005
EQU PORTD6 00000006
EQU PD6 00000006
EQU PORTD7 00000007
EQU PD7 00000007
EQU DDD0 00000000
EQU DDD1 00000001
EQU DDD2 00000002
EQU DDD3 00000003
EQU DDD4 00000004
EQU DDD5 00000005
EQU DDD6 00000006
EQU DDD7 00000007
EQU PIND0 00000000
EQU PIND1 00000001
EQU PIND2 00000002
EQU PIND3 00000003
EQU PIND4 00000004
EQU PIND5 00000005
EQU PIND6 00000006
EQU PIND7 00000007
EQU TOIE0 00000000
EQU OCIE0A 00000001
EQU OCIE0B 00000002
EQU TOV0 00000000
EQU OCF0A 00000001
EQU OCF0B 00000002
EQU WGM00 00000000
EQU WGM01 00000001
EQU COM0B0 00000004
EQU COM0B1 00000005
EQU COM0A0 00000006
EQU COM0A1 00000007
EQU CS00 00000000
EQU CS01 00000001
EQU CS02 00000002
EQU WGM02 00000003
EQU FOC0B 00000006
EQU FOC0A 00000007
EQU TCNT0_0 00000000
EQU TCNT0_1 00000001
EQU TCNT0_2 00000002
EQU TCNT0_3 00000003
EQU TCNT0_4 00000004
EQU TCNT0_5 00000005
EQU TCNT0_6 00000006
EQU TCNT0_7 00000007
EQU OCR0A_0 00000000
EQU OCR0A_1 00000001
EQU OCR0A_2 00000002
EQU OCR0A_3 00000003
EQU OCR0A_4 00000004
EQU OCR0A_5 00000005
EQU OCR0A_6 00000006
EQU OCR0A_7 00000007
EQU OCR0B_0 00000000
EQU OCR0B_1 00000001
EQU OCR0B_2 00000002
EQU OCR0B_3 00000003
EQU OCR0B_4 00000004
EQU OCR0B_5 00000005
EQU OCR0B_6 00000006
EQU OCR0B_7 00000007
EQU PSR10 00000000
EQU ISC00 00000000
EQU ISC01 00000001
EQU ISC10 00000002
EQU ISC11 00000003
EQU INT0 00000000
EQU INT1 00000001
EQU INTF0 00000000
EQU INTF1 00000001
EQU PCIE0 00000000
EQU PCIE1 00000001
EQU PCIE2 00000002
EQU PCINT16 00000000
EQU PCINT17 00000001
EQU PCINT18 00000002
EQU PCINT19 00000003
EQU PCINT20 00000004
EQU PCINT21 00000005
EQU PCINT22 00000006
EQU PCINT23 00000007
EQU PCINT8 00000000
EQU PCINT9 00000001
EQU PCINT10 00000002
EQU PCINT11 00000003
EQU PCINT12 00000004
EQU PCINT13 00000005
EQU PCINT14 00000006
EQU PCINT0 00000000
EQU PCINT1 00000001
EQU PCINT2 00000002
EQU PCINT3 00000003
EQU PCINT4 00000004
EQU PCINT5 00000005
EQU PCINT6 00000006
EQU PCINT7 00000007
EQU PCIF0 00000000
EQU PCIF1 00000001
EQU PCIF2 00000002
EQU SPDR0 00000000
EQU SPDR1 00000001
EQU SPDR2 00000002
EQU SPDR3 00000003
EQU SPDR4 00000004
EQU SPDR5 00000005
EQU SPDR6 00000006
EQU SPDR7 00000007
EQU SPI2X 00000000
EQU WCOL 00000006
EQU SPIF 00000007
EQU SPR0 00000000
EQU SPR1 00000001
EQU CPHA 00000002
EQU CPOL 00000003
EQU MSTR 00000004
EQU DORD 00000005
EQU SPE 00000006
EQU SPIE 00000007
EQU WDP0 00000000
EQU WDP1 00000001
EQU WDP2 00000002
EQU WDE 00000003
EQU WDCE 00000004
EQU WDP3 00000005
EQU WDIE 00000006
EQU WDIF 00000007
EQU SREG_C 00000000
EQU SREG_Z 00000001
EQU SREG_N 00000002
EQU SREG_V 00000003
EQU SREG_S 00000004
EQU SREG_H 00000005
EQU SREG_T 00000006
EQU SREG_I 00000007
EQU CAL0 00000000
EQU CAL1 00000001
EQU CAL2 00000002
EQU CAL3 00000003
EQU CAL4 00000004
EQU CAL5 00000005
EQU CAL6 00000006
EQU CAL7 00000007
EQU CLKPS0 00000000
EQU CLKPS1 00000001
EQU CLKPS2 00000002
EQU CLKPS3 00000003
EQU CLKPCE 00000007
EQU SELFPRGEN 00000000
EQU SPMEN 00000000
EQU PGERS 00000001
EQU PGWRT 00000002
EQU BLBSET 00000003
EQU RWWSRE 00000004
EQU SIGRD 00000005
EQU RWWSB 00000006
EQU SPMIE 00000007
EQU IVCE 00000000
EQU IVSEL 00000001
EQU PUD 00000004
EQU BODSE 00000005
EQU BODS 00000006
EQU PORF 00000000
EQU EXTRF 00000001
EQU EXTREF 00000001
EQU BORF 00000002
EQU WDRF 00000003
EQU SE 00000000
EQU SM0 00000001
EQU SM1 00000002
EQU SM2 00000003
EQU GPIOR20 00000000
EQU GPIOR21 00000001
EQU GPIOR22 00000002
EQU GPIOR23 00000003
EQU GPIOR24 00000004
EQU GPIOR25 00000005
EQU GPIOR26 00000006
EQU GPIOR27 00000007
EQU GPIOR10 00000000
EQU GPIOR11 00000001
EQU GPIOR12 00000002
EQU GPIOR13 00000003
EQU GPIOR14 00000004
EQU GPIOR15 00000005
EQU GPIOR16 00000006
EQU GPIOR17 00000007
EQU GPIOR00 00000000
EQU GPIOR01 00000001
EQU GPIOR02 00000002
EQU GPIOR03 00000003
EQU GPIOR04 00000004
EQU GPIOR05 00000005
EQU GPIOR06 00000006
EQU GPIOR07 00000007
EQU PRADC 00000000
EQU PRUSART0 00000001
EQU PRSPI 00000002
EQU PRTIM1 00000003
EQU PRTIM0 00000005
EQU PRTIM2 00000006
EQU PRTWI 00000007
EQU EEAR0 00000000
EQU EEAR1 00000001
EQU EEAR2 00000002
EQU EEAR3 00000003
EQU EEAR4 00000004
EQU EEAR5 00000005
EQU EEAR6 00000006
EQU EEAR7 00000007
EQU EEAR8 00000000
EQU EEAR9 00000001
EQU EEDR0 00000000
EQU EEDR1 00000001
EQU EEDR2 00000002
EQU EEDR3 00000003
EQU EEDR4 00000004
EQU EEDR5 00000005
EQU EEDR6 00000006
EQU EEDR7 00000007
EQU EERE 00000000
EQU EEPE 00000001
EQU EEMPE 00000002
EQU EERIE 00000003
EQU EEPM0 00000004
EQU EEPM1 00000005
EQU LB1 00000000
EQU LB2 00000001
EQU BLB01 00000002
EQU BLB02 00000003
EQU BLB11 00000004
EQU BLB12 00000005
EQU CKSEL0 00000000
EQU CKSEL1 00000001
EQU CKSEL2 00000002
EQU CKSEL3 00000003
EQU SUT0 00000004
EQU SUT1 00000005
EQU CKOUT 00000006
EQU CKDIV8 00000007
EQU BOOTRST 00000000
EQU BOOTSZ0 00000001
EQU BOOTSZ1 00000002
EQU EESAVE 00000003
EQU WDTON 00000004
EQU SPIEN 00000005
EQU DWEN 00000006
EQU RSTDISBL 00000007
EQU BODLEVEL0 00000000
EQU BODLEVEL1 00000001
EQU BODLEVEL2 00000002
DEF XH r27
DEF XL r26
DEF YH r29
DEF YL r28
DEF ZH r31
DEF ZL r30
EQU FLASHEND 00003fff
EQU IOEND 000000ff
EQU SRAM_START 00000100
EQU SRAM_SIZE 00000800
EQU RAMEND 000008ff
EQU XRAMEND 00000000
EQU E2END 000003ff
EQU EEPROMEND 000003ff
EQU EEADRBITS 0000000a
EQU NRWW_START_ADDR 00003800
EQU NRWW_STOP_ADDR 00003fff
EQU RWW_START_ADDR 00000000
EQU RWW_STOP_ADDR 000037ff
EQU PAGESIZE 00000040
EQU FIRSTBOOTSTART 00003f00
EQU SECONDBOOTSTART 00003e00
EQU THIRDBOOTSTART 00003c00
EQU FOURTHBOOTSTART 00003800
EQU SMALLBOOTSTART 00003f00
EQU LARGEBOOTSTART 00003800
EQU INT0addr 00000002
EQU INT1addr 00000004
EQU PCI0addr 00000006
EQU PCI1addr 00000008
EQU PCI2addr 0000000a
EQU WDTaddr 0000000c
EQU OC2Aaddr 0000000e
EQU OC2Baddr 00000010
EQU OVF2addr 00000012
EQU ICP1addr 00000014
EQU OC1Aaddr 00000016
EQU OC1Baddr 00000018
EQU OVF1addr 0000001a
EQU OC0Aaddr 0000001c
EQU OC0Baddr 0000001e
EQU OVF0addr 00000020
EQU SPIaddr 00000022
EQU URXCaddr 00000024
EQU UDREaddr 00000026
EQU UTXCaddr 00000028
EQU ADCCaddr 0000002a
EQU ERDYaddr 0000002c
EQU ACIaddr 0000002e
EQU TWIaddr 00000030
EQU SPMRaddr 00000032
EQU INT_VECTORS_SIZE 00000034
CSEG init 00000001
CSEG portD_left 0000000a
CSEG delay 00000024
CSEG portB_left 00000011
CSEG portB_right 00000016
CSEG portD_right 0000001d
CSEG L1 00000027

BIN
P1/P1/Debug/P1.obj Normal file

Binary file not shown.

View File

@@ -1,18 +1,18 @@
<ASSEMBLER_INFO>
<VERSION>2.2.7</VERSION>
<DEVICE>"ATmega328P"</DEVICE>
<WORKING_DIR>C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\Debug</WORKING_DIR>
<WORKING_DIR>C:\Users\Safak\SynologyDrive\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\Debug</WORKING_DIR>
<INCLUDE_PATH>
<DIR>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\avrasm\inc</DIR>
<DIR>C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avrassembler\Include</DIR>
<DIR></DIR>
</INCLUDE_PATH>
<SOURCE_FILE>C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm</SOURCE_FILE>
<SOURCE_FILE>C:\Users\Safak\SynologyDrive\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm</SOURCE_FILE>
<INCLUDED_FILES>
<FILE>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\avrasm\inc\m328pdef.inc</FILE>
</INCLUDED_FILES>
<OBJECT_FILES>
<FILE>C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\Debug\P1.obj</FILE>
<FILE>C:\Users\Safak\SynologyDrive\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\Debug\P1.obj</FILE>
</OBJECT_FILES>
<HEX_FILES>
<FILE>P1.hex</FILE>
@@ -22,12 +22,12 @@
<FILE>P1.lss</FILE>
</OUTPUT_FILES>
<LABELS>
<init><FILE>C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm</FILE><LINE>13</LINE></init>
<portD_left><FILE>C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm</FILE><LINE>27</LINE></portD_left>
<delay><FILE>C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm</FILE><LINE>60</LINE></delay>
<portB_left><FILE>C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm</FILE><LINE>36</LINE></portB_left>
<portB_right><FILE>C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm</FILE><LINE>43</LINE></portB_right>
<portD_right><FILE>C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm</FILE><LINE>52</LINE></portD_right>
<L1><FILE>C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm</FILE><LINE>65</LINE></L1>
<init><FILE>C:\Users\Safak\SynologyDrive\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm</FILE><LINE>13</LINE></init>
<portD_left><FILE>C:\Users\Safak\SynologyDrive\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm</FILE><LINE>27</LINE></portD_left>
<delay><FILE>C:\Users\Safak\SynologyDrive\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm</FILE><LINE>60</LINE></delay>
<portB_left><FILE>C:\Users\Safak\SynologyDrive\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm</FILE><LINE>36</LINE></portB_left>
<portB_right><FILE>C:\Users\Safak\SynologyDrive\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm</FILE><LINE>43</LINE></portB_right>
<portD_right><FILE>C:\Users\Safak\SynologyDrive\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm</FILE><LINE>52</LINE></portD_right>
<L1><FILE>C:\Users\Safak\SynologyDrive\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm</FILE><LINE>65</LINE></L1>
</LABELS>
</ASSEMBLER_INFO>

Binary file not shown.

View File

@@ -0,0 +1,122 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
SHELL := cmd.exe
RM := rm -rf
USER_OBJS :=
LIBS :=
PROJ :=
O_SRCS :=
C_SRCS :=
S_SRCS :=
S_UPPER_SRCS :=
OBJ_SRCS :=
ASM_SRCS :=
PREPROCESSING_SRCS :=
OBJS :=
OBJS_AS_ARGS :=
C_DEPS :=
C_DEPS_AS_ARGS :=
EXECUTABLES :=
OUTPUT_FILE_PATH :=
OUTPUT_FILE_PATH_AS_ARGS :=
AVR_APP_PATH :=$$$AVR_APP_PATH$$$
QUOTE := "
ADDITIONAL_DEPENDENCIES:=
OUTPUT_FILE_DEP:=
LIB_DEP:=
LINKER_SCRIPT_DEP:=
# Every subdirectory with source files must be described here
SUBDIRS :=
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../main.c
PREPROCESSING_SRCS +=
ASM_SRCS +=
OBJS += \
main.o
OBJS_AS_ARGS += \
main.o
C_DEPS += \
main.d
C_DEPS_AS_ARGS += \
main.d
OUTPUT_FILE_PATH +=libP2\ Interrups.a
OUTPUT_FILE_PATH_AS_ARGS +="libP2 Interrups.a"
ADDITIONAL_DEPENDENCIES:=
OUTPUT_FILE_DEP:= ./makedep.mk
LIB_DEP+=
LINKER_SCRIPT_DEP+=
# AVR32/GNU C Compiler
./main.o: .././main.c
@echo Building file: $<
@echo Invoking: AVR/GNU C Compiler : 5.4.0
$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=atmega328p -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega328p" -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<"
@echo Finished building: $<
# AVR32/GNU Preprocessing Assembler
# AVR32/GNU Assembler
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif
# Add inputs and outputs from these tool invocations to the build variables
# All Target
all: $(OUTPUT_FILE_PATH) $(ADDITIONAL_DEPENDENCIES)
$(OUTPUT_FILE_PATH): $(OBJS) $(USER_OBJS) $(OUTPUT_FILE_DEP)
@echo Building target: $@
@echo Invoking: AVR/GNU Archiver : 5.4.0
$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-ar.exe$(QUOTE) -r -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS)
@echo Finished building target: $@
# Other Targets
clean:
-$(RM) $(OBJS_AS_ARGS) $(EXECUTABLES)
-$(RM) $(C_DEPS_AS_ARGS)
rm -rf "libP2 Interrups.elf" "libP2 Interrups.a" "libP2 Interrups.hex" "libP2 Interrups.lss" "libP2 Interrups.eep" "libP2 Interrups.map" "libP2 Interrups.srec" "libP2 Interrups.usersignatures"

Binary file not shown.

View File

@@ -0,0 +1,49 @@
main.d main.o: .././main.c \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h \
C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include/avr/iom328p.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h:
C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include/avr/iom328p.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h:

Binary file not shown.

View File

@@ -0,0 +1,6 @@
################################################################################
# Automatically-generated file. Do not edit or delete the file
################################################################################
main.c

View File

@@ -12,55 +12,57 @@
#include <util/delay.h>
#include <stdbool.h> // boolean type and values
#define LED00 PINB0
#define LED09 PINB1
#define SWITCH01 PIND2
#define SWITCH02 PIND3
#define LED0 PINB0
#define LED9 PINB1
#define SW1 PIND2
#define SW2 PIND3
volatile int on = LED00;
volatile int activeLED = LED0;
volatile bool blink = true;
void setupPorts() {
DDRB = 0xff; // Data direction register B (B0 & B1) as output
DDRB = 0xff;
PORTB = 0x00;
DDRD = 0x00; // Data direction register D (D0 & D1) as input
PORTD |= (1 << SWITCH01) | (1 << SWITCH02); // setting bit for switch
//cli(); // clear global interrupt flag: interrupts will be immediately disabled
EICRA |= (1 << ISC11) | (1 << ISC01); // the falling edge of INT1 or INT0 generates an interrupt request.
EIMSK = (1 << INT0) | (1 << INT1); // enable external interrupt request
sei(); // set global interrupt enable
DDRD = 0x00;
PORTD |= (1 << SW1) | (1 << SW2); // Activate pull-up resistors
// Falling edge of INT0 and INT1 generates an interrupt request
EICRA |= (1 << ISC11) | (1 << ISC01);
EIMSK |= (1 << INT0) | (1 << INT1); // Enable external interrupt request
sei(); // Set global interrupt enable
}
// SW1 is pressed
ISR(INT0_vect) {
if (on == LED00) { // if D0 is already on, switching from blink to steady light or vice versa
if (activeLED == LED0) { // if D0 is already on, switching from blink to steady light or vice versa
blink = !blink;
} else { // else D9 is on, turn off D9 and turn on D0
PORTB = (1 << LED00);
}
on = LED00;
else { // else D9 is on, turn off D9 and turn on D0
PORTB = (1 << LED0);
}
activeLED = LED0;
}
// SW2 is pressed
ISR(INT1_vect) {
if (on == LED09) {
if (activeLED == LED9) {
blink = !blink;
} else {
PORTB = (1 << LED09);
}
on = LED09;
else {
PORTB = (1 << LED9);
}
activeLED = LED9;
}
int main(void)
{
/* Replace with your application code */
int main(void) {
setupPorts();
while(1){
while (1) {
if (blink) {
PORTB ^= (1 << on);
} else {
PORTB = (1 << on);
PORTB ^= (1 << activeLED); // Toggle active LED
}
_delay_ms(200);
_delay_ms(50);
}
}

View File

@@ -0,0 +1,127 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
SHELL := cmd.exe
RM := rm -rf
USER_OBJS :=
LIBS :=
PROJ :=
O_SRCS :=
C_SRCS :=
S_SRCS :=
S_UPPER_SRCS :=
OBJ_SRCS :=
ASM_SRCS :=
PREPROCESSING_SRCS :=
OBJS :=
OBJS_AS_ARGS :=
C_DEPS :=
C_DEPS_AS_ARGS :=
EXECUTABLES :=
OUTPUT_FILE_PATH :=
OUTPUT_FILE_PATH_AS_ARGS :=
AVR_APP_PATH :=$$$AVR_APP_PATH$$$
QUOTE := "
ADDITIONAL_DEPENDENCIES:=
OUTPUT_FILE_DEP:=
LIB_DEP:=
LINKER_SCRIPT_DEP:=
# Every subdirectory with source files must be described here
SUBDIRS :=
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../main.c
PREPROCESSING_SRCS +=
ASM_SRCS +=
OBJS += \
main.o
OBJS_AS_ARGS += \
main.o
C_DEPS += \
main.d
C_DEPS_AS_ARGS += \
main.d
OUTPUT_FILE_PATH +=P2\ Pooling.elf
OUTPUT_FILE_PATH_AS_ARGS +="P2 Pooling.elf"
ADDITIONAL_DEPENDENCIES:=
OUTPUT_FILE_DEP:= ./makedep.mk
LIB_DEP+=
LINKER_SCRIPT_DEP+=
# AVR32/GNU C Compiler
./main.o: .././main.c
@echo Building file: $<
@echo Invoking: AVR/GNU C Compiler : 5.4.0
$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=atmega328p -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega328p" -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<"
@echo Finished building: $<
# AVR32/GNU Preprocessing Assembler
# AVR32/GNU Assembler
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif
# Add inputs and outputs from these tool invocations to the build variables
# All Target
all: $(OUTPUT_FILE_PATH) $(ADDITIONAL_DEPENDENCIES)
$(OUTPUT_FILE_PATH): $(OBJS) $(USER_OBJS) $(OUTPUT_FILE_DEP) $(LIB_DEP) $(LINKER_SCRIPT_DEP)
@echo Building target: $@
@echo Invoking: AVR/GNU Linker : 5.4.0
$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS) -Wl,-Map="P2 Pooling.map" -Wl,--start-group -Wl,-lm -Wl,--end-group -Wl,--gc-sections -mmcu=atmega328p -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega328p"
@echo Finished building target: $@
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "P2 Pooling.elf" "P2 Pooling.hex"
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex "P2 Pooling.elf" "P2 Pooling.eep" || exit 0
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objdump.exe" -h -S "P2 Pooling.elf" > "P2 Pooling.lss"
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O srec -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "P2 Pooling.elf" "P2 Pooling.srec"
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-size.exe" "P2 Pooling.elf"
# Other Targets
clean:
-$(RM) $(OBJS_AS_ARGS) $(EXECUTABLES)
-$(RM) $(C_DEPS_AS_ARGS)
rm -rf "P2 Pooling.elf" "P2 Pooling.a" "P2 Pooling.hex" "P2 Pooling.lss" "P2 Pooling.eep" "P2 Pooling.map" "P2 Pooling.srec" "P2 Pooling.usersignatures"

View File

@@ -0,0 +1 @@
:00000001FF

Binary file not shown.

View File

@@ -0,0 +1,25 @@
:100000000C9434000C9451000C9451000C94510049
:100010000C9451000C9451000C9451000C9451001C
:100020000C9451000C9451000C9451000C9451000C
:100030000C9451000C9451000C9451000C945100FC
:100040000C9451000C9451000C9451000C945100EC
:100050000C9451000C9451000C9451000C945100DC
:100060000C9451000C94510011241FBECFEFD8E026
:10007000DEBFCDBF11E0A0E0B1E0E8E6F1E002C0F4
:1000800005900D92A230B107D9F721E0A2E0B1E0CE
:1000900001C01D92A430B207E1F70E9487000C94C2
:1000A000B2000C9400008FEF84B915B81AB88BB960
:1000B00008954A9914C08091020190910301892BFF
:1000C00039F49091000181E089278093000102C0FA
:1000D00081E085B9109203011092020108954B99B5
:1000E00015C08091020190910301019739F490911C
:1000F000000181E089278093000102C082E085B978
:1001000081E090E0909303018093020108950E94A2
:10011000530002E011E0C1E0D0E00E94590080915C
:100120000001882361F025B1CE01F801008002C0F2
:10013000880F991F0A94E2F7822785B909C0CE017A
:10014000F801008002C0880F991F0A94E2F785B970
:10015000FFEF24E38CE0F15020408040E1F700C045
:080160000000DBCFF894FFCF93
:02016800010094
:00000001FF

View File

@@ -0,0 +1,248 @@
P2 Pooling.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .data 00000002 00800100 00000168 000001fc 2**0
CONTENTS, ALLOC, LOAD, DATA
1 .text 00000168 00000000 00000000 00000094 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .bss 00000002 00800102 00800102 000001fe 2**0
ALLOC
3 .comment 00000030 00000000 00000000 000001fe 2**0
CONTENTS, READONLY
4 .note.gnu.avr.deviceinfo 00000040 00000000 00000000 00000230 2**2
CONTENTS, READONLY
5 .debug_aranges 00000030 00000000 00000000 00000270 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_info 0000076e 00000000 00000000 000002a0 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_abbrev 0000069d 00000000 00000000 00000a0e 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_line 000002d5 00000000 00000000 000010ab 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_frame 00000044 00000000 00000000 00001380 2**2
CONTENTS, READONLY, DEBUGGING
10 .debug_str 000003fa 00000000 00000000 000013c4 2**0
CONTENTS, READONLY, DEBUGGING
11 .debug_ranges 00000020 00000000 00000000 000017be 2**0
CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:
00000000 <__vectors>:
0: 0c 94 34 00 jmp 0x68 ; 0x68 <__ctors_end>
4: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
8: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
c: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
10: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
14: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
18: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
1c: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
20: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
24: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
28: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
2c: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
30: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
34: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
38: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
3c: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
40: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
44: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
48: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
4c: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
50: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
54: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
58: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
5c: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
60: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
64: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
00000068 <__ctors_end>:
68: 11 24 eor r1, r1
6a: 1f be out 0x3f, r1 ; 63
6c: cf ef ldi r28, 0xFF ; 255
6e: d8 e0 ldi r29, 0x08 ; 8
70: de bf out 0x3e, r29 ; 62
72: cd bf out 0x3d, r28 ; 61
00000074 <__do_copy_data>:
74: 11 e0 ldi r17, 0x01 ; 1
76: a0 e0 ldi r26, 0x00 ; 0
78: b1 e0 ldi r27, 0x01 ; 1
7a: e8 e6 ldi r30, 0x68 ; 104
7c: f1 e0 ldi r31, 0x01 ; 1
7e: 02 c0 rjmp .+4 ; 0x84 <__do_copy_data+0x10>
80: 05 90 lpm r0, Z+
82: 0d 92 st X+, r0
84: a2 30 cpi r26, 0x02 ; 2
86: b1 07 cpc r27, r17
88: d9 f7 brne .-10 ; 0x80 <__do_copy_data+0xc>
0000008a <__do_clear_bss>:
8a: 21 e0 ldi r18, 0x01 ; 1
8c: a2 e0 ldi r26, 0x02 ; 2
8e: b1 e0 ldi r27, 0x01 ; 1
90: 01 c0 rjmp .+2 ; 0x94 <.do_clear_bss_start>
00000092 <.do_clear_bss_loop>:
92: 1d 92 st X+, r1
00000094 <.do_clear_bss_start>:
94: a4 30 cpi r26, 0x04 ; 4
96: b2 07 cpc r27, r18
98: e1 f7 brne .-8 ; 0x92 <.do_clear_bss_loop>
9a: 0e 94 87 00 call 0x10e ; 0x10e <main>
9e: 0c 94 b2 00 jmp 0x164 ; 0x164 <_exit>
000000a2 <__bad_interrupt>:
a2: 0c 94 00 00 jmp 0 ; 0x0 <__vectors>
000000a6 <setupPorts>:
int activeLED = LED0;
bool blinking = true;
void setupPorts() {
DDRB = 0xff; // DDRB as output
a6: 8f ef ldi r24, 0xFF ; 255
a8: 84 b9 out 0x04, r24 ; 4
PORTB = 0x00;
aa: 15 b8 out 0x05, r1 ; 5
DDRD = 0x00; // DDRD as input
ac: 1a b8 out 0x0a, r1 ; 10
PORTD = 0xff;
ae: 8b b9 out 0x0b, r24 ; 11
b0: 08 95 ret
000000b2 <isButtonPressed>:
}
void isButtonPressed() {
if ( !(PIND & (1 << SW1)) ) { // SW1 is pressed
b2: 4a 99 sbic 0x09, 2 ; 9
b4: 14 c0 rjmp .+40 ; 0xde <isButtonPressed+0x2c>
if (activeLED == LED0) { // if D0 is on
b6: 80 91 02 01 lds r24, 0x0102 ; 0x800102 <__data_end>
ba: 90 91 03 01 lds r25, 0x0103 ; 0x800103 <__data_end+0x1>
be: 89 2b or r24, r25
c0: 39 f4 brne .+14 ; 0xd0 <isButtonPressed+0x1e>
blinking = !blinking; // toggle blinking
c2: 90 91 00 01 lds r25, 0x0100 ; 0x800100 <__data_start>
c6: 81 e0 ldi r24, 0x01 ; 1
c8: 89 27 eor r24, r25
ca: 80 93 00 01 sts 0x0100, r24 ; 0x800100 <__data_start>
ce: 02 c0 rjmp .+4 ; 0xd4 <isButtonPressed+0x22>
}
else { // switch LED
PORTB = (1 << LED0);
d0: 81 e0 ldi r24, 0x01 ; 1
d2: 85 b9 out 0x05, r24 ; 5
}
activeLED = LED0;
d4: 10 92 03 01 sts 0x0103, r1 ; 0x800103 <__data_end+0x1>
d8: 10 92 02 01 sts 0x0102, r1 ; 0x800102 <__data_end>
dc: 08 95 ret
}
else if ( !(PIND & (1 << SW2))) { // SW2 is pressed
de: 4b 99 sbic 0x09, 3 ; 9
e0: 15 c0 rjmp .+42 ; 0x10c <isButtonPressed+0x5a>
if (activeLED == LED9) { // if D9 is on
e2: 80 91 02 01 lds r24, 0x0102 ; 0x800102 <__data_end>
e6: 90 91 03 01 lds r25, 0x0103 ; 0x800103 <__data_end+0x1>
ea: 01 97 sbiw r24, 0x01 ; 1
ec: 39 f4 brne .+14 ; 0xfc <isButtonPressed+0x4a>
blinking = !blinking; // toggle blinking
ee: 90 91 00 01 lds r25, 0x0100 ; 0x800100 <__data_start>
f2: 81 e0 ldi r24, 0x01 ; 1
f4: 89 27 eor r24, r25
f6: 80 93 00 01 sts 0x0100, r24 ; 0x800100 <__data_start>
fa: 02 c0 rjmp .+4 ; 0x100 <isButtonPressed+0x4e>
}
else { // switch LED
PORTB = (1 << LED9);
fc: 82 e0 ldi r24, 0x02 ; 2
fe: 85 b9 out 0x05, r24 ; 5
}
activeLED = LED9;
100: 81 e0 ldi r24, 0x01 ; 1
102: 90 e0 ldi r25, 0x00 ; 0
104: 90 93 03 01 sts 0x0103, r25 ; 0x800103 <__data_end+0x1>
108: 80 93 02 01 sts 0x0102, r24 ; 0x800102 <__data_end>
10c: 08 95 ret
0000010e <main>:
}
}
int main(void) {
setupPorts();
10e: 0e 94 53 00 call 0xa6 ; 0xa6 <setupPorts>
isButtonPressed();
if (blinking) {
PORTB ^= (1 << activeLED);
}
else {
PORTB = (1 << activeLED);
112: 02 e0 ldi r16, 0x02 ; 2
114: 11 e0 ldi r17, 0x01 ; 1
116: c1 e0 ldi r28, 0x01 ; 1
118: d0 e0 ldi r29, 0x00 ; 0
}
}
int main(void) {
setupPorts();
while (1) {
isButtonPressed();
11a: 0e 94 59 00 call 0xb2 ; 0xb2 <isButtonPressed>
if (blinking) {
11e: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <__data_start>
122: 88 23 and r24, r24
124: 61 f0 breq .+24 ; 0x13e <main+0x30>
PORTB ^= (1 << activeLED);
126: 25 b1 in r18, 0x05 ; 5
128: ce 01 movw r24, r28
12a: f8 01 movw r30, r16
12c: 00 80 ld r0, Z
12e: 02 c0 rjmp .+4 ; 0x134 <main+0x26>
130: 88 0f add r24, r24
132: 99 1f adc r25, r25
134: 0a 94 dec r0
136: e2 f7 brpl .-8 ; 0x130 <main+0x22>
138: 82 27 eor r24, r18
13a: 85 b9 out 0x05, r24 ; 5
13c: 09 c0 rjmp .+18 ; 0x150 <main+0x42>
}
else {
PORTB = (1 << activeLED);
13e: ce 01 movw r24, r28
140: f8 01 movw r30, r16
142: 00 80 ld r0, Z
144: 02 c0 rjmp .+4 ; 0x14a <main+0x3c>
146: 88 0f add r24, r24
148: 99 1f adc r25, r25
14a: 0a 94 dec r0
14c: e2 f7 brpl .-8 ; 0x146 <main+0x38>
14e: 85 b9 out 0x05, r24 ; 5
#else
//round up by default
__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
#endif
__builtin_avr_delay_cycles(__ticks_dc);
150: ff ef ldi r31, 0xFF ; 255
152: 24 e3 ldi r18, 0x34 ; 52
154: 8c e0 ldi r24, 0x0C ; 12
156: f1 50 subi r31, 0x01 ; 1
158: 20 40 sbci r18, 0x00 ; 0
15a: 80 40 sbci r24, 0x00 ; 0
15c: e1 f7 brne .-8 ; 0x156 <main+0x48>
15e: 00 c0 rjmp .+0 ; 0x160 <main+0x52>
160: 00 00 nop
162: db cf rjmp .-74 ; 0x11a <main+0xc>
00000164 <_exit>:
164: f8 94 cli
00000166 <__stop_program>:
166: ff cf rjmp .-2 ; 0x166 <__stop_program>

View File

@@ -0,0 +1,470 @@
Archive member included to satisfy reference by file (symbol)
c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o (exit)
c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_copy_data.o)
main.o (__do_copy_data)
c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_clear_bss.o)
main.o (__do_clear_bss)
Discarded input sections
.data 0x00000000 0x0 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
.bss 0x00000000 0x0 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
.text 0x00000000 0x0 main.o
.data 0x00000000 0x0 main.o
.bss 0x00000000 0x0 main.o
.text 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
.data 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
.bss 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
.text.libgcc.mul
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
.text.libgcc.div
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
.text.libgcc 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
.text.libgcc.prologue
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
.text.libgcc.builtins
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
.text.libgcc.fmul
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
.text.libgcc.fixed
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
.text 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_copy_data.o)
.data 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_copy_data.o)
.bss 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_copy_data.o)
.text.libgcc.mul
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_copy_data.o)
.text.libgcc.div
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_copy_data.o)
.text.libgcc 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_copy_data.o)
.text.libgcc.prologue
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_copy_data.o)
.text.libgcc.builtins
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_copy_data.o)
.text.libgcc.fmul
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_copy_data.o)
.text.libgcc.fixed
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_copy_data.o)
.text 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_clear_bss.o)
.data 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_clear_bss.o)
.bss 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_clear_bss.o)
.text.libgcc.mul
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_clear_bss.o)
.text.libgcc.div
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_clear_bss.o)
.text.libgcc 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_clear_bss.o)
.text.libgcc.prologue
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_clear_bss.o)
.text.libgcc.builtins
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_clear_bss.o)
.text.libgcc.fmul
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_clear_bss.o)
.text.libgcc.fixed
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_clear_bss.o)
Memory Configuration
Name Origin Length Attributes
text 0x00000000 0x00020000 xr
data 0x00800060 0x0000ffa0 rw !x
eeprom 0x00810000 0x00010000 rw !x
fuse 0x00820000 0x00000003 rw !x
lock 0x00830000 0x00000400 rw !x
signature 0x00840000 0x00000400 rw !x
user_signatures 0x00850000 0x00000400 rw !x
*default* 0x00000000 0xffffffff
Linker script and memory map
Address of section .data set to 0x800100
LOAD C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
LOAD main.o
START GROUP
LOAD c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avr5\libm.a
END GROUP
START GROUP
LOAD c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a
LOAD c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avr5\libm.a
LOAD c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avr5\libc.a
LOAD C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5\libatmega328p.a
END GROUP
0x00020000 __TEXT_REGION_LENGTH__ = DEFINED (__TEXT_REGION_LENGTH__)?__TEXT_REGION_LENGTH__:0x20000
0x0000ffa0 __DATA_REGION_LENGTH__ = DEFINED (__DATA_REGION_LENGTH__)?__DATA_REGION_LENGTH__:0xffa0
0x00010000 __EEPROM_REGION_LENGTH__ = DEFINED (__EEPROM_REGION_LENGTH__)?__EEPROM_REGION_LENGTH__:0x10000
[0x00000003] __FUSE_REGION_LENGTH__ = DEFINED (__FUSE_REGION_LENGTH__)?__FUSE_REGION_LENGTH__:0x400
0x00000400 __LOCK_REGION_LENGTH__ = DEFINED (__LOCK_REGION_LENGTH__)?__LOCK_REGION_LENGTH__:0x400
0x00000400 __SIGNATURE_REGION_LENGTH__ = DEFINED (__SIGNATURE_REGION_LENGTH__)?__SIGNATURE_REGION_LENGTH__:0x400
0x00000400 __USER_SIGNATURE_REGION_LENGTH__ = DEFINED (__USER_SIGNATURE_REGION_LENGTH__)?__USER_SIGNATURE_REGION_LENGTH__:0x400
.hash
*(.hash)
.dynsym
*(.dynsym)
.dynstr
*(.dynstr)
.gnu.version
*(.gnu.version)
.gnu.version_d
*(.gnu.version_d)
.gnu.version_r
*(.gnu.version_r)
.rel.init
*(.rel.init)
.rela.init
*(.rela.init)
.rel.text
*(.rel.text)
*(.rel.text.*)
*(.rel.gnu.linkonce.t*)
.rela.text
*(.rela.text)
*(.rela.text.*)
*(.rela.gnu.linkonce.t*)
.rel.fini
*(.rel.fini)
.rela.fini
*(.rela.fini)
.rel.rodata
*(.rel.rodata)
*(.rel.rodata.*)
*(.rel.gnu.linkonce.r*)
.rela.rodata
*(.rela.rodata)
*(.rela.rodata.*)
*(.rela.gnu.linkonce.r*)
.rel.data
*(.rel.data)
*(.rel.data.*)
*(.rel.gnu.linkonce.d*)
.rela.data
*(.rela.data)
*(.rela.data.*)
*(.rela.gnu.linkonce.d*)
.rel.ctors
*(.rel.ctors)
.rela.ctors
*(.rela.ctors)
.rel.dtors
*(.rel.dtors)
.rela.dtors
*(.rela.dtors)
.rel.got
*(.rel.got)
.rela.got
*(.rela.got)
.rel.bss
*(.rel.bss)
.rela.bss
*(.rela.bss)
.rel.plt
*(.rel.plt)
.rela.plt
*(.rela.plt)
.text 0x00000000 0x168
*(.vectors)
.vectors 0x00000000 0x68 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
0x00000000 __vector_default
0x00000000 __vectors
*(.vectors)
*(.progmem.gcc*)
0x00000068 . = ALIGN (0x2)
0x00000068 __trampolines_start = .
*(.trampolines)
.trampolines 0x00000068 0x0 linker stubs
*(.trampolines*)
0x00000068 __trampolines_end = .
*libprintf_flt.a:*(.progmem.data)
*libc.a:*(.progmem.data)
*(.progmem*)
0x00000068 . = ALIGN (0x2)
*(.jumptables)
*(.jumptables*)
*(.lowtext)
*(.lowtext*)
0x00000068 __ctors_start = .
*(.ctors)
0x00000068 __ctors_end = .
0x00000068 __dtors_start = .
*(.dtors)
0x00000068 __dtors_end = .
SORT(*)(.ctors)
SORT(*)(.dtors)
*(.init0)
.init0 0x00000068 0x0 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
0x00000068 __init
*(.init0)
*(.init1)
*(.init1)
*(.init2)
.init2 0x00000068 0xc C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
*(.init2)
*(.init3)
*(.init3)
*(.init4)
.init4 0x00000074 0x16 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_copy_data.o)
0x00000074 __do_copy_data
.init4 0x0000008a 0x10 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_clear_bss.o)
0x0000008a __do_clear_bss
*(.init4)
*(.init5)
*(.init5)
*(.init6)
*(.init6)
*(.init7)
*(.init7)
*(.init8)
*(.init8)
*(.init9)
.init9 0x0000009a 0x8 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
*(.init9)
*(.text)
.text 0x000000a2 0x4 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
0x000000a2 __vector_22
0x000000a2 __vector_1
0x000000a2 __vector_24
0x000000a2 __vector_12
0x000000a2 __bad_interrupt
0x000000a2 __vector_6
0x000000a2 __vector_3
0x000000a2 __vector_23
0x000000a2 __vector_25
0x000000a2 __vector_11
0x000000a2 __vector_13
0x000000a2 __vector_17
0x000000a2 __vector_19
0x000000a2 __vector_7
0x000000a2 __vector_5
0x000000a2 __vector_4
0x000000a2 __vector_9
0x000000a2 __vector_2
0x000000a2 __vector_21
0x000000a2 __vector_15
0x000000a2 __vector_8
0x000000a2 __vector_14
0x000000a2 __vector_10
0x000000a2 __vector_16
0x000000a2 __vector_18
0x000000a2 __vector_20
0x000000a6 . = ALIGN (0x2)
*(.text.*)
.text.setupPorts
0x000000a6 0xc main.o
0x000000a6 setupPorts
.text.isButtonPressed
0x000000b2 0x5c main.o
0x000000b2 isButtonPressed
.text.main 0x0000010e 0x56 main.o
0x0000010e main
0x00000164 . = ALIGN (0x2)
*(.fini9)
.fini9 0x00000164 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
0x00000164 _exit
0x00000164 exit
*(.fini9)
*(.fini8)
*(.fini8)
*(.fini7)
*(.fini7)
*(.fini6)
*(.fini6)
*(.fini5)
*(.fini5)
*(.fini4)
*(.fini4)
*(.fini3)
*(.fini3)
*(.fini2)
*(.fini2)
*(.fini1)
*(.fini1)
*(.fini0)
.fini0 0x00000164 0x4 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
*(.fini0)
0x00000168 _etext = .
.data 0x00800100 0x2 load address 0x00000168
0x00800100 PROVIDE (__data_start, .)
*(.data)
*(.data*)
.data.blinking
0x00800100 0x1 main.o
0x00800100 blinking
*(.gnu.linkonce.d*)
*(.rodata)
*(.rodata*)
*(.gnu.linkonce.r*)
0x00800102 . = ALIGN (0x2)
*fill* 0x00800101 0x1
0x00800102 _edata = .
0x00800102 PROVIDE (__data_end, .)
.bss 0x00800102 0x2
0x00800102 PROVIDE (__bss_start, .)
*(.bss)
*(.bss*)
.bss.activeLED
0x00800102 0x2 main.o
0x00800102 activeLED
*(COMMON)
0x00800104 PROVIDE (__bss_end, .)
0x00000168 __data_load_start = LOADADDR (.data)
0x0000016a __data_load_end = (__data_load_start + SIZEOF (.data))
.noinit 0x00800104 0x0
[!provide] PROVIDE (__noinit_start, .)
*(.noinit*)
[!provide] PROVIDE (__noinit_end, .)
0x00800104 _end = .
[!provide] PROVIDE (__heap_start, .)
.eeprom 0x00810000 0x0
*(.eeprom*)
0x00810000 __eeprom_end = .
.fuse
*(.fuse)
*(.lfuse)
*(.hfuse)
*(.efuse)
.lock
*(.lock*)
.signature
*(.signature*)
.user_signatures
*(.user_signatures*)
.stab
*(.stab)
.stabstr
*(.stabstr)
.stab.excl
*(.stab.excl)
.stab.exclstr
*(.stab.exclstr)
.stab.index
*(.stab.index)
.stab.indexstr
*(.stab.indexstr)
.comment 0x00000000 0x30
*(.comment)
.comment 0x00000000 0x30 main.o
0x31 (size before relaxing)
.note.gnu.avr.deviceinfo
0x00000000 0x40
.note.gnu.avr.deviceinfo
0x00000000 0x40 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
.note.gnu.build-id
*(.note.gnu.build-id)
.debug
*(.debug)
.line
*(.line)
.debug_srcinfo
*(.debug_srcinfo)
.debug_sfnames
*(.debug_sfnames)
.debug_aranges 0x00000000 0x30
*(.debug_aranges)
.debug_aranges
0x00000000 0x30 main.o
.debug_pubnames
*(.debug_pubnames)
.debug_info 0x00000000 0x76e
*(.debug_info .gnu.linkonce.wi.*)
.debug_info 0x00000000 0x5f4 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
.debug_info 0x000005f4 0x17a main.o
.debug_abbrev 0x00000000 0x69d
*(.debug_abbrev)
.debug_abbrev 0x00000000 0x5a2 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
.debug_abbrev 0x000005a2 0xfb main.o
.debug_line 0x00000000 0x2d5
*(.debug_line .debug_line.* .debug_line_end)
.debug_line 0x00000000 0x133 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
.debug_line 0x00000133 0x1a2 main.o
.debug_frame 0x00000000 0x44
*(.debug_frame)
.debug_frame 0x00000000 0x44 main.o
.debug_str 0x00000000 0x3fa
*(.debug_str)
.debug_str 0x00000000 0x208 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
.debug_str 0x00000208 0x1f2 main.o
0x226 (size before relaxing)
.debug_loc
*(.debug_loc)
.debug_macinfo
*(.debug_macinfo)
.debug_weaknames
*(.debug_weaknames)
.debug_funcnames
*(.debug_funcnames)
.debug_typenames
*(.debug_typenames)
.debug_varnames
*(.debug_varnames)
.debug_pubtypes
*(.debug_pubtypes)
.debug_ranges 0x00000000 0x20
*(.debug_ranges)
.debug_ranges 0x00000000 0x20 main.o
.debug_macro
*(.debug_macro)
OUTPUT(P2 Pooling.elf elf32-avr)
LOAD linker stubs

View File

@@ -0,0 +1,26 @@
S0120000503220506F6F6C696E672E7372656398
S11300000C9434000C9451000C9451000C94510045
S11300100C9451000C9451000C9451000C94510018
S11300200C9451000C9451000C9451000C94510008
S11300300C9451000C9451000C9451000C945100F8
S11300400C9451000C9451000C9451000C945100E8
S11300500C9451000C9451000C9451000C945100D8
S11300600C9451000C94510011241FBECFEFD8E022
S1130070DEBFCDBF11E0A0E0B1E0E8E6F1E002C0F0
S113008005900D92A230B107D9F721E0A2E0B1E0CA
S113009001C01D92A430B207E1F70E9487000C94BE
S11300A0B2000C9400008FEF84B915B81AB88BB95C
S11300B008954A9914C08091020190910301892BFB
S11300C039F49091000181E089278093000102C0F6
S11300D081E085B9109203011092020108954B99B1
S11300E015C08091020190910301019739F4909118
S11300F0000181E089278093000102C082E085B974
S113010081E090E0909303018093020108950E949E
S1130110530002E011E0C1E0D0E00E945900809158
S11301200001882361F025B1CE01F801008002C0EE
S1130130880F991F0A94E2F7822785B909C0CE0176
S1130140F801008002C0880F991F0A94E2F785B96C
S1130150FFEF24E38CE0F15020408040E1F700C041
S10B01600000DBCFF894FFCF8F
S1050168010090
S9030000FC

View File

@@ -0,0 +1,46 @@
main.d main.o: .././main.c \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h \
C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include/avr/iom328p.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h:
C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include/avr/iom328p.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h:

Binary file not shown.

View File

@@ -0,0 +1,6 @@
################################################################################
# Automatically-generated file. Do not edit or delete the file
################################################################################
main.c

View File

@@ -20,91 +20,104 @@
<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>
<ResetRule>0</ResetRule>
<eraseonlaunchrule>0</eraseonlaunchrule>
<EraseKey />
<avrtool>com.atmel.avrdbg.tool.simulator</avrtool>
<avrtoolserialnumber />
<avrdeviceexpectedsignature>0x1E950F</avrdeviceexpectedsignature>
<com_atmel_avrdbg_tool_simulator>
<ToolOptions xmlns="">
<InterfaceProperties>
</InterfaceProperties>
</ToolOptions>
<ToolType xmlns="">com.atmel.avrdbg.tool.simulator</ToolType>
<ToolNumber xmlns="">
</ToolNumber>
<ToolName xmlns="">Simulator</ToolName>
</com_atmel_avrdbg_tool_simulator>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=atmega328p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega328p"</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>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcc.compiler.symbols.DefSymbols>
<ListValues>
<Value>NDEBUG</Value>
</ListValues>
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<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>
<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>libm</Value>
</ListValues>
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
</AvrGcc>
<avrgcc.common.Device>-mmcu=atmega328p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega328p"</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>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcc.compiler.symbols.DefSymbols>
<ListValues>
<Value>NDEBUG</Value>
</ListValues>
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<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>
<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>libm</Value>
</ListValues>
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
</AvrGcc>
</ToolchainSettings>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=atmega328p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega328p"</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>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcc.compiler.symbols.DefSymbols>
<ListValues>
<Value>DEBUG</Value>
</ListValues>
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<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>
<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>libm</Value>
</ListValues>
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<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>
</AvrGcc>
<avrgcc.common.Device>-mmcu=atmega328p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega328p"</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>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcc.compiler.symbols.DefSymbols>
<ListValues>
<Value>DEBUG</Value>
</ListValues>
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<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>
<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>libm</Value>
</ListValues>
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<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>
</AvrGcc>
</ToolchainSettings>
</PropertyGroup>
<ItemGroup>

View File

@@ -8,68 +8,55 @@
#include <avr/io.h>
#define F_CPU 16000000UL
#include <util/delay.h>
#include <stdbool.h> // boolean type and values
#include <stdbool.h>
#define LED00 PIND0
#define LED09 PIND1
#define LED0 PINB0
#define LED9 PINB1
#define SW1 PIND2
#define SW2 PIND3
#define SWITCH01 PINB0
#define SWITCH02 PINB1
int on = LED00;
int off = LED09;
bool blink = true;
int activeLED = LED0;
bool blinking = true;
void setupPorts() {
DDRD = 0xff; // Data direction register D (D0 & D1) as output
PORTD = 0x00;
DDRB = 0xff; // DDRB as output
PORTB = 0x00;
DDRB = 0x00; // Data direction register B (B0 & B1) as input
PORTB = 0xff;
DDRD = 0x00; // DDRD as input
PORTD = 0xff;
}
void pressButton() {
if ( !(PINB & (1 << SWITCH01)) ) {
_delay_ms(5);
if ( !(PINB & (1 << SWITCH01)) ) { // SW1 is pressed
if (PIND & (1 << LED00)) { // if D0 is on
blink ^= (1 << 0); // toggle D0 from blinking to steady light or vice versa
} else if (PIND & (1 << LED09)) { // if D9 is on then switch to D0
off = LED09;
on = LED00;
}
void isButtonPressed() {
if ( !(PIND & (1 << SW1)) ) { // SW1 is pressed
if (activeLED == LED0) { // if D0 is on
blinking = !blinking; // toggle blinking
}
else { // switch LED
PORTB = (1 << LED0);
}
activeLED = LED0;
}
if ( !(PINB & (1 << SWITCH02)) ) {
_delay_ms(5);
if ( !(PINB & (1 << SWITCH02))) { // SW2 is pressed
if (PIND & (1 << LED09)) { // if D9 is on
blink ^= (1 << 0); // toggle D9 from blinking to steady light or vice versa
} else if ( (PIND & (1 << LED00))) { // if D0 is on then switch to D9
off = LED00;
on = LED09;
}
}
else if ( !(PIND & (1 << SW2))) { // SW2 is pressed
if (activeLED == LED9) { // if D9 is on
blinking = !blinking; // toggle blinking
}
else { // switch LED
PORTB = (1 << LED9);
}
activeLED = LED9;
}
}
int main(void)
{
/* Replace with your application code */
int main(void) {
setupPorts();
while (1)
{
pressButton();
if (blink) {
PORTD &= ~(1UL << off);
PORTD ^= (1 << on);
while (1) {
isButtonPressed();
if (blinking) {
PORTB ^= (1 << activeLED);
}
else {
PORTD &= ~(1UL << off);
PORTD |= ( 1 << on);
PORTB = (1 << activeLED);
}
_delay_ms(200);
_delay_ms(250);
}
}

BIN
P3/P3/.vs/P3/v14/.atsuo Normal file

Binary file not shown.

22
P3/P3/P3.atsln Normal file
View File

@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Atmel Studio Solution File, Format Version 11.00
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "P3", "P3\P3.cproj", "{DCE6C7E3-EE26-4D79-826B-08594B9AD897}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|AVR = Debug|AVR
Release|AVR = Release|AVR
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.ActiveCfg = Debug|AVR
{DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.Build.0 = Debug|AVR
{DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.ActiveCfg = Release|AVR
{DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.Build.0 = Release|AVR
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<Store xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="AtmelPackComponentManagement">
<ProjectComponents>
<ProjectComponent z:Id="i1" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/">
<CApiVersion></CApiVersion>
<CBundle></CBundle>
<CClass>Device</CClass>
<CGroup>Startup</CGroup>
<CSub></CSub>
<CVariant></CVariant>
<CVendor>Atmel</CVendor>
<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>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>
<FileContentHash i:nil="true" />
<FileVersion></FileVersion>
<Name>include</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\include\avr\iom328p.h</AbsolutePath>
<Attribute></Attribute>
<Category>header</Category>
<Condition>C</Condition>
<FileContentHash>UMk4QUzkkuShabuoYtNl/Q==</FileContentHash>
<FileVersion></FileVersion>
<Name>include/avr/iom328p.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>
<Attribute>template</Attribute>
<Category>source</Category>
<Condition>C Exe</Condition>
<FileContentHash>jes6jxEW2xSYlDpXzC4wHg==</FileContentHash>
<FileVersion></FileVersion>
<Name>templates/main.c</Name>
<SelectString>Main file (.c)</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.cpp</AbsolutePath>
<Attribute>template</Attribute>
<Category>source</Category>
<Condition>C Exe</Condition>
<FileContentHash>YXFphlh0CtZJU+ebktABgQ==</FileContentHash>
<FileVersion></FileVersion>
<Name>templates/main.cpp</Name>
<SelectString>Main file (.cpp)</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\gcc\dev\atmega328p</AbsolutePath>
<Attribute></Attribute>
<Category>libraryPrefix</Category>
<Condition>GCC</Condition>
<FileContentHash i:nil="true" />
<FileVersion></FileVersion>
<Name>gcc/dev/atmega328p</Name>
<SelectString></SelectString>
<SourcePath></SourcePath>
</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>
<PresentInProject>true</PresentInProject>
<ReferenceConditionId>ATmega328P</ReferenceConditionId>
<RteComponents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:string></d4p1:string>
</RteComponents>
<Status>Resolved</Status>
<VersionMode>Fixed</VersionMode>
<IsComponentInAtProject>true</IsComponentInAtProject>
</ProjectComponent>
</ProjectComponents>
</Store>

116
P3/P3/P3/P3.cproj Normal file
View File

@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<ProjectVersion>7.0</ProjectVersion>
<ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName>
<ProjectGuid>dce6c7e3-ee26-4d79-826b-08594b9ad897</ProjectGuid>
<avrdevice>ATmega328P</avrdevice>
<avrdeviceseries>none</avrdeviceseries>
<OutputType>Executable</OutputType>
<Language>C</Language>
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
<OutputFileExtension>.elf</OutputFileExtension>
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
<AssemblyName>P3</AssemblyName>
<Name>P3</Name>
<RootNamespace>P3</RootNamespace>
<ToolchainFlavour>Native</ToolchainFlavour>
<KeepTimersRunning>true</KeepTimersRunning>
<OverrideVtor>false</OverrideVtor>
<CacheFlash>true</CacheFlash>
<ProgFlashFromRam>true</ProgFlashFromRam>
<RamSnippetAddress />
<UncachedRange />
<preserveEEPROM>true</preserveEEPROM>
<OverrideVtorValue />
<BootSegment>2</BootSegment>
<ResetRule>0</ResetRule>
<eraseonlaunchrule>0</eraseonlaunchrule>
<EraseKey />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=atmega328p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega328p"</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>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcc.compiler.symbols.DefSymbols>
<ListValues>
<Value>NDEBUG</Value>
</ListValues>
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<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>
<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>libm</Value>
</ListValues>
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
</AvrGcc>
</ToolchainSettings>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=atmega328p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega328p"</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>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcc.compiler.symbols.DefSymbols>
<ListValues>
<Value>DEBUG</Value>
</ListValues>
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<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>
<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>libm</Value>
</ListValues>
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<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>
</AvrGcc>
</ToolchainSettings>
</PropertyGroup>
<ItemGroup>
<Compile Include="main.c">
<SubType>compile</SubType>
</Compile>
</ItemGroup>
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
</Project>

53
P3/P3/P3/main.c Normal file
View File

@@ -0,0 +1,53 @@
/*
* P3.c
*
* Created: 22.11.2023 18:20:05
* Author : Safak
*/
#define F_CPU 16000000UL
#include <avr/interrupt.h>
#define LED PIND0
volatile uint32_t systemClk = 0;
void setUp_Timer0() {
TCCR0A = (1 << WGM01); // enable CTC mode of Timer/Counter 0 Control Register A
TCCR0B |= (1 << CS01) | (1 << CS00); // set Prescaler 64
OCR0A = 249; // set up Output Comparison Register A for Timer0 to generate an interrupt when timer counter and OCR0A are equals
// F_TimerInterrupt = F_clk / ( (prescaler) x (OCR + 1) )
// => OCR = F_clk / (F_TimerInterrupt x prescaler) - 1 = ( 16MHz/(1000Hz x 64) ) - 1 = 249
TIMSK0 = (1 << OCIE0A); // enable interrupt
}
ISR(TIMER0_COMPA_vect) {
systemClk++;
}
void waitFor(uint32_t ms) {
uint32_t currentTime = systemClk + ms;
while (systemClk < currentTime) {}
}
void waitUntil(uint32_t ms) {
while (systemClk <= ms) {}
}
int main(void) {
/* Replace with your application code */
DDRD = 0xff; // Data direction register D (D0) as output
PORTD = 0x00;
setUp_Timer0();
sei(); // set global interrupt enable
waitUntil(5000); // wait until 5s from the beginning then turn on LED
PORTD |= (1 << LED); // setting bit for LED
while (1) {
waitFor(200); // wait for 0.2s then toggle LED
PORTD ^= (1 << LED); // toggling LED
}
}