diff --git a/Abgaben/P1/Hazinedar_3108590_ARBKVS_1.asm b/Abgaben/P1/Hazinedar_3108590_ARBKVS_1.asm
new file mode 100644
index 0000000..2138c71
--- /dev/null
+++ b/Abgaben/P1/Hazinedar_3108590_ARBKVS_1.asm
@@ -0,0 +1,71 @@
+;
+; P1.asm
+;
+; Created: 12.10.2023 22:54:52
+; Author : Safak Hazinedar
+;
+
+.include "m328pdef.inc"
+
+.org 0x00
+rjmp init
+
+init:
+ ldi r16, LOW(RAMEND) ; Stack einrichten für Befehle
+ out SPL, r16
+ ldi r16, HIGH(RAMEND)
+ out SPH, r16
+
+ ldi r17, 0xFF
+ out DDRD, r17 ; Data direction register D (D0-D7) as output
+
+ ldi r18, 0x03
+ out DDRB, r18 ; Data direction register B (B0-B1) as output
+
+ ldi r17, 0x01 ; initialize D0
+
+portD_left:
+ out PORTD, r17
+ rcall delay
+ lsl r17 ; shift left until PortD is 0x00
+ cpi r17, 0x00 ;
+ brne portD_left
+ out PORTD, r17 ; D0-D7 = 0
+ ldi r18, 0x01 ; switch to PortB
+
+portB_left:
+ out PORTB, r18 ; D8 = 1
+ rcall delay
+ lsl r18
+ cpi r18, 0x02 ; length of PortB is variable
+ brne portB_left
+ ; D9 = 1 => last LED turned on
+portB_right:
+ out PORTB, r18
+ rcall delay
+ lsr r18 ; turn direction
+ cpi r18, 0x00 ; shift right until PortB is 0x00
+ brne portB_right
+ out PORTB, r18 ; turn of PortB or rather D8 & D9
+ ldi r17, 0x80
+
+portD_right:
+ out PORTD, r17 ; turn on D7
+ rcall delay
+ lsr r17
+ cpi r17, 0x01 ; shift right until D0 is reached
+ brne portD_right
+ jmp portD_left ; turn direction
+
+delay:
+ ldi r19, 17
+ ldi r20, 60
+ ldi r21, 204
+
+L1: dec r21
+ brne L1
+ dec r20
+ brne L1
+ dec r19
+ brne L1
+ ret
\ No newline at end of file
diff --git a/P1/.vs/P1/v14/.atsuo b/P1/.vs/P1/v14/.atsuo
index 6da5003..7f87cb9 100644
Binary files a/P1/.vs/P1/v14/.atsuo and b/P1/.vs/P1/v14/.atsuo differ
diff --git a/P1/.vscode/c_cpp_properties.json b/P1/.vscode/c_cpp_properties.json
new file mode 100644
index 0000000..ec932fb
--- /dev/null
+++ b/P1/.vscode/c_cpp_properties.json
@@ -0,0 +1,18 @@
+{
+ "configurations": [
+ {
+ "name": "windows-msvc-x64",
+ "includePath": [
+ "${workspaceFolder}/**"
+ ],
+ "compilerPath": "cl.exe",
+ "cStandard": "c11",
+ "cppStandard": "c++14",
+ "intelliSenseMode": "windows-msvc-x64",
+ "compilerArgs": [
+ ""
+ ]
+ }
+ ],
+ "version": 4
+}
\ No newline at end of file
diff --git a/P1/.vscode/launch.json b/P1/.vscode/launch.json
new file mode 100644
index 0000000..664753d
--- /dev/null
+++ b/P1/.vscode/launch.json
@@ -0,0 +1,15 @@
+{
+ "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"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/P1/.vscode/settings.json b/P1/.vscode/settings.json
new file mode 100644
index 0000000..0009f6d
--- /dev/null
+++ b/P1/.vscode/settings.json
@@ -0,0 +1,59 @@
+{
+ "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
+}
\ No newline at end of file
diff --git a/P1/P1/Debug/P1.lss b/P1/P1/Debug/P1.lss
index 4ad689d..a4ba57e 100644
--- a/P1/P1/Debug/P1.lss
+++ b/P1/P1/Debug/P1.lss
@@ -1,5 +1,5 @@
-AVRASM ver. 2.2.7 C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm Mon Oct 30 23:15:13 2023
+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
[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'
@@ -990,7 +990,7 @@ C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Pr
; P1.asm
;
; Created: 12.10.2023 22:54:52
- ; Author : Safak
+ ; Author : Safak Hazinedar
;
.include "m328pdef.inc"
@@ -1042,57 +1042,63 @@ C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Pr
000000 c000 rjmp init
init:
-000001 ef1f ldi r17, 0xFF
-000002 b91a out DDRD, r17 ; Data direction register D (D0-D7) as output
-000003 e011 ldi r17, 0x01 ; initialize D0
+000001 ef0f ldi r16, LOW(RAMEND) ; Stack einrichten für Befehle
+000002 bf0d out SPL, r16
+000003 e008 ldi r16, HIGH(RAMEND)
+000004 bf0e out SPH, r16
-000004 e023 ldi r18, 0x03
-000005 b924 out DDRB, r18 ; Data direction register B (B0-B1) as output
+000005 ef1f ldi r17, 0xFF
+000006 b91a out DDRD, r17 ; Data direction register D (D0-D7) as output
+
+000007 e023 ldi r18, 0x03
+000008 b924 out DDRB, r18 ; Data direction register B (B0-B1) as output
+
+000009 e011 ldi r17, 0x01 ; initialize D0
portD_left:
-000006 b91b out PORTD, r17
-000007 d018 rcall delay
-000008 0f11 lsl r17 ; shift left until PortB is 0x00
-000009 3010 cpi r17, 0x00 ; if(r17!=0x00) links_PD
-00000a f7d9 brne portD_left
-00000b b91b out PORTD, r17 ; D0-D7 = 0
-00000c e021 ldi r18, 0x01 ; switch to PortB
+00000a b91b out PORTD, r17
+00000b d018 rcall delay
+00000c 0f11 lsl r17 ; shift left until PortD is 0x00
+00000d 3010 cpi r17, 0x00 ;
+00000e f7d9 brne portD_left
+00000f b91b out PORTD, r17 ; D0-D7 = 0
+000010 e021 ldi r18, 0x01 ; switch to PortB
portB_left:
-00000d b925 out PORTB, r18 ; D8 = 1
-00000e d011 rcall delay
-00000f 0f22 lsl r18
-000010 3022 cpi r18, 0x02 ; length of PortB is variable
-000011 f7d9 brne portB_left
+000011 b925 out PORTB, r18 ; D8 = 1
+000012 d011 rcall delay
+000013 0f22 lsl r18
+000014 3022 cpi r18, 0x02 ; length of PortB is variable
+000015 f7d9 brne portB_left
; D9 = 1 => last LED turned on
portB_right:
-000012 b925 out PORTB, r18
-000013 d00c rcall delay
-000014 9526 lsr r18 ; turn direction
-000015 3020 cpi r18, 0x00 ; shift right until PortB is 0x00
-000016 f7d9 brne portB_right
-000017 b925 out PORTB, r18 ; turn of PortB or rather D8 & D9
-000018 e810 ldi r17, 0x80
+000016 b925 out PORTB, r18
+000017 d00c rcall delay
+000018 9526 lsr r18 ; turn direction
+000019 3020 cpi r18, 0x00 ; shift right until PortB is 0x00
+00001a f7d9 brne portB_right
+00001b b925 out PORTB, r18 ; turn of PortB or rather D8 & D9
+00001c e810 ldi r17, 0x80
portD_right:
-000019 b91b out PORTD, r17 ; turn on D7
-00001a d005 rcall delay
-00001b 9516 lsr r17
-00001c 3011 cpi r17, 0x01 ; shift right until D0 is reached
-00001d f7d9 brne portD_right
-00001e 940c 0006 jmp portD_left ; turn direction
+00001d b91b out PORTD, r17 ; turn on D7
+00001e d005 rcall delay
+00001f 9516 lsr r17
+000020 3011 cpi r17, 0x01 ; shift right until D0 is reached
+000021 f7d9 brne portD_right
+000022 940c 000a jmp portD_left ; turn direction
delay:
-000020 e131 ldi r19, 17
-000021 e34c ldi r20, 60
-000022 ec5c ldi r21, 204
+000024 e131 ldi r19, 17
+000025 e34c ldi r20, 60
+000026 ec5c ldi r21, 204
-000023 955a L1: dec r21
-000024 f7f1 brne L1
-000025 954a dec r20
-000026 f7e1 brne L1
-000027 953a dec r19
-000028 f7d1 brne L1
+000027 955a L1: dec r21
+000028 f7f1 brne L1
+000029 954a dec r20
+00002a f7e1 brne L1
+00002b 953a dec r19
+00002c f7d1 brne L1
RESOURCE USE INFORMATION
@@ -1112,10 +1118,10 @@ counted separately from r26..r31 here.
"ATmega328P" register use summary:
x : 0 y : 0 z : 0 r0 : 0 r1 : 0 r2 : 0 r3 : 0 r4 : 0
r5 : 0 r6 : 0 r7 : 0 r8 : 0 r9 : 0 r10: 0 r11: 0 r12: 0
-r13: 0 r14: 0 r15: 0 r16: 0 r17: 11 r18: 10 r19: 2 r20: 2
+r13: 0 r14: 0 r15: 0 r16: 4 r17: 11 r18: 10 r19: 2 r20: 2
r21: 2 r22: 0 r23: 0 r24: 0 r25: 0 r26: 0 r27: 0 r28: 0
r29: 0 r30: 0 r31: 0
-Registers used: 5 out of 35 (14.3%)
+Registers used: 6 out of 35 (17.1%)
"ATmega328P" instruction use summary:
.lds : 0 .sts : 0 adc : 0 add : 0 adiw : 0 and : 0
@@ -1128,9 +1134,9 @@ clc : 0 clh : 0 cli : 0 cln : 0 clr : 0 cls : 0
clt : 0 clv : 0 clz : 0 com : 0 cp : 0 cpc : 0
cpi : 4 cpse : 0 dec : 3 eor : 0 fmul : 0 fmuls : 0
fmulsu: 0 icall : 0 ijmp : 0 in : 0 inc : 0 jmp : 1
-ld : 0 ldd : 0 ldi : 8 lds : 0 lpm : 0 lsl : 2
+ld : 0 ldd : 0 ldi : 10 lds : 0 lpm : 0 lsl : 2
lsr : 2 mov : 0 movw : 0 mul : 0 muls : 0 mulsu : 0
-neg : 0 nop : 0 or : 0 ori : 0 out : 8 pop : 0
+neg : 0 nop : 0 or : 0 ori : 0 out : 10 pop : 0
push : 0 rcall : 4 ret : 1 reti : 0 rjmp : 1 rol : 0
ror : 0 sbc : 0 sbci : 0 sbi : 0 sbic : 0 sbis : 0
sbiw : 0 sbr : 0 sbrc : 0 sbrs : 0 sec : 0 seh : 0
@@ -1142,7 +1148,7 @@ Instructions used: 11 out of 113 (9.7%)
"ATmega328P" memory use summary [bytes]:
Segment Begin End Code Data Used Size Use%
---------------------------------------------------------------
-[.cseg] 0x000000 0x000054 84 0 84 32768 0.3%
+[.cseg] 0x000000 0x00005c 92 0 92 32768 0.3%
[.dseg] 0x000100 0x000100 0 0 0 2048 0.0%
[.eseg] 0x000000 0x000000 0 0 0 1024 0.0%
diff --git a/P1/P1/Debug/P1.tmp b/P1/P1/Debug/P1.tmp
index 5618f2e..b165cbb 100644
--- a/P1/P1/Debug/P1.tmp
+++ b/P1/P1/Debug/P1.tmp
@@ -23,11 +23,11 @@
C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm13
- C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm21
- C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm54
- C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm30
- C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm37
- C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm46
- C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm59
+ C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm27
+ C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm60
+ C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm36
+ C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm43
+ C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm52
+ C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm65
diff --git a/P1/P1/main.asm b/P1/P1/main.asm
index b4b3388..892b6ee 100644
--- a/P1/P1/main.asm
+++ b/P1/P1/main.asm
@@ -2,7 +2,7 @@
; P1.asm
;
; Created: 12.10.2023 22:54:52
-; Author : Safak
+; Author : Safak Hazinedar
;
.include "m328pdef.inc"
@@ -11,18 +11,24 @@
rjmp init
init:
+ ldi r16, LOW(RAMEND) ; Stack einrichten für Befehle
+ out SPL, r16
+ ldi r16, HIGH(RAMEND)
+ out SPH, r16
+
ldi r17, 0xFF
out DDRD, r17 ; Data direction register D (D0-D7) as output
- ldi r17, 0x01 ; initialize D0
ldi r18, 0x03
out DDRB, r18 ; Data direction register B (B0-B1) as output
+ ldi r17, 0x01 ; initialize D0
+
portD_left:
out PORTD, r17
rcall delay
- lsl r17 ; shift left until PortB is 0x00
- cpi r17, 0x00 ; if(r17!=0x00) links_PD
+ lsl r17 ; shift left until PortD is 0x00
+ cpi r17, 0x00 ;
brne portD_left
out PORTD, r17 ; D0-D7 = 0
ldi r18, 0x01 ; switch to PortB
@@ -32,14 +38,14 @@ portB_left:
rcall delay
lsl r18
cpi r18, 0x02 ; length of PortB is variable
- brne portB_left
+ brne portB_left
; D9 = 1 => last LED turned on
portB_right:
out PORTB, r18
rcall delay
lsr r18 ; turn direction
cpi r18, 0x00 ; shift right until PortB is 0x00
- brne portB_right
+ brne portB_right
out PORTB, r18 ; turn of PortB or rather D8 & D9
ldi r17, 0x80
@@ -48,7 +54,7 @@ portD_right:
rcall delay
lsr r17
cpi r17, 0x01 ; shift right until D0 is reached
- brne portD_right
+ brne portD_right
jmp portD_left ; turn direction
delay:
diff --git a/P2/.vs/P2/v14/.atsuo b/P2/.vs/P2/v14/.atsuo
new file mode 100644
index 0000000..e2b54e7
Binary files /dev/null and b/P2/.vs/P2/v14/.atsuo differ
diff --git a/P2/P2 Interrups/.vs/P2 Interrups/v14/.atsuo b/P2/P2 Interrups/.vs/P2 Interrups/v14/.atsuo
new file mode 100644
index 0000000..0bada59
Binary files /dev/null and b/P2/P2 Interrups/.vs/P2 Interrups/v14/.atsuo differ
diff --git a/P2/P2 Interrups/P2 Interrups.atsln b/P2/P2 Interrups/P2 Interrups.atsln
new file mode 100644
index 0000000..4423299
--- /dev/null
+++ b/P2/P2 Interrups/P2 Interrups.atsln
@@ -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}") = "P2 Interrups", "P2 Interrups\P2 Interrups.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
diff --git a/P2/P2 Interrups/P2 Interrups/P2 Interrups.componentinfo.xml b/P2/P2 Interrups/P2 Interrups/P2 Interrups.componentinfo.xml
new file mode 100644
index 0000000..8df2c1d
--- /dev/null
+++ b/P2/P2 Interrups/P2 Interrups/P2 Interrups.componentinfo.xml
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+ Device
+ Startup
+
+
+ Atmel
+ 1.2.0
+ C:/Program Files (x86)\Atmel\Studio\7.0\Packs
+
+
+
+
+ C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include
+
+ include
+ C
+
+
+ include
+
+
+
+
+ C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include\avr\iom328p.h
+
+ header
+ C
+ UMk4QUzkkuShabuoYtNl/Q==
+
+ include/avr/iom328p.h
+
+
+
+
+ C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\templates\library.c
+ template
+ source
+ C Lib
+ Xs6gZkHoRPVc48eW2v/lGA==
+
+ templates/library.c
+ Main file (.c)
+
+
+
+ C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\templates\library.cpp
+ template
+ source
+ C Lib
+ Ztu2zWWQnYWBswuEN+3iHQ==
+
+ templates/library.cpp
+ Main file (.cpp)
+
+
+
+ C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega328p
+
+ libraryPrefix
+ GCC
+
+
+ gcc/dev/atmega328p
+
+
+
+
+ ATmega_DFP
+ C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/Atmel.ATmega_DFP.pdsc
+ 1.2.209
+ true
+ ATmega328P
+
+
+
+ Resolved
+ Fixed
+ true
+
+
+
\ No newline at end of file
diff --git a/P2/P2 Interrups/P2 Interrups/P2 Interrups.cproj b/P2/P2 Interrups/P2 Interrups/P2 Interrups.cproj
new file mode 100644
index 0000000..7493928
--- /dev/null
+++ b/P2/P2 Interrups/P2 Interrups/P2 Interrups.cproj
@@ -0,0 +1,118 @@
+
+
+
+ 2.0
+ 7.0
+ com.Atmel.AVRGCC8.C
+ dce6c7e3-ee26-4d79-826b-08594b9ad897
+ ATmega328P
+ none
+ StaticLibrary
+ C
+ lib$(MSBuildProjectName)
+ .a
+ $(MSBuildProjectDirectory)\$(Configuration)
+
+
+ P2 Interrups
+ P2 Interrups
+ P2 Interrups
+ Native
+ true
+ false
+ true
+ true
+
+
+ true
+
+ 2
+ 0
+ 0
+
+
+
+
+
+ -mmcu=atmega328p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega328p"
+ True
+ True
+ True
+ True
+ False
+ True
+ True
+
+
+ NDEBUG
+
+
+
+
+ %24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include
+
+
+ Optimize for size (-Os)
+ True
+ True
+ True
+
+
+ libm
+
+
+
+
+ %24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include
+
+
+
+
+
+
+
+
+ -mmcu=atmega328p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega328p"
+ True
+ True
+ True
+ True
+ False
+ True
+ True
+
+
+ DEBUG
+
+
+
+
+ %24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include
+
+
+ Optimize (-O1)
+ True
+ True
+ Default (-g2)
+ True
+
+
+ libm
+
+
+
+
+ %24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include
+
+
+ Default (-Wa,-g)
+
+
+
+
+
+ compile
+
+
+
+
\ No newline at end of file
diff --git a/P2/P2 Interrups/P2 Interrups/main.c b/P2/P2 Interrups/P2 Interrups/main.c
new file mode 100644
index 0000000..5346a1e
--- /dev/null
+++ b/P2/P2 Interrups/P2 Interrups/main.c
@@ -0,0 +1,66 @@
+/*
+ * P2 Interrups.c
+ *
+ * Created: 11.11.2023 21:07:41
+ * Author : Safak
+ */
+
+#include
+
+#define F_CPU 16000000UL
+#include
+#include
+#include // boolean type and values
+
+#define LED00 PINB0
+#define LED09 PINB1
+#define SWITCH01 PIND2
+#define SWITCH02 PIND3
+
+volatile int on = LED00;
+volatile bool blink = true;
+
+void setupPorts() {
+ DDRB = 0xff; // Data direction register B (B0 & B1) as output
+ 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
+}
+
+ISR(INT0_vect) {
+ if (on == LED00) { // 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;
+}
+
+ISR(INT1_vect) {
+ if (on == LED09) {
+ blink = !blink;
+ } else {
+ PORTB = (1 << LED09);
+ }
+ on = LED09;
+}
+
+
+int main(void)
+{
+ /* Replace with your application code */
+ setupPorts();
+ while(1){
+ if (blink) {
+ PORTB ^= (1 << on);
+ } else {
+ PORTB = (1 << on);
+ }
+ _delay_ms(200);
+ }
+}
\ No newline at end of file
diff --git a/P2/P2 Pooling/.vs/P2 Pooling/v14/.atsuo b/P2/P2 Pooling/.vs/P2 Pooling/v14/.atsuo
new file mode 100644
index 0000000..e6038b2
Binary files /dev/null and b/P2/P2 Pooling/.vs/P2 Pooling/v14/.atsuo differ
diff --git a/P2/P2 Pooling/P2 Pooling.atsln b/P2/P2 Pooling/P2 Pooling.atsln
new file mode 100644
index 0000000..7d7a0b1
--- /dev/null
+++ b/P2/P2 Pooling/P2 Pooling.atsln
@@ -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}") = "P2 Pooling", "P2 Pooling\P2 Pooling.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
diff --git a/P2/P2 Pooling/P2 Pooling/P2 Pooling.componentinfo.xml b/P2/P2 Pooling/P2 Pooling/P2 Pooling.componentinfo.xml
new file mode 100644
index 0000000..edcfcda
--- /dev/null
+++ b/P2/P2 Pooling/P2 Pooling/P2 Pooling.componentinfo.xml
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+ Device
+ Startup
+
+
+ Atmel
+ 1.2.0
+ C:/Program Files (x86)\Atmel\Studio\7.0\Packs
+
+
+
+
+ C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include
+
+ include
+ C
+
+
+ include
+
+
+
+
+ C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include\avr\iom328p.h
+
+ header
+ C
+ UMk4QUzkkuShabuoYtNl/Q==
+
+ include/avr/iom328p.h
+
+
+
+
+ C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\templates\main.c
+ template
+ source
+ C Exe
+ gIGb2m6IqIB7TDlcNASCgw==
+
+ templates/main.c
+ Main file (.c)
+
+
+
+ C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\templates\main.cpp
+ template
+ source
+ C Exe
+ YXFphlh0CtZJU+ebktABgQ==
+
+ templates/main.cpp
+ Main file (.cpp)
+
+
+
+ C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega328p
+
+ libraryPrefix
+ GCC
+
+
+ gcc/dev/atmega328p
+
+
+
+
+ ATmega_DFP
+ C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/Atmel.ATmega_DFP.pdsc
+ 1.2.209
+ true
+ ATmega328P
+
+
+
+ Resolved
+ Fixed
+ true
+
+
+
\ No newline at end of file
diff --git a/P2/P2 Pooling/P2 Pooling/P2 Pooling.cproj b/P2/P2 Pooling/P2 Pooling/P2 Pooling.cproj
new file mode 100644
index 0000000..52dee3d
--- /dev/null
+++ b/P2/P2 Pooling/P2 Pooling/P2 Pooling.cproj
@@ -0,0 +1,116 @@
+
+
+
+ 2.0
+ 7.0
+ com.Atmel.AVRGCC8.C
+ dce6c7e3-ee26-4d79-826b-08594b9ad897
+ ATmega328P
+ none
+ Executable
+ C
+ $(MSBuildProjectName)
+ .elf
+ $(MSBuildProjectDirectory)\$(Configuration)
+ P2 Pooling
+ P2 Pooling
+ P2 Pooling
+ Native
+ true
+ false
+ true
+ true
+
+
+ true
+
+ 2
+ 0
+ 0
+
+
+
+
+
+ -mmcu=atmega328p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega328p"
+ True
+ True
+ True
+ True
+ False
+ True
+ True
+
+
+ NDEBUG
+
+
+
+
+ %24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include
+
+
+ Optimize for size (-Os)
+ True
+ True
+ True
+
+
+ libm
+
+
+
+
+ %24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include
+
+
+
+
+
+
+
+
+ -mmcu=atmega328p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega328p"
+ True
+ True
+ True
+ True
+ False
+ True
+ True
+
+
+ DEBUG
+
+
+
+
+ %24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include
+
+
+ Optimize (-O1)
+ True
+ True
+ Default (-g2)
+ True
+
+
+ libm
+
+
+
+
+ %24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include
+
+
+ Default (-Wa,-g)
+
+
+
+
+
+ compile
+
+
+
+
\ No newline at end of file
diff --git a/P2/P2 Pooling/P2 Pooling/main.c b/P2/P2 Pooling/P2 Pooling/main.c
new file mode 100644
index 0000000..7811439
--- /dev/null
+++ b/P2/P2 Pooling/P2 Pooling/main.c
@@ -0,0 +1,75 @@
+/*
+ * P2 Pooling.c
+ *
+ * Created: 11.11.2023 21:06:54
+ * Author : Safak
+ */
+
+#include
+#define F_CPU 16000000UL
+#include
+#include // boolean type and values
+
+#define LED00 PIND0
+#define LED09 PIND1
+
+#define SWITCH01 PINB0
+#define SWITCH02 PINB1
+
+int on = LED00;
+int off = LED09;
+bool blink = true;
+
+void setupPorts() {
+ DDRD = 0xff; // Data direction register D (D0 & D1) as output
+ PORTD = 0x00;
+
+ DDRB = 0x00; // Data direction register B (B0 & B1) as input
+ PORTB = 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;
+ }
+ }
+ }
+
+ 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;
+ }
+ }
+ }
+}
+
+int main(void)
+{
+ /* Replace with your application code */
+ setupPorts();
+ while (1)
+ {
+ pressButton();
+ if (blink) {
+ PORTD &= ~(1UL << off);
+ PORTD ^= (1 << on);
+ }
+ else {
+ PORTD &= ~(1UL << off);
+ PORTD |= ( 1 << on);
+ }
+ _delay_ms(200);
+ }
+}
+