added comments and removed unnecesary wait
This commit is contained in:
125
Microcontrollers/Opdracht 2.2/Debug/Makefile
Normal file
125
Microcontrollers/Opdracht 2.2/Debug/Makefile
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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 +=Opdracht\ 2.2.elf
|
||||||
|
|
||||||
|
OUTPUT_FILE_PATH_AS_ARGS +="Opdracht 2.2.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: XC8 C Compiler : 2.31
|
||||||
|
$(QUOTE)C:\Program Files\Microchip\xc8\v2.31\bin\xc8-cc.exe$(QUOTE) -mcpu=ATmega128 -mdfp="C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\xc8" -c -x c -funsigned-char -funsigned-bitfields -mext=cci -D__ATmega128__ -DDEBUG -Og -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -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: XC8 C Linker : 2.31
|
||||||
|
$(QUOTE)C:\Program Files\Microchip\xc8\v2.31\bin\xc8-cc.exe$(QUOTE) -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS) -mcpu=ATmega128 -mdfp="C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\xc8" -Wl,-Map="Opdracht 2.2.map" -funsigned-char -funsigned-bitfields -Wl,--start-group -Wl,-lm -Wl,--end-group -Wl,--gc-sections -Og -ffunction-sections -fdata-sections -fpack-struct -fshort-enums --memorysummary,memoryfile.xml
|
||||||
|
@echo Finished building target: $@
|
||||||
|
"C:\Program Files\Microchip\xc8\v2.31\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "Opdracht 2.2.elf" "Opdracht 2.2.hex"
|
||||||
|
"C:\Program Files\Microchip\xc8\v2.31\bin\avr-objcopy.exe" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex "Opdracht 2.2.elf" "Opdracht 2.2.eep" || exit 0
|
||||||
|
"C:\Program Files\Microchip\xc8\v2.31\bin\avr-objdump.exe" -h -S "Opdracht 2.2.elf" > "Opdracht 2.2.lss"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Other Targets
|
||||||
|
clean:
|
||||||
|
-$(RM) $(OBJS_AS_ARGS) $(EXECUTABLES)
|
||||||
|
-$(RM) $(C_DEPS_AS_ARGS)
|
||||||
|
rm -rf "Opdracht 2.2.elf" "Opdracht 2.2.hex" "Opdracht 2.2.eep" "Opdracht 2.2.map" "Opdracht 2.2.usersignatures" "Opdracht 2.2.a" "Opdracht 2.2.lss"
|
||||||
|
|
||||||
1
Microcontrollers/Opdracht 2.2/Debug/Opdracht 2.2.eep
Normal file
1
Microcontrollers/Opdracht 2.2/Debug/Opdracht 2.2.eep
Normal file
@@ -0,0 +1 @@
|
|||||||
|
:00000001FF
|
||||||
242
Microcontrollers/Opdracht 2.2/Debug/Opdracht 2.2.lss
Normal file
242
Microcontrollers/Opdracht 2.2/Debug/Opdracht 2.2.lss
Normal file
@@ -0,0 +1,242 @@
|
|||||||
|
|
||||||
|
Opdracht 2.2.elf: file format elf32-avr
|
||||||
|
|
||||||
|
Sections:
|
||||||
|
Idx Name Size VMA LMA File off Algn
|
||||||
|
0 .data 00000000 00800100 00800100 00000192 2**0
|
||||||
|
ALLOC, LOAD, DATA
|
||||||
|
1 .text 000000a4 00000000 00000000 00000054 2**1
|
||||||
|
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||||
|
2 .comment 0000002f 00000000 00000000 00000192 2**0
|
||||||
|
CONTENTS, READONLY
|
||||||
|
3 .debug_aranges 00000038 00000000 00000000 000001c1 2**0
|
||||||
|
CONTENTS, READONLY, DEBUGGING
|
||||||
|
4 .debug_info 00000b2a 00000000 00000000 000001f9 2**0
|
||||||
|
CONTENTS, READONLY, DEBUGGING
|
||||||
|
5 .debug_abbrev 00000830 00000000 00000000 00000d23 2**0
|
||||||
|
CONTENTS, READONLY, DEBUGGING
|
||||||
|
6 .debug_line 000002e4 00000000 00000000 00001553 2**0
|
||||||
|
CONTENTS, READONLY, DEBUGGING
|
||||||
|
7 .debug_frame 00000074 00000000 00000000 00001838 2**2
|
||||||
|
CONTENTS, READONLY, DEBUGGING
|
||||||
|
8 .debug_str 0000027d 00000000 00000000 000018ac 2**0
|
||||||
|
CONTENTS, READONLY, DEBUGGING
|
||||||
|
9 .debug_loc 000000e2 00000000 00000000 00001b29 2**0
|
||||||
|
CONTENTS, READONLY, DEBUGGING
|
||||||
|
10 .debug_ranges 00000028 00000000 00000000 00001c0b 2**0
|
||||||
|
CONTENTS, READONLY, DEBUGGING
|
||||||
|
11 .text 00000004 0000013a 0000013a 0000018e 2**1
|
||||||
|
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||||
|
12 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00001c34 2**2
|
||||||
|
CONTENTS, READONLY, DEBUGGING
|
||||||
|
13 .text.wait 0000001e 0000011c 0000011c 00000170 2**1
|
||||||
|
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||||
|
14 .text.__vector_2 00000028 000000a4 000000a4 000000f8 2**1
|
||||||
|
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||||
|
15 .text.__vector_3 00000028 000000cc 000000cc 00000120 2**1
|
||||||
|
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||||
|
16 .text.main 00000028 000000f4 000000f4 00000148 2**1
|
||||||
|
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||||
|
|
||||||
|
Disassembly of section .text:
|
||||||
|
|
||||||
|
00000000 <__vectors>:
|
||||||
|
0: 0c 94 46 00 jmp 0x8c ; 0x8c <__ctors_end>
|
||||||
|
4: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
8: 0c 94 52 00 jmp 0xa4 ; 0xa4 <_etext>
|
||||||
|
c: 0c 94 66 00 jmp 0xcc ; 0xcc <__vector_3>
|
||||||
|
10: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
14: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
18: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
1c: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
20: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
24: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
28: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
2c: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
30: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
34: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
38: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
3c: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
40: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
44: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
48: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
4c: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
50: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
54: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
58: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
5c: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
60: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
64: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
68: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
6c: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
70: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
74: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
78: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
7c: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
80: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
84: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
88: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
|
||||||
|
|
||||||
|
0000008c <__ctors_end>:
|
||||||
|
8c: 11 24 eor r1, r1
|
||||||
|
8e: 1f be out 0x3f, r1 ; 63
|
||||||
|
90: cf ef ldi r28, 0xFF ; 255
|
||||||
|
92: d0 e1 ldi r29, 0x10 ; 16
|
||||||
|
94: de bf out 0x3e, r29 ; 62
|
||||||
|
96: cd bf out 0x3d, r28 ; 61
|
||||||
|
98: 0e 94 7a 00 call 0xf4 ; 0xf4 <main>
|
||||||
|
9c: 0c 94 50 00 jmp 0xa0 ; 0xa0 <_exit>
|
||||||
|
|
||||||
|
000000a0 <_exit>:
|
||||||
|
a0: f8 94 cli
|
||||||
|
|
||||||
|
000000a2 <__stop_program>:
|
||||||
|
a2: ff cf rjmp .-2 ; 0xa2 <__stop_program>
|
||||||
|
|
||||||
|
Disassembly of section .text:
|
||||||
|
|
||||||
|
0000013a <__bad_interrupt>:
|
||||||
|
13a: 0c 94 00 00 jmp 0 ; 0x0 <__TEXT_REGION_ORIGIN__>
|
||||||
|
|
||||||
|
Disassembly of section .text.wait:
|
||||||
|
|
||||||
|
0000011c <wait>:
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <util/delay.h>
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
|
||||||
|
void wait( int ms ) {
|
||||||
|
for (int i=0; i<ms; i++) {
|
||||||
|
11c: 20 e0 ldi r18, 0x00 ; 0
|
||||||
|
11e: 30 e0 ldi r19, 0x00 ; 0
|
||||||
|
120: 08 c0 rjmp .+16 ; 0x132 <wait+0x16>
|
||||||
|
#else
|
||||||
|
//round up by default
|
||||||
|
__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
__builtin_avr_delay_cycles(__ticks_dc);
|
||||||
|
122: e3 ec ldi r30, 0xC3 ; 195
|
||||||
|
124: f9 e0 ldi r31, 0x09 ; 9
|
||||||
|
126: 31 97 sbiw r30, 0x01 ; 1
|
||||||
|
128: f1 f7 brne .-4 ; 0x126 <wait+0xa>
|
||||||
|
12a: 00 c0 rjmp .+0 ; 0x12c <wait+0x10>
|
||||||
|
12c: 00 00 nop
|
||||||
|
12e: 2f 5f subi r18, 0xFF ; 255
|
||||||
|
130: 3f 4f sbci r19, 0xFF ; 255
|
||||||
|
132: 28 17 cp r18, r24
|
||||||
|
134: 39 07 cpc r19, r25
|
||||||
|
136: ac f3 brlt .-22 ; 0x122 <wait+0x6>
|
||||||
|
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
138: 08 95 ret
|
||||||
|
|
||||||
|
Disassembly of section .text.__vector_2:
|
||||||
|
|
||||||
|
000000a4 <__vector_2>:
|
||||||
|
|
||||||
|
ISR( INT1_vect ) {
|
||||||
|
a4: 1f 92 push r1
|
||||||
|
a6: 0f 92 push r0
|
||||||
|
a8: 0f b6 in r0, 0x3f ; 63
|
||||||
|
aa: 0f 92 push r0
|
||||||
|
ac: 11 24 eor r1, r1
|
||||||
|
ae: 8f 93 push r24
|
||||||
|
if (PORTC == 0b10000000)
|
||||||
|
b0: 85 b3 in r24, 0x15 ; 21
|
||||||
|
b2: 80 38 cpi r24, 0x80 ; 128
|
||||||
|
b4: 11 f4 brne .+4 ; 0xba <__vector_2+0x16>
|
||||||
|
{
|
||||||
|
PORTC == 0b00000001;
|
||||||
|
b6: 85 b3 in r24, 0x15 ; 21
|
||||||
|
b8: 03 c0 rjmp .+6 ; 0xc0 <__vector_2+0x1c>
|
||||||
|
} else {
|
||||||
|
PORTC = PORTC << 1;
|
||||||
|
ba: 85 b3 in r24, 0x15 ; 21
|
||||||
|
bc: 88 0f add r24, r24
|
||||||
|
be: 85 bb out 0x15, r24 ; 21
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
c0: 8f 91 pop r24
|
||||||
|
c2: 0f 90 pop r0
|
||||||
|
c4: 0f be out 0x3f, r0 ; 63
|
||||||
|
c6: 0f 90 pop r0
|
||||||
|
c8: 1f 90 pop r1
|
||||||
|
ca: 18 95 reti
|
||||||
|
|
||||||
|
Disassembly of section .text.__vector_3:
|
||||||
|
|
||||||
|
000000cc <__vector_3>:
|
||||||
|
|
||||||
|
ISR( INT2_vect ) {
|
||||||
|
cc: 1f 92 push r1
|
||||||
|
ce: 0f 92 push r0
|
||||||
|
d0: 0f b6 in r0, 0x3f ; 63
|
||||||
|
d2: 0f 92 push r0
|
||||||
|
d4: 11 24 eor r1, r1
|
||||||
|
d6: 8f 93 push r24
|
||||||
|
if (PORTC == 0b00000001)
|
||||||
|
d8: 85 b3 in r24, 0x15 ; 21
|
||||||
|
da: 81 30 cpi r24, 0x01 ; 1
|
||||||
|
dc: 11 f4 brne .+4 ; 0xe2 <__vector_3+0x16>
|
||||||
|
{
|
||||||
|
PORTC = 0b10000000;
|
||||||
|
de: 80 e8 ldi r24, 0x80 ; 128
|
||||||
|
e0: 85 bb out 0x15, r24 ; 21
|
||||||
|
}
|
||||||
|
PORTC = PORTC >> 1;
|
||||||
|
e2: 85 b3 in r24, 0x15 ; 21
|
||||||
|
e4: 86 95 lsr r24
|
||||||
|
e6: 85 bb out 0x15, r24 ; 21
|
||||||
|
}
|
||||||
|
e8: 8f 91 pop r24
|
||||||
|
ea: 0f 90 pop r0
|
||||||
|
ec: 0f be out 0x3f, r0 ; 63
|
||||||
|
ee: 0f 90 pop r0
|
||||||
|
f0: 1f 90 pop r1
|
||||||
|
f2: 18 95 reti
|
||||||
|
|
||||||
|
Disassembly of section .text.main:
|
||||||
|
|
||||||
|
000000f4 <main>:
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
/* Replace with your application code */
|
||||||
|
|
||||||
|
// Init I/O
|
||||||
|
DDRD = 0xF0; // PORTD (7:4) is output, (3:0) is input
|
||||||
|
f4: 80 ef ldi r24, 0xF0 ; 240
|
||||||
|
f6: 81 bb out 0x11, r24 ; 17
|
||||||
|
DDRC = 0xFF;
|
||||||
|
f8: 8f ef ldi r24, 0xFF ; 255
|
||||||
|
fa: 84 bb out 0x14, r24 ; 20
|
||||||
|
|
||||||
|
// Init Interrupt hardware
|
||||||
|
EICRA |= 0x2C; // INT2 falling edge, INT1 rising edge
|
||||||
|
fc: ea e6 ldi r30, 0x6A ; 106
|
||||||
|
fe: f0 e0 ldi r31, 0x00 ; 0
|
||||||
|
100: 80 81 ld r24, Z
|
||||||
|
102: 8c 62 ori r24, 0x2C ; 44
|
||||||
|
104: 80 83 st Z, r24
|
||||||
|
EIMSK |= 0x06; // Enable INT2 & INT1
|
||||||
|
106: 89 b7 in r24, 0x39 ; 57
|
||||||
|
108: 86 60 ori r24, 0x06 ; 6
|
||||||
|
10a: 89 bf out 0x39, r24 ; 57
|
||||||
|
|
||||||
|
PORTC = 0x01;
|
||||||
|
10c: 81 e0 ldi r24, 0x01 ; 1
|
||||||
|
10e: 85 bb out 0x15, r24 ; 21
|
||||||
|
|
||||||
|
sei();
|
||||||
|
110: 78 94 sei
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
wait(500);
|
||||||
|
112: 84 ef ldi r24, 0xF4 ; 244
|
||||||
|
114: 91 e0 ldi r25, 0x01 ; 1
|
||||||
|
116: 0e 94 8e 00 call 0x11c ; 0x11c <wait>
|
||||||
|
11a: fb cf rjmp .-10 ; 0x112 <main+0x1e>
|
||||||
6
Microcontrollers/Opdracht 2.2/Debug/makedep.mk
Normal file
6
Microcontrollers/Opdracht 2.2/Debug/makedep.mk
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
################################################################################
|
||||||
|
# Automatically-generated file. Do not edit or delete the file
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
main.c
|
||||||
|
|
||||||
17
Microcontrollers/Opdracht 2.2/Debug/memoryfile.xml
Normal file
17
Microcontrollers/Opdracht 2.2/Debug/memoryfile.xml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project>
|
||||||
|
<executable name="Opdracht 2.2.elf">
|
||||||
|
<memory name="program">
|
||||||
|
<units>bytes</units>
|
||||||
|
<length>131072</length>
|
||||||
|
<used>318</used>
|
||||||
|
<free>130754</free>
|
||||||
|
</memory>
|
||||||
|
<memory name="data">
|
||||||
|
<units>bytes</units>
|
||||||
|
<length>4096</length>
|
||||||
|
<used>0</used>
|
||||||
|
<free>4096</free>
|
||||||
|
</memory>
|
||||||
|
</executable>
|
||||||
|
</project>
|
||||||
42
Microcontrollers/Opdracht 2.2/Opdracht 2.2.componentinfo.xml
Normal file
42
Microcontrollers/Opdracht 2.2/Opdracht 2.2.componentinfo.xml
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<?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.6.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.6.364\xc8\avr\include\avr\iom128.h</AbsolutePath>
|
||||||
|
<Attribute></Attribute>
|
||||||
|
<Category>header</Category>
|
||||||
|
<Condition>XC</Condition>
|
||||||
|
<FileContentHash>JdJ7J9I/SJh965SEyyyVYw==</FileContentHash>
|
||||||
|
<FileVersion></FileVersion>
|
||||||
|
<Name>xc8/avr/include/avr/iom128.h</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.6.364/Atmel.ATmega_DFP.pdsc</PackPath>
|
||||||
|
<PackVersion>1.6.364</PackVersion>
|
||||||
|
<PresentInProject>true</PresentInProject>
|
||||||
|
<ReferenceConditionId>ATmega128</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>
|
||||||
87
Microcontrollers/Opdracht 2.2/Opdracht 2.2.cproj
Normal file
87
Microcontrollers/Opdracht 2.2/Opdracht 2.2.cproj
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectVersion>7.0</ProjectVersion>
|
||||||
|
<ToolchainName>com.microchip.xc8</ToolchainName>
|
||||||
|
<ProjectGuid>{7328e66f-4181-4553-9542-da5cc2a74a4e}</ProjectGuid>
|
||||||
|
<avrdevice>ATmega128</avrdevice>
|
||||||
|
<avrdeviceseries>none</avrdeviceseries>
|
||||||
|
<OutputType>Executable</OutputType>
|
||||||
|
<Language>C</Language>
|
||||||
|
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
|
||||||
|
<OutputFileExtension>.elf</OutputFileExtension>
|
||||||
|
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
|
||||||
|
<AssemblyName>Opdracht 2.2</AssemblyName>
|
||||||
|
<Name>Opdracht 2.2</Name>
|
||||||
|
<RootNamespace>Opdracht 2.2</RootNamespace>
|
||||||
|
<ToolchainFlavour>XC8_2.31</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>
|
||||||
|
<com.microchip.xc8>
|
||||||
|
<com.microchip.xc8.common.optimization.RelaxBranches>True</com.microchip.xc8.common.optimization.RelaxBranches>
|
||||||
|
<com.microchip.xc8.compiler.general.ChangeDefaultCharTypeUnsigned>True</com.microchip.xc8.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||||
|
<com.microchip.xc8.compiler.general.ChangeDefaultBitFieldUnsigned>True</com.microchip.xc8.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||||
|
<com.microchip.xc8.compiler.symbols.DefSymbols>
|
||||||
|
<ListValues>
|
||||||
|
<Value>(%24DeviceMacro)</Value>
|
||||||
|
<Value>NDEBUG</Value>
|
||||||
|
</ListValues>
|
||||||
|
</com.microchip.xc8.compiler.symbols.DefSymbols>
|
||||||
|
<com.microchip.xc8.compiler.optimization.level>Optimize for size (-Os)</com.microchip.xc8.compiler.optimization.level>
|
||||||
|
<com.microchip.xc8.compiler.optimization.PackStructureMembers>True</com.microchip.xc8.compiler.optimization.PackStructureMembers>
|
||||||
|
<com.microchip.xc8.compiler.optimization.AllocateBytesNeededForEnum>True</com.microchip.xc8.compiler.optimization.AllocateBytesNeededForEnum>
|
||||||
|
<com.microchip.xc8.compiler.warnings.AllWarnings>True</com.microchip.xc8.compiler.warnings.AllWarnings>
|
||||||
|
<com.microchip.xc8.linker.libraries.Libraries>
|
||||||
|
<ListValues>
|
||||||
|
<Value>libm</Value>
|
||||||
|
</ListValues>
|
||||||
|
</com.microchip.xc8.linker.libraries.Libraries>
|
||||||
|
</com.microchip.xc8>
|
||||||
|
</ToolchainSettings>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||||
|
<ToolchainSettings>
|
||||||
|
<com.microchip.xc8>
|
||||||
|
<com.microchip.xc8.compiler.general.ChangeDefaultCharTypeUnsigned>True</com.microchip.xc8.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||||
|
<com.microchip.xc8.compiler.general.ChangeDefaultBitFieldUnsigned>True</com.microchip.xc8.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||||
|
<com.microchip.xc8.compiler.symbols.DefSymbols>
|
||||||
|
<ListValues>
|
||||||
|
<Value>(%24DeviceMacro)</Value>
|
||||||
|
<Value>DEBUG</Value>
|
||||||
|
</ListValues>
|
||||||
|
</com.microchip.xc8.compiler.symbols.DefSymbols>
|
||||||
|
<com.microchip.xc8.compiler.optimization.level>Optimize debugging experience (-Og)</com.microchip.xc8.compiler.optimization.level>
|
||||||
|
<com.microchip.xc8.compiler.optimization.PackStructureMembers>True</com.microchip.xc8.compiler.optimization.PackStructureMembers>
|
||||||
|
<com.microchip.xc8.compiler.optimization.AllocateBytesNeededForEnum>True</com.microchip.xc8.compiler.optimization.AllocateBytesNeededForEnum>
|
||||||
|
<com.microchip.xc8.compiler.optimization.DebugLevel>Default (-g2)</com.microchip.xc8.compiler.optimization.DebugLevel>
|
||||||
|
<com.microchip.xc8.compiler.warnings.AllWarnings>True</com.microchip.xc8.compiler.warnings.AllWarnings>
|
||||||
|
<com.microchip.xc8.linker.libraries.Libraries>
|
||||||
|
<ListValues>
|
||||||
|
<Value>libm</Value>
|
||||||
|
</ListValues>
|
||||||
|
</com.microchip.xc8.linker.libraries.Libraries>
|
||||||
|
<com.microchip.xc8.assembler.debugging.DebugLevel>Default (-Wa,-g)</com.microchip.xc8.assembler.debugging.DebugLevel>
|
||||||
|
</com.microchip.xc8>
|
||||||
|
</ToolchainSettings>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="main.c">
|
||||||
|
<SubType>compile</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
|
||||||
|
</Project>
|
||||||
59
Microcontrollers/Opdracht 2.2/main.c
Normal file
59
Microcontrollers/Opdracht 2.2/main.c
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* Opdracht 2.2.c
|
||||||
|
*
|
||||||
|
* Created: 10-2-2021 10:58:13
|
||||||
|
* Author : Sem
|
||||||
|
*/
|
||||||
|
#define F_CPU 10e6
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <util/delay.h>
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
|
||||||
|
void wait( int ms ) {
|
||||||
|
for (int i=0; i<ms; i++) {
|
||||||
|
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ISR( INT1_vect ) {
|
||||||
|
if (PORTC == 0b10000000)
|
||||||
|
{
|
||||||
|
PORTC == 0b00000001;
|
||||||
|
} else {
|
||||||
|
PORTC = PORTC << 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ISR( INT2_vect ) {
|
||||||
|
if (PORTC == 0b00000001)
|
||||||
|
{
|
||||||
|
PORTC = 0b10000000;
|
||||||
|
}
|
||||||
|
PORTC = PORTC >> 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
/* Replace with your application code */
|
||||||
|
|
||||||
|
// Init I/O
|
||||||
|
DDRD = 0xF0; // PORTD (7:4) is output, (3:0) is input
|
||||||
|
DDRC = 0xFF;
|
||||||
|
|
||||||
|
// Init Interrupt hardware
|
||||||
|
EICRA |= 0x2C; // INT2 falling edge, INT1 rising edge
|
||||||
|
EIMSK |= 0x06; // Enable INT2 & INT1
|
||||||
|
|
||||||
|
PORTC = 0x01;
|
||||||
|
|
||||||
|
sei();
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
wait(500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
6
Microcontrollers/opdracht 1.3/Debug/makedep.mk
Normal file
6
Microcontrollers/opdracht 1.3/Debug/makedep.mk
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
################################################################################
|
||||||
|
# Automatically-generated file. Do not edit or delete the file
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
main.c
|
||||||
|
|
||||||
Reference in New Issue
Block a user