This commit is contained in:
S170H
2023-11-11 21:35:59 +01:00
parent 965a5d073b
commit ec783fd3b6
19 changed files with 825 additions and 59 deletions

View File

@@ -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

Binary file not shown.

18
P1/.vscode/c_cpp_properties.json vendored Normal file
View File

@@ -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
}

15
P1/.vscode/launch.json vendored Normal file
View File

@@ -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"
}
]
}

59
P1/.vscode/settings.json vendored Normal file
View File

@@ -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
}

View File

@@ -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%

View File

@@ -23,11 +23,11 @@
</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>21</LINE></portD_left>
<delay><FILE>C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm</FILE><LINE>54</LINE></delay>
<portB_left><FILE>C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm</FILE><LINE>30</LINE></portB_left>
<portB_right><FILE>C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm</FILE><LINE>37</LINE></portB_right>
<portD_right><FILE>C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm</FILE><LINE>46</LINE></portD_right>
<L1><FILE>C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm</FILE><LINE>59</LINE></L1>
<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>
</LABELS>
</ASSEMBLER_INFO>

View File

@@ -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:

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

Binary file not shown.

Binary file not shown.

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}") = "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

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\library.c</AbsolutePath>
<Attribute>template</Attribute>
<Category>source</Category>
<Condition>C Lib</Condition>
<FileContentHash>Xs6gZkHoRPVc48eW2v/lGA==</FileContentHash>
<FileVersion></FileVersion>
<Name>templates/library.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\library.cpp</AbsolutePath>
<Attribute>template</Attribute>
<Category>source</Category>
<Condition>C Lib</Condition>
<FileContentHash>Ztu2zWWQnYWBswuEN+3iHQ==</FileContentHash>
<FileVersion></FileVersion>
<Name>templates/library.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>

View File

@@ -0,0 +1,118 @@
<?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>StaticLibrary</OutputType>
<Language>C</Language>
<OutputFileName>lib$(MSBuildProjectName)</OutputFileName>
<OutputFileExtension>.a</OutputFileExtension>
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
<AvrGccProjectExtensions>
</AvrGccProjectExtensions>
<AssemblyName>P2 Interrups</AssemblyName>
<Name>P2 Interrups</Name>
<RootNamespace>P2 Interrups</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>

View File

@@ -0,0 +1,66 @@
/*
* 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 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);
}
}

Binary file not shown.

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}") = "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

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>gIGb2m6IqIB7TDlcNASCgw==</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>

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>P2 Pooling</AssemblyName>
<Name>P2 Pooling</Name>
<RootNamespace>P2 Pooling</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>

View File

@@ -0,0 +1,75 @@
/*
* 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> // 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);
}
}