diff --git a/P1/.vs/P1/v14/.atsuo b/P1/.vs/P1/v14/.atsuo index 10f42ab..b33d05c 100644 Binary files a/P1/.vs/P1/v14/.atsuo and b/P1/.vs/P1/v14/.atsuo differ diff --git a/P1/P1/Debug/P1.lss b/P1/P1/Debug/P1.lss new file mode 100644 index 0000000..286954d --- /dev/null +++ b/P1/P1/Debug/P1.lss @@ -0,0 +1,1147 @@ + +AVRASM ver. 2.2.7 C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm Mon Oct 30 17:51: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' +[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' + + ; + + ;***** Created: 2011-02-09 12:03 ******* Source: ATmega328P.xml ********** + ;************************************************************************* + ;* A P P L I C A T I O N N O T E F O R T H E A V R F A M I L Y + ;* + ;* Number : AVR000 + ;* File Name : "m328Pdef.inc" + ;* Title : Register/Bit Definitions for the ATmega328P + ;* Date : 2011-02-09 + ;* Version : 2.35 + ;* Support E-mail : avr@atmel.com + ;* Target MCU : ATmega328P + ;* + ;* DESCRIPTION + ;* When including this file in the assembly program file, all I/O register + ;* names and I/O register bit names appearing in the data book can be used. + ;* In addition, the six registers forming the three data pointers X, Y and + ;* Z have been assigned names XL - ZH. Highest RAM address for Internal + ;* SRAM is also defined + ;* + ;* The Register names are represented by their hexadecimal address. + ;* + ;* The Register Bit names are represented by their bit number (0-7). + ;* + ;* Please observe the difference in using the bit names with instructions + ;* such as "sbr"/"cbr" (set/clear bit in register) and "sbrs"/"sbrc" + ;* (skip if bit in register set/cleared). The following example illustrates + ;* this: + ;* + ;* in r16,PORTB ;read PORTB latch + ;* sbr r16,(1< + 2.2.7 + "ATmega328P" + C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\Debug + + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\avrasm\inc + C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avrassembler\Include + + + C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm + + 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\Debug\P1.obj + + + P1.hex + + + P1.map + P1.lss + + + 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.asm52 + C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm34 + C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm44 + C:\Users\Safak\Desktop\UNI\3. Semester\53107 ARBK\Praktikumsunterlagen\ARBKVS-Praktika\P1\P1\main.asm57 + + diff --git a/P1/P1/P1.asmproj b/P1/P1/P1.asmproj index 21255aa..6005b46 100644 --- a/P1/P1/P1.asmproj +++ b/P1/P1/P1.asmproj @@ -20,37 +20,66 @@ false true true - + 0x20000000 true - + exception_table 2 0 0 + com.atmel.avrdbg.tool.simulator + + 0x1E950F + + + + + + + + com.atmel.avrdbg.tool.simulator + + + Simulator + + + + + + + + + + custom + + + Custom Programming Tool + - - - %24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\avrasm\inc - - - m328pdef.inc - + + + %24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\avrasm\inc + + + m328pdef.inc + + Executable - - - %24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\avrasm\inc - - - m328pdef.inc - + + + %24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\avrasm\inc + + + m328pdef.inc + diff --git a/P1/P1/main.asm b/P1/P1/main.asm index 42ed9ef..847636f 100644 --- a/P1/P1/main.asm +++ b/P1/P1/main.asm @@ -5,8 +5,61 @@ ; Author : Safak ; +.include "m328pdef.inc" -; Replace with your application code -start: - inc r16 - rjmp start +.org 0x00 +rjmp init + +init: + ldi r17, 0xFF + out DDRD, r17 ; Data direction register D (D0-D7) as output + ldi r17, 0x01 ; initialize D0 + + ldi r18, 0x01 + out DDRB, r18 ; Data direction register B (B0-B1) as output + +portD_left: + out PORTD, r17 + rcall delay + lsl r17 ; shift left until PortB is 0x00 + cpi r17, 0x00 ; if(r17!=0x00) links_PD + brne portD_left + out PORTD, r17 ; D0-D7 = 0 + +portB_left: + ;ldi r18, 0x01 + 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