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

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: