From e3c373c92067640522012514b15b881813fcdd45 Mon Sep 17 00:00:00 2001 From: Kenneth van Ewijk Date: Tue, 2 Feb 2016 14:52:23 +0100 Subject: [PATCH 1/6] Opgave 1 --- MIC-Week1/Debug/MIC-Week1.eep | 1 + MIC-Week1/Debug/MIC-Week1.lss | 195 ++++++++++++++++ MIC-Week1/Debug/MIC-Week1.map | 415 +++++++++++++++++++++++++++++++++ MIC-Week1/Debug/MIC-Week1.srec | 17 ++ MIC-Week1/Debug/Makefile | 129 ++++++++++ MIC-Week1/Debug/main.d | 43 ++++ MIC-Week1/Debug/makedep.mk | 6 + MIC-Week1/MIC-Week1.cproj | 19 +- MIC-Week1/main.c | 40 +++- 9 files changed, 857 insertions(+), 8 deletions(-) create mode 100644 MIC-Week1/Debug/MIC-Week1.eep create mode 100644 MIC-Week1/Debug/MIC-Week1.lss create mode 100644 MIC-Week1/Debug/MIC-Week1.map create mode 100644 MIC-Week1/Debug/MIC-Week1.srec create mode 100644 MIC-Week1/Debug/Makefile create mode 100644 MIC-Week1/Debug/main.d create mode 100644 MIC-Week1/Debug/makedep.mk diff --git a/MIC-Week1/Debug/MIC-Week1.eep b/MIC-Week1/Debug/MIC-Week1.eep new file mode 100644 index 0000000..7c166a1 --- /dev/null +++ b/MIC-Week1/Debug/MIC-Week1.eep @@ -0,0 +1 @@ +:00000001FF diff --git a/MIC-Week1/Debug/MIC-Week1.lss b/MIC-Week1/Debug/MIC-Week1.lss new file mode 100644 index 0000000..56d3a86 --- /dev/null +++ b/MIC-Week1/Debug/MIC-Week1.lss @@ -0,0 +1,195 @@ + +MIC-Week1.elf: file format elf32-avr + +Sections: +Idx Name Size VMA LMA File off Algn + 0 .data 00000000 00800100 00800100 00000136 2**0 + CONTENTS, ALLOC, LOAD, DATA + 1 .text 000000e2 00000000 00000000 00000054 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 2 .comment 00000030 00000000 00000000 00000136 2**0 + CONTENTS, READONLY + 3 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00000168 2**2 + CONTENTS, READONLY + 4 .debug_aranges 00000028 00000000 00000000 000001a4 2**0 + CONTENTS, READONLY, DEBUGGING + 5 .debug_info 0000017b 00000000 00000000 000001cc 2**0 + CONTENTS, READONLY, DEBUGGING + 6 .debug_abbrev 00000115 00000000 00000000 00000347 2**0 + CONTENTS, READONLY, DEBUGGING + 7 .debug_line 00000173 00000000 00000000 0000045c 2**0 + CONTENTS, READONLY, DEBUGGING + 8 .debug_frame 00000034 00000000 00000000 000005d0 2**2 + CONTENTS, READONLY, DEBUGGING + 9 .debug_str 0000017c 00000000 00000000 00000604 2**0 + CONTENTS, READONLY, DEBUGGING + 10 .debug_loc 0000006a 00000000 00000000 00000780 2**0 + CONTENTS, READONLY, DEBUGGING + 11 .debug_ranges 00000018 00000000 00000000 000007ea 2**0 + CONTENTS, READONLY, DEBUGGING + +Disassembly of section .text: + +00000000 <__vectors>: + 0: 45 c0 rjmp .+138 ; 0x8c <__ctors_end> + 2: 00 00 nop + 4: 4b c0 rjmp .+150 ; 0x9c <__bad_interrupt> + 6: 00 00 nop + 8: 49 c0 rjmp .+146 ; 0x9c <__bad_interrupt> + a: 00 00 nop + c: 47 c0 rjmp .+142 ; 0x9c <__bad_interrupt> + e: 00 00 nop + 10: 45 c0 rjmp .+138 ; 0x9c <__bad_interrupt> + 12: 00 00 nop + 14: 43 c0 rjmp .+134 ; 0x9c <__bad_interrupt> + 16: 00 00 nop + 18: 41 c0 rjmp .+130 ; 0x9c <__bad_interrupt> + 1a: 00 00 nop + 1c: 3f c0 rjmp .+126 ; 0x9c <__bad_interrupt> + 1e: 00 00 nop + 20: 3d c0 rjmp .+122 ; 0x9c <__bad_interrupt> + 22: 00 00 nop + 24: 3b c0 rjmp .+118 ; 0x9c <__bad_interrupt> + 26: 00 00 nop + 28: 39 c0 rjmp .+114 ; 0x9c <__bad_interrupt> + 2a: 00 00 nop + 2c: 37 c0 rjmp .+110 ; 0x9c <__bad_interrupt> + 2e: 00 00 nop + 30: 35 c0 rjmp .+106 ; 0x9c <__bad_interrupt> + 32: 00 00 nop + 34: 33 c0 rjmp .+102 ; 0x9c <__bad_interrupt> + 36: 00 00 nop + 38: 31 c0 rjmp .+98 ; 0x9c <__bad_interrupt> + 3a: 00 00 nop + 3c: 2f c0 rjmp .+94 ; 0x9c <__bad_interrupt> + 3e: 00 00 nop + 40: 2d c0 rjmp .+90 ; 0x9c <__bad_interrupt> + 42: 00 00 nop + 44: 2b c0 rjmp .+86 ; 0x9c <__bad_interrupt> + 46: 00 00 nop + 48: 29 c0 rjmp .+82 ; 0x9c <__bad_interrupt> + 4a: 00 00 nop + 4c: 27 c0 rjmp .+78 ; 0x9c <__bad_interrupt> + 4e: 00 00 nop + 50: 25 c0 rjmp .+74 ; 0x9c <__bad_interrupt> + 52: 00 00 nop + 54: 23 c0 rjmp .+70 ; 0x9c <__bad_interrupt> + 56: 00 00 nop + 58: 21 c0 rjmp .+66 ; 0x9c <__bad_interrupt> + 5a: 00 00 nop + 5c: 1f c0 rjmp .+62 ; 0x9c <__bad_interrupt> + 5e: 00 00 nop + 60: 1d c0 rjmp .+58 ; 0x9c <__bad_interrupt> + 62: 00 00 nop + 64: 1b c0 rjmp .+54 ; 0x9c <__bad_interrupt> + 66: 00 00 nop + 68: 19 c0 rjmp .+50 ; 0x9c <__bad_interrupt> + 6a: 00 00 nop + 6c: 17 c0 rjmp .+46 ; 0x9c <__bad_interrupt> + 6e: 00 00 nop + 70: 15 c0 rjmp .+42 ; 0x9c <__bad_interrupt> + 72: 00 00 nop + 74: 13 c0 rjmp .+38 ; 0x9c <__bad_interrupt> + 76: 00 00 nop + 78: 11 c0 rjmp .+34 ; 0x9c <__bad_interrupt> + 7a: 00 00 nop + 7c: 0f c0 rjmp .+30 ; 0x9c <__bad_interrupt> + 7e: 00 00 nop + 80: 0d c0 rjmp .+26 ; 0x9c <__bad_interrupt> + 82: 00 00 nop + 84: 0b c0 rjmp .+22 ; 0x9c <__bad_interrupt> + 86: 00 00 nop + 88: 09 c0 rjmp .+18 ; 0x9c <__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: 13 d0 rcall .+38 ; 0xc0
+ 9a: 21 c0 rjmp .+66 ; 0xde <_exit> + +0000009c <__bad_interrupt>: + 9c: b1 cf rjmp .-158 ; 0x0 <__vectors> + +0000009e : + clock value is set. This is used by _delay_ms inside + util/delay.h +Version : DMK, Initial code +*******************************************************************/ +{ + for (int i=0; i + a4: 20 e0 ldi r18, 0x00 ; 0 + a6: 30 e0 ldi r19, 0x00 ; 0 + #else + //round up by default + __ticks_dc = (uint32_t)(ceil(fabs(__tmp))); + #endif + + __builtin_avr_delay_cycles(__ticks_dc); + a8: ef ec ldi r30, 0xCF ; 207 + aa: f7 e0 ldi r31, 0x07 ; 7 + ac: 31 97 sbiw r30, 0x01 ; 1 + ae: f1 f7 brne .-4 ; 0xac + b0: 00 c0 rjmp .+0 ; 0xb2 + b2: 00 00 nop + b4: 2f 5f subi r18, 0xFF ; 255 + b6: 3f 4f sbci r19, 0xFF ; 255 + b8: 28 17 cp r18, r24 + ba: 39 07 cpc r19, r25 + bc: a9 f7 brne .-22 ; 0xa8 + be: 08 95 ret + +000000c0
: + } +} + +int main(void) +{ + DDRD = 0b11111111; // All pins PORTD are set to output + c0: 8f ef ldi r24, 0xFF ; 255 + c2: 81 bb out 0x11, r24 ; 17 + + PORTD = 0b00000001; + c4: 81 e0 ldi r24, 0x01 ; 1 + c6: 82 bb out 0x12, r24 ; 18 + + while (1) + { + PORTD = 0b10000000; + c8: d0 e8 ldi r29, 0x80 ; 128 + wait( 500 ); + PORTD = 0b01000000; + ca: c0 e4 ldi r28, 0x40 ; 64 + + PORTD = 0b00000001; + + while (1) + { + PORTD = 0b10000000; + cc: d2 bb out 0x12, r29 ; 18 + wait( 500 ); + ce: 84 ef ldi r24, 0xF4 ; 244 + d0: 91 e0 ldi r25, 0x01 ; 1 + d2: e5 df rcall .-54 ; 0x9e + PORTD = 0b01000000; + d4: c2 bb out 0x12, r28 ; 18 + wait ( 500 ); + d6: 84 ef ldi r24, 0xF4 ; 244 + d8: 91 e0 ldi r25, 0x01 ; 1 + da: e1 df rcall .-62 ; 0x9e + + } + dc: f7 cf rjmp .-18 ; 0xcc + +000000de <_exit>: + de: f8 94 cli + +000000e0 <__stop_program>: + e0: ff cf rjmp .-2 ; 0xe0 <__stop_program> diff --git a/MIC-Week1/Debug/MIC-Week1.map b/MIC-Week1/Debug/MIC-Week1.map new file mode 100644 index 0000000..5b3c718 --- /dev/null +++ b/MIC-Week1/Debug/MIC-Week1.map @@ -0,0 +1,415 @@ +Archive member included to satisfy reference by file (symbol) + +c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) + C:/Program Files (x86)/Atmel/Studio/7.0/Packs/Atmel/ATmega_DFP/1.0.91/gcc/dev/atmega128/avr51/crtatmega128.o (exit) + +Discarded input sections + + .data 0x00000000 0x0 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/Atmel/ATmega_DFP/1.0.91/gcc/dev/atmega128/avr51/crtatmega128.o + .bss 0x00000000 0x0 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/Atmel/ATmega_DFP/1.0.91/gcc/dev/atmega128/avr51/crtatmega128.o + .text 0x00000000 0x0 main.o + .data 0x00000000 0x0 main.o + .bss 0x00000000 0x0 main.o + .text 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) + .data 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) + .bss 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) + .text.libgcc.mul + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) + .text.libgcc.div + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) + .text.libgcc 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) + .text.libgcc.prologue + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) + .text.libgcc.builtins + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) + .text.libgcc.fmul + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) + .text.libgcc.fixed + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) + +Memory Configuration + +Name Origin Length Attributes +text 0x00000000 0x00020000 xr +data 0x00800100 0x0000ff00 rw !x +eeprom 0x00810000 0x00010000 rw !x +fuse 0x00820000 0x00000400 rw !x +lock 0x00830000 0x00000400 rw !x +signature 0x00840000 0x00000400 rw !x +user_signatures 0x00850000 0x00000400 rw !x +*default* 0x00000000 0xffffffff + +Linker script and memory map + +Address of section .data set to 0x800100 +LOAD C:/Program Files (x86)/Atmel/Studio/7.0/Packs/Atmel/ATmega_DFP/1.0.91/gcc/dev/atmega128/avr51/crtatmega128.o +LOAD main.o +START GROUP +LOAD c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr51\libm.a +END GROUP +START GROUP +LOAD c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a +LOAD c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr51\libm.a +LOAD c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr51\libc.a +LOAD C:/Program Files (x86)/Atmel/Studio/7.0/Packs/Atmel/ATmega_DFP/1.0.91/gcc/dev/atmega128/avr51\libatmega128.a +END GROUP + +.hash + *(.hash) + +.dynsym + *(.dynsym) + +.dynstr + *(.dynstr) + +.gnu.version + *(.gnu.version) + +.gnu.version_d + *(.gnu.version_d) + +.gnu.version_r + *(.gnu.version_r) + +.rel.init + *(.rel.init) + +.rela.init + *(.rela.init) + +.rel.text + *(.rel.text) + *(.rel.text.*) + *(.rel.gnu.linkonce.t*) + +.rela.text + *(.rela.text) + *(.rela.text.*) + *(.rela.gnu.linkonce.t*) + +.rel.fini + *(.rel.fini) + +.rela.fini + *(.rela.fini) + +.rel.rodata + *(.rel.rodata) + *(.rel.rodata.*) + *(.rel.gnu.linkonce.r*) + +.rela.rodata + *(.rela.rodata) + *(.rela.rodata.*) + *(.rela.gnu.linkonce.r*) + +.rel.data + *(.rel.data) + *(.rel.data.*) + *(.rel.gnu.linkonce.d*) + +.rela.data + *(.rela.data) + *(.rela.data.*) + *(.rela.gnu.linkonce.d*) + +.rel.ctors + *(.rel.ctors) + +.rela.ctors + *(.rela.ctors) + +.rel.dtors + *(.rel.dtors) + +.rela.dtors + *(.rela.dtors) + +.rel.got + *(.rel.got) + +.rela.got + *(.rela.got) + +.rel.bss + *(.rel.bss) + +.rela.bss + *(.rela.bss) + +.rel.plt + *(.rel.plt) + +.rela.plt + *(.rela.plt) + +.text 0x00000000 0xe2 + *(.vectors) + .vectors 0x00000000 0x8c C:/Program Files (x86)/Atmel/Studio/7.0/Packs/Atmel/ATmega_DFP/1.0.91/gcc/dev/atmega128/avr51/crtatmega128.o + 0x00000000 __vector_default + 0x00000000 __vectors + *(.vectors) + *(.progmem.gcc*) + 0x0000008c . = ALIGN (0x2) + 0x0000008c __trampolines_start = . + *(.trampolines) + .trampolines 0x0000008c 0x0 linker stubs + *(.trampolines*) + 0x0000008c __trampolines_end = . + *(.progmem*) + 0x0000008c . = ALIGN (0x2) + *(.jumptables) + *(.jumptables*) + *(.lowtext) + *(.lowtext*) + 0x0000008c __ctors_start = . + *(.ctors) + 0x0000008c __ctors_end = . + 0x0000008c __dtors_start = . + *(.dtors) + 0x0000008c __dtors_end = . + SORT(*)(.ctors) + SORT(*)(.dtors) + *(.init0) + .init0 0x0000008c 0x0 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/Atmel/ATmega_DFP/1.0.91/gcc/dev/atmega128/avr51/crtatmega128.o + 0x0000008c __init + *(.init0) + *(.init1) + *(.init1) + *(.init2) + .init2 0x0000008c 0xc C:/Program Files (x86)/Atmel/Studio/7.0/Packs/Atmel/ATmega_DFP/1.0.91/gcc/dev/atmega128/avr51/crtatmega128.o + *(.init2) + *(.init3) + *(.init3) + *(.init4) + *(.init4) + *(.init5) + *(.init5) + *(.init6) + *(.init6) + *(.init7) + *(.init7) + *(.init8) + *(.init8) + *(.init9) + .init9 0x00000098 0x4 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/Atmel/ATmega_DFP/1.0.91/gcc/dev/atmega128/avr51/crtatmega128.o + *(.init9) + *(.text) + .text 0x0000009c 0x2 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/Atmel/ATmega_DFP/1.0.91/gcc/dev/atmega128/avr51/crtatmega128.o + 0x0000009c __vector_22 + 0x0000009c __vector_28 + 0x0000009c __vector_1 + 0x0000009c __vector_32 + 0x0000009c __vector_34 + 0x0000009c __vector_24 + 0x0000009c __vector_12 + 0x0000009c __bad_interrupt + 0x0000009c __vector_6 + 0x0000009c __vector_31 + 0x0000009c __vector_3 + 0x0000009c __vector_23 + 0x0000009c __vector_30 + 0x0000009c __vector_25 + 0x0000009c __vector_11 + 0x0000009c __vector_13 + 0x0000009c __vector_17 + 0x0000009c __vector_19 + 0x0000009c __vector_7 + 0x0000009c __vector_27 + 0x0000009c __vector_5 + 0x0000009c __vector_33 + 0x0000009c __vector_4 + 0x0000009c __vector_9 + 0x0000009c __vector_2 + 0x0000009c __vector_21 + 0x0000009c __vector_15 + 0x0000009c __vector_29 + 0x0000009c __vector_8 + 0x0000009c __vector_26 + 0x0000009c __vector_14 + 0x0000009c __vector_10 + 0x0000009c __vector_16 + 0x0000009c __vector_18 + 0x0000009c __vector_20 + 0x0000009e . = ALIGN (0x2) + *(.text.*) + .text.wait 0x0000009e 0x22 main.o + 0x0000009e wait + .text.main 0x000000c0 0x1e main.o + 0x000000c0 main + 0x000000de . = ALIGN (0x2) + *(.fini9) + .fini9 0x000000de 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) + 0x000000de _exit + 0x000000de exit + *(.fini9) + *(.fini8) + *(.fini8) + *(.fini7) + *(.fini7) + *(.fini6) + *(.fini6) + *(.fini5) + *(.fini5) + *(.fini4) + *(.fini4) + *(.fini3) + *(.fini3) + *(.fini2) + *(.fini2) + *(.fini1) + *(.fini1) + *(.fini0) + .fini0 0x000000de 0x4 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) + *(.fini0) + 0x000000e2 _etext = . + +.data 0x00800100 0x0 load address 0x000000e2 + 0x00800100 PROVIDE (__data_start, .) + *(.data) + *(.data*) + *(.rodata) + *(.rodata*) + *(.gnu.linkonce.d*) + 0x00800100 . = ALIGN (0x2) + 0x00800100 _edata = . + 0x00800100 PROVIDE (__data_end, .) + +.bss 0x00800100 0x0 + 0x00800100 PROVIDE (__bss_start, .) + *(.bss) + *(.bss*) + *(COMMON) + 0x00800100 PROVIDE (__bss_end, .) + 0x000000e2 __data_load_start = LOADADDR (.data) + 0x000000e2 __data_load_end = (__data_load_start + SIZEOF (.data)) + +.noinit 0x00800100 0x0 + 0x00800100 PROVIDE (__noinit_start, .) + *(.noinit*) + 0x00800100 PROVIDE (__noinit_end, .) + 0x00800100 _end = . + 0x00800100 PROVIDE (__heap_start, .) + +.eeprom 0x00810000 0x0 + *(.eeprom*) + 0x00810000 __eeprom_end = . + +.fuse + *(.fuse) + *(.lfuse) + *(.hfuse) + *(.efuse) + +.lock + *(.lock*) + +.signature + *(.signature*) + +.user_signatures + *(.user_signatures*) + +.stab + *(.stab) + +.stabstr + *(.stabstr) + +.stab.excl + *(.stab.excl) + +.stab.exclstr + *(.stab.exclstr) + +.stab.index + *(.stab.index) + +.stab.indexstr + *(.stab.indexstr) + +.comment 0x00000000 0x30 + *(.comment) + .comment 0x00000000 0x30 main.o + 0x31 (size before relaxing) + +.note.gnu.avr.deviceinfo + 0x00000000 0x3c + .note.gnu.avr.deviceinfo + 0x00000000 0x3c C:/Program Files (x86)/Atmel/Studio/7.0/Packs/Atmel/ATmega_DFP/1.0.91/gcc/dev/atmega128/avr51/crtatmega128.o + +.note.gnu.build-id + *(.note.gnu.build-id) + +.debug + *(.debug) + +.line + *(.line) + +.debug_srcinfo + *(.debug_srcinfo) + +.debug_sfnames + *(.debug_sfnames) + +.debug_aranges 0x00000000 0x28 + *(.debug_aranges) + .debug_aranges + 0x00000000 0x28 main.o + +.debug_pubnames + *(.debug_pubnames) + +.debug_info 0x00000000 0x17b + *(.debug_info .gnu.linkonce.wi.*) + .debug_info 0x00000000 0x17b main.o + +.debug_abbrev 0x00000000 0x115 + *(.debug_abbrev) + .debug_abbrev 0x00000000 0x115 main.o + +.debug_line 0x00000000 0x173 + *(.debug_line .debug_line.* .debug_line_end) + .debug_line 0x00000000 0x173 main.o + +.debug_frame 0x00000000 0x34 + *(.debug_frame) + .debug_frame 0x00000000 0x34 main.o + +.debug_str 0x00000000 0x17c + *(.debug_str) + .debug_str 0x00000000 0x17c main.o + 0x1b0 (size before relaxing) + +.debug_loc 0x00000000 0x6a + *(.debug_loc) + .debug_loc 0x00000000 0x6a main.o + +.debug_macinfo + *(.debug_macinfo) + +.debug_weaknames + *(.debug_weaknames) + +.debug_funcnames + *(.debug_funcnames) + +.debug_typenames + *(.debug_typenames) + +.debug_varnames + *(.debug_varnames) + +.debug_pubtypes + *(.debug_pubtypes) + +.debug_ranges 0x00000000 0x18 + *(.debug_ranges) + .debug_ranges 0x00000000 0x18 main.o + +.debug_macro + *(.debug_macro) +OUTPUT(MIC-Week1.elf elf32-avr) +LOAD linker stubs diff --git a/MIC-Week1/Debug/MIC-Week1.srec b/MIC-Week1/Debug/MIC-Week1.srec new file mode 100644 index 0000000..52786b3 --- /dev/null +++ b/MIC-Week1/Debug/MIC-Week1.srec @@ -0,0 +1,17 @@ +S01100004D49432D5765656B312E7372656350 +S113000045C000004BC0000049C0000047C00000CC +S113001045C0000043C0000041C000003FC00000D4 +S11300203DC000003BC0000039C0000037C00000E4 +S113003035C0000033C0000031C000002FC00000F4 +S11300402DC000002BC0000029C0000027C0000004 +S113005025C0000023C0000021C000001FC0000014 +S11300601DC000001BC0000019C0000017C0000024 +S113007015C0000013C0000011C000000FC0000034 +S11300800DC000000BC0000009C0000011241FBEF9 +S1130090CFEFD0E1DEBFCDBF13D021C0B1CF181652 +S11300A019066CF420E030E0EFECF7E03197F1F75B +S11300B000C000002F5F3F4F28173907A9F70895A4 +S11300C08FEF81BB81E082BBD0E8C0E4D2BB84EF78 +S11300D091E0E5DFC2BB84EF91E0E1DFF7CFF89474 +S10500E0FFCF4C +S9030000FC diff --git a/MIC-Week1/Debug/Makefile b/MIC-Week1/Debug/Makefile new file mode 100644 index 0000000..84f1fec --- /dev/null +++ b/MIC-Week1/Debug/Makefile @@ -0,0 +1,129 @@ +################################################################################ +# 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 +=MIC-Week1.elf + +OUTPUT_FILE_PATH_AS_ARGS +=MIC-Week1.elf + +ADDITIONAL_DEPENDENCIES:= + +OUTPUT_FILE_DEP:= ./makedep.mk + +LIB_DEP+= + +LINKER_SCRIPT_DEP+= + + +# AVR32/GNU C Compiler + + + +./%.o: .././%.c + @echo Building file: $< + @echo Invoking: AVR/GNU C Compiler : 4.9.2 + $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\Atmel\ATmega_DFP\1.0.91\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atmega128 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\Atmel\ATmega_DFP\1.0.91\gcc\dev\atmega128" -c -std=gnu99 -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: AVR/GNU Linker : 4.9.2 + $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS) -Wl,-Map="MIC-Week1.map" -Wl,--start-group -Wl,-lm -Wl,--end-group -Wl,--gc-sections -mrelax -mmcu=atmega128 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\Atmel\ATmega_DFP\1.0.91\gcc\dev\atmega128" + @echo Finished building target: $@ + "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "MIC-Week1.elf" "MIC-Week1.hex" + "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex "MIC-Week1.elf" "MIC-Week1.eep" || exit 0 + "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objdump.exe" -h -S "MIC-Week1.elf" > "MIC-Week1.lss" + "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O srec -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "MIC-Week1.elf" "MIC-Week1.srec" + "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-size.exe" "MIC-Week1.elf" + + + + + + + +# Other Targets +clean: + -$(RM) $(OBJS_AS_ARGS) $(EXECUTABLES) + -$(RM) $(C_DEPS_AS_ARGS) + rm -rf "MIC-Week1.elf" "MIC-Week1.a" "MIC-Week1.hex" "MIC-Week1.lss" "MIC-Week1.eep" "MIC-Week1.map" "MIC-Week1.srec" "MIC-Week1.usersignatures" + \ No newline at end of file diff --git a/MIC-Week1/Debug/main.d b/MIC-Week1/Debug/main.d new file mode 100644 index 0000000..affe786 --- /dev/null +++ b/MIC-Week1/Debug/main.d @@ -0,0 +1,43 @@ +main.d main.o: .././main.c \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\4.9.2\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h \ + C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\Atmel\ATmega_DFP\1.0.91\include/avr/iom128.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\4.9.2\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h: + +C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\Atmel\ATmega_DFP\1.0.91\include/avr/iom128.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h: diff --git a/MIC-Week1/Debug/makedep.mk b/MIC-Week1/Debug/makedep.mk new file mode 100644 index 0000000..6a14fde --- /dev/null +++ b/MIC-Week1/Debug/makedep.mk @@ -0,0 +1,6 @@ +################################################################################ +# Automatically-generated file. Do not edit or delete the file +################################################################################ + +main.c + diff --git a/MIC-Week1/MIC-Week1.cproj b/MIC-Week1/MIC-Week1.cproj index 40d17c0..f2c85a2 100644 --- a/MIC-Week1/MIC-Week1.cproj +++ b/MIC-Week1/MIC-Week1.cproj @@ -20,12 +20,12 @@ false true true - + 0x20000000 true - + exception_table 2 - 1 + 0 @@ -38,6 +38,19 @@ + com.atmel.avrdbg.tool.simulator + + 0x1E9702 + + + + + + com.atmel.avrdbg.tool.simulator + + + Simulator + diff --git a/MIC-Week1/main.c b/MIC-Week1/main.c index 7411d3d..cb7a4a9 100644 --- a/MIC-Week1/main.c +++ b/MIC-Week1/main.c @@ -5,14 +5,44 @@ * Author : kenny */ -#include +#define F_CPU 8000000UL +#include +#include + +/******************************************************************/ +void wait( int ms ) +/* +short: Busy wait number of millisecs +inputs: int ms (Number of millisecs to busy wait) +outputs: +notes: Busy wait, not very accurate. Make sure (external) + clock value is set. This is used by _delay_ms inside + util/delay.h +Version : DMK, Initial code +*******************************************************************/ +{ + for (int i=0; i Date: Tue, 2 Feb 2016 14:55:04 +0100 Subject: [PATCH 2/6] opgave 1 --- MIC-Week1/Debug/MIC-Week1.lss | 77 ++++++++++++++++------------------ MIC-Week1/Debug/MIC-Week1.map | 36 ++++++++-------- MIC-Week1/Debug/MIC-Week1.srec | 6 +-- MIC-Week1/main.c | 16 +++---- 4 files changed, 68 insertions(+), 67 deletions(-) diff --git a/MIC-Week1/Debug/MIC-Week1.lss b/MIC-Week1/Debug/MIC-Week1.lss index 56d3a86..03d21a7 100644 --- a/MIC-Week1/Debug/MIC-Week1.lss +++ b/MIC-Week1/Debug/MIC-Week1.lss @@ -11,21 +11,21 @@ Idx Name Size VMA LMA File off Algn CONTENTS, READONLY 3 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00000168 2**2 CONTENTS, READONLY - 4 .debug_aranges 00000028 00000000 00000000 000001a4 2**0 + 4 .debug_aranges 00000030 00000000 00000000 000001a4 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_info 0000017b 00000000 00000000 000001cc 2**0 + 5 .debug_info 000001bc 00000000 00000000 000001d4 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_abbrev 00000115 00000000 00000000 00000347 2**0 + 6 .debug_abbrev 00000138 00000000 00000000 00000390 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_line 00000173 00000000 00000000 0000045c 2**0 + 7 .debug_line 0000016b 00000000 00000000 000004c8 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_frame 00000034 00000000 00000000 000005d0 2**2 + 8 .debug_frame 00000044 00000000 00000000 00000634 2**2 CONTENTS, READONLY, DEBUGGING - 9 .debug_str 0000017c 00000000 00000000 00000604 2**0 + 9 .debug_str 00000184 00000000 00000000 00000678 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_loc 0000006a 00000000 00000000 00000780 2**0 + 10 .debug_loc 0000006a 00000000 00000000 000007fc 2**0 CONTENTS, READONLY, DEBUGGING - 11 .debug_ranges 00000018 00000000 00000000 000007ea 2**0 + 11 .debug_ranges 00000020 00000000 00000000 00000866 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -109,7 +109,7 @@ Disassembly of section .text: 92: d0 e1 ldi r29, 0x10 ; 16 94: de bf out 0x3e, r29 ; 62 96: cd bf out 0x3d, r28 ; 61 - 98: 13 d0 rcall .+38 ; 0xc0
+ 98: 1e d0 rcall .+60 ; 0xd6
9a: 21 c0 rjmp .+66 ; 0xde <_exit> 0000009c <__bad_interrupt>: @@ -146,47 +146,44 @@ Version : DMK, Initial code bc: a9 f7 brne .-22 ; 0xa8 be: 08 95 ret -000000c0
: +000000c0 : + return 1; +} + +void opgave1(void) +{ + PORTD = 0b10000000; + c0: 80 e8 ldi r24, 0x80 ; 128 + c2: 82 bb out 0x12, r24 ; 18 + wait( 500 ); + c4: 84 ef ldi r24, 0xF4 ; 244 + c6: 91 e0 ldi r25, 0x01 ; 1 + c8: ea df rcall .-44 ; 0x9e + PORTD = 0b01000000; + ca: 80 e4 ldi r24, 0x40 ; 64 + cc: 82 bb out 0x12, r24 ; 18 + wait ( 500 ); + ce: 84 ef ldi r24, 0xF4 ; 244 + d0: 91 e0 ldi r25, 0x01 ; 1 + d2: e5 cf rjmp .-54 ; 0x9e + d4: 08 95 ret + +000000d6
: } } int main(void) { DDRD = 0b11111111; // All pins PORTD are set to output - c0: 8f ef ldi r24, 0xFF ; 255 - c2: 81 bb out 0x11, r24 ; 17 - - PORTD = 0b00000001; - c4: 81 e0 ldi r24, 0x01 ; 1 - c6: 82 bb out 0x12, r24 ; 18 + d6: 8f ef ldi r24, 0xFF ; 255 + d8: 81 bb out 0x11, r24 ; 17 while (1) { - PORTD = 0b10000000; - c8: d0 e8 ldi r29, 0x80 ; 128 - wait( 500 ); - PORTD = 0b01000000; - ca: c0 e4 ldi r28, 0x40 ; 64 - - PORTD = 0b00000001; - - while (1) - { - PORTD = 0b10000000; - cc: d2 bb out 0x12, r29 ; 18 - wait( 500 ); - ce: 84 ef ldi r24, 0xF4 ; 244 - d0: 91 e0 ldi r25, 0x01 ; 1 - d2: e5 df rcall .-54 ; 0x9e - PORTD = 0b01000000; - d4: c2 bb out 0x12, r28 ; 18 - wait ( 500 ); - d6: 84 ef ldi r24, 0xF4 ; 244 - d8: 91 e0 ldi r25, 0x01 ; 1 - da: e1 df rcall .-62 ; 0x9e - + opgave1( ); + da: f2 df rcall .-28 ; 0xc0 } - dc: f7 cf rjmp .-18 ; 0xcc + dc: fe cf rjmp .-4 ; 0xda 000000de <_exit>: de: f8 94 cli diff --git a/MIC-Week1/Debug/MIC-Week1.map b/MIC-Week1/Debug/MIC-Week1.map index 5b3c718..f3b9a0b 100644 --- a/MIC-Week1/Debug/MIC-Week1.map +++ b/MIC-Week1/Debug/MIC-Week1.map @@ -236,8 +236,10 @@ END GROUP *(.text.*) .text.wait 0x0000009e 0x22 main.o 0x0000009e wait - .text.main 0x000000c0 0x1e main.o - 0x000000c0 main + .text.opgave1 0x000000c0 0x16 main.o + 0x000000c0 opgave1 + .text.main 0x000000d6 0x8 main.o + 0x000000d6 main 0x000000de . = ALIGN (0x2) *(.fini9) .fini9 0x000000de 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) @@ -354,34 +356,34 @@ END GROUP .debug_sfnames *(.debug_sfnames) -.debug_aranges 0x00000000 0x28 +.debug_aranges 0x00000000 0x30 *(.debug_aranges) .debug_aranges - 0x00000000 0x28 main.o + 0x00000000 0x30 main.o .debug_pubnames *(.debug_pubnames) -.debug_info 0x00000000 0x17b +.debug_info 0x00000000 0x1bc *(.debug_info .gnu.linkonce.wi.*) - .debug_info 0x00000000 0x17b main.o + .debug_info 0x00000000 0x1bc main.o -.debug_abbrev 0x00000000 0x115 +.debug_abbrev 0x00000000 0x138 *(.debug_abbrev) - .debug_abbrev 0x00000000 0x115 main.o + .debug_abbrev 0x00000000 0x138 main.o -.debug_line 0x00000000 0x173 +.debug_line 0x00000000 0x16b *(.debug_line .debug_line.* .debug_line_end) - .debug_line 0x00000000 0x173 main.o + .debug_line 0x00000000 0x16b main.o -.debug_frame 0x00000000 0x34 +.debug_frame 0x00000000 0x44 *(.debug_frame) - .debug_frame 0x00000000 0x34 main.o + .debug_frame 0x00000000 0x44 main.o -.debug_str 0x00000000 0x17c +.debug_str 0x00000000 0x184 *(.debug_str) - .debug_str 0x00000000 0x17c main.o - 0x1b0 (size before relaxing) + .debug_str 0x00000000 0x184 main.o + 0x1b8 (size before relaxing) .debug_loc 0x00000000 0x6a *(.debug_loc) @@ -405,9 +407,9 @@ END GROUP .debug_pubtypes *(.debug_pubtypes) -.debug_ranges 0x00000000 0x18 +.debug_ranges 0x00000000 0x20 *(.debug_ranges) - .debug_ranges 0x00000000 0x18 main.o + .debug_ranges 0x00000000 0x20 main.o .debug_macro *(.debug_macro) diff --git a/MIC-Week1/Debug/MIC-Week1.srec b/MIC-Week1/Debug/MIC-Week1.srec index 52786b3..1ed338a 100644 --- a/MIC-Week1/Debug/MIC-Week1.srec +++ b/MIC-Week1/Debug/MIC-Week1.srec @@ -8,10 +8,10 @@ S113005025C0000023C0000021C000001FC0000014 S11300601DC000001BC0000019C0000017C0000024 S113007015C0000013C0000011C000000FC0000034 S11300800DC000000BC0000009C0000011241FBEF9 -S1130090CFEFD0E1DEBFCDBF13D021C0B1CF181652 +S1130090CFEFD0E1DEBFCDBF1ED021C0B1CF181647 S11300A019066CF420E030E0EFECF7E03197F1F75B S11300B000C000002F5F3F4F28173907A9F70895A4 -S11300C08FEF81BB81E082BBD0E8C0E4D2BB84EF78 -S11300D091E0E5DFC2BB84EF91E0E1DFF7CFF89474 +S11300C080E882BB84EF91E0EADF80E482BB84EFC6 +S11300D091E0E5CF08958FEF81BBF2DFFECFF89476 S10500E0FFCF4C S9030000FC diff --git a/MIC-Week1/main.c b/MIC-Week1/main.c index cb7a4a9..37f6434 100644 --- a/MIC-Week1/main.c +++ b/MIC-Week1/main.c @@ -32,17 +32,19 @@ int main(void) { DDRD = 0b11111111; // All pins PORTD are set to output - PORTD = 0b00000001; - while (1) { - PORTD = 0b10000000; - wait( 500 ); - PORTD = 0b01000000; - wait ( 500 ); - + opgave1( ); } return 1; } +void opgave1(void) +{ + PORTD = 0b10000000; + wait( 500 ); + PORTD = 0b01000000; + wait ( 500 ); +} + From 88f86376ddde04bb7874316df43ecb78306306e1 Mon Sep 17 00:00:00 2001 From: Kenneth van Ewijk Date: Tue, 2 Feb 2016 15:57:02 +0100 Subject: [PATCH 3/6] opgave 4 en speaker --- MIC-Week1/Debug/MIC-Week1.lss | 120 ++++++++++++++++++--------------- MIC-Week1/Debug/MIC-Week1.map | 64 +++++++++--------- MIC-Week1/Debug/MIC-Week1.srec | 8 +-- MIC-Week1/main.c | 40 ++++++++++- 4 files changed, 141 insertions(+), 91 deletions(-) diff --git a/MIC-Week1/Debug/MIC-Week1.lss b/MIC-Week1/Debug/MIC-Week1.lss index 03d21a7..1e76538 100644 --- a/MIC-Week1/Debug/MIC-Week1.lss +++ b/MIC-Week1/Debug/MIC-Week1.lss @@ -3,29 +3,29 @@ MIC-Week1.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .data 00000000 00800100 00800100 00000136 2**0 + 0 .data 00000000 00800100 00800100 0000013e 2**0 CONTENTS, ALLOC, LOAD, DATA - 1 .text 000000e2 00000000 00000000 00000054 2**1 + 1 .text 000000ea 00000000 00000000 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 2 .comment 00000030 00000000 00000000 00000136 2**0 + 2 .comment 00000030 00000000 00000000 0000013e 2**0 CONTENTS, READONLY - 3 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00000168 2**2 + 3 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00000170 2**2 CONTENTS, READONLY - 4 .debug_aranges 00000030 00000000 00000000 000001a4 2**0 + 4 .debug_aranges 00000040 00000000 00000000 000001ac 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_info 000001bc 00000000 00000000 000001d4 2**0 + 5 .debug_info 00000242 00000000 00000000 000001ec 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_abbrev 00000138 00000000 00000000 00000390 2**0 + 6 .debug_abbrev 00000161 00000000 00000000 0000042e 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_line 0000016b 00000000 00000000 000004c8 2**0 + 7 .debug_line 000001cf 00000000 00000000 0000058f 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_frame 00000044 00000000 00000000 00000634 2**2 + 8 .debug_frame 00000070 00000000 00000000 00000760 2**2 CONTENTS, READONLY, DEBUGGING - 9 .debug_str 00000184 00000000 00000000 00000678 2**0 + 9 .debug_str 00000194 00000000 00000000 000007d0 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_loc 0000006a 00000000 00000000 000007fc 2**0 + 10 .debug_loc 000000cf 00000000 00000000 00000964 2**0 CONTENTS, READONLY, DEBUGGING - 11 .debug_ranges 00000020 00000000 00000000 00000866 2**0 + 11 .debug_ranges 00000030 00000000 00000000 00000a33 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -109,30 +109,24 @@ Disassembly of section .text: 92: d0 e1 ldi r29, 0x10 ; 16 94: de bf out 0x3e, r29 ; 62 96: cd bf out 0x3d, r28 ; 61 - 98: 1e d0 rcall .+60 ; 0xd6
- 9a: 21 c0 rjmp .+66 ; 0xde <_exit> + 98: 1f d0 rcall .+62 ; 0xd8
+ 9a: 25 c0 rjmp .+74 ; 0xe6 <_exit> 0000009c <__bad_interrupt>: 9c: b1 cf rjmp .-158 ; 0x0 <__vectors> 0000009e : - clock value is set. This is used by _delay_ms inside - util/delay.h -Version : DMK, Initial code -*******************************************************************/ +void opgave1(void) { - for (int i=0; i a4: 20 e0 ldi r18, 0x00 ; 0 a6: 30 e0 ldi r19, 0x00 ; 0 - #else - //round up by default - __ticks_dc = (uint32_t)(ceil(fabs(__tmp))); - #endif - - __builtin_avr_delay_cycles(__ticks_dc); a8: ef ec ldi r30, 0xCF ; 207 aa: f7 e0 ldi r31, 0x07 ; 7 ac: 31 97 sbiw r30, 0x01 ; 1 @@ -146,47 +140,65 @@ Version : DMK, Initial code bc: a9 f7 brne .-22 ; 0xa8 be: 08 95 ret -000000c0 : - return 1; +000000c0 : } -void opgave1(void) +void opgave4(void) { - PORTD = 0b10000000; - c0: 80 e8 ldi r24, 0x80 ; 128 - c2: 82 bb out 0x12, r24 ; 18 - wait( 500 ); - c4: 84 ef ldi r24, 0xF4 ; 244 - c6: 91 e0 ldi r25, 0x01 ; 1 - c8: ea df rcall .-44 ; 0x9e - PORTD = 0b01000000; - ca: 80 e4 ldi r24, 0x40 ; 64 - cc: 82 bb out 0x12, r24 ; 18 - wait ( 500 ); - ce: 84 ef ldi r24, 0xF4 ; 244 - d0: 91 e0 ldi r25, 0x01 ; 1 - d2: e5 cf rjmp .-54 ; 0x9e - d4: 08 95 ret + wait( 50 ); + c0: 82 e3 ldi r24, 0x32 ; 50 + c2: 90 e0 ldi r25, 0x00 ; 0 + c4: ec df rcall .-40 ; 0x9e + if (PORTC>= 0x80) + c6: af 9b sbis 0x15, 7 ; 21 + c8: 03 c0 rjmp .+6 ; 0xd0 + { + PORTC= 0x1; + ca: 81 e0 ldi r24, 0x01 ; 1 + cc: 85 bb out 0x15, r24 ; 21 + ce: 08 95 ret + } + else + { + PORTC = (PORTC<<1); + d0: 85 b3 in r24, 0x15 ; 21 + d2: 88 0f add r24, r24 + d4: 85 bb out 0x15, r24 ; 21 + d6: 08 95 ret -000000d6
: +000000d8
: } } int main(void) { - DDRD = 0b11111111; // All pins PORTD are set to output - d6: 8f ef ldi r24, 0xFF ; 255 - d8: 81 bb out 0x11, r24 ; 17 + DDRD = 0b00000000; //input + d8: 11 ba out 0x11, r1 ; 17 + DDRC = 0b11111111; //output + da: 8f ef ldi r24, 0xFF ; 255 + dc: 84 bb out 0x14, r24 ; 20 + //Alleen voor opgave 4 + PORTC = 0x1; + de: 81 e0 ldi r24, 0x01 ; 1 + e0: 85 bb out 0x15, r24 ; 21 while (1) { - opgave1( ); - da: f2 df rcall .-28 ; 0xc0 + //opgave1(); + //opgave2(); + //opgave3(); + opgave4(); + e2: ee df rcall .-36 ; 0xc0 + if( (PIND) != 0 ) + { + speaker( PIND ); + } + */ } - dc: fe cf rjmp .-4 ; 0xda + e4: fe cf rjmp .-4 ; 0xe2 -000000de <_exit>: - de: f8 94 cli +000000e6 <_exit>: + e6: f8 94 cli -000000e0 <__stop_program>: - e0: ff cf rjmp .-2 ; 0xe0 <__stop_program> +000000e8 <__stop_program>: + e8: ff cf rjmp .-2 ; 0xe8 <__stop_program> diff --git a/MIC-Week1/Debug/MIC-Week1.map b/MIC-Week1/Debug/MIC-Week1.map index f3b9a0b..aac5e35 100644 --- a/MIC-Week1/Debug/MIC-Week1.map +++ b/MIC-Week1/Debug/MIC-Week1.map @@ -10,6 +10,8 @@ Discarded input sections .text 0x00000000 0x0 main.o .data 0x00000000 0x0 main.o .bss 0x00000000 0x0 main.o + .text.speaker 0x00000000 0x1e main.o + .text.opgave1 0x00000000 0x1a main.o .text 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) .data 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) .bss 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) @@ -144,7 +146,7 @@ END GROUP .rela.plt *(.rela.plt) -.text 0x00000000 0xe2 +.text 0x00000000 0xea *(.vectors) .vectors 0x00000000 0x8c C:/Program Files (x86)/Atmel/Studio/7.0/Packs/Atmel/ATmega_DFP/1.0.91/gcc/dev/atmega128/avr51/crtatmega128.o 0x00000000 __vector_default @@ -236,15 +238,15 @@ END GROUP *(.text.*) .text.wait 0x0000009e 0x22 main.o 0x0000009e wait - .text.opgave1 0x000000c0 0x16 main.o - 0x000000c0 opgave1 - .text.main 0x000000d6 0x8 main.o - 0x000000d6 main - 0x000000de . = ALIGN (0x2) + .text.opgave4 0x000000c0 0x18 main.o + 0x000000c0 opgave4 + .text.main 0x000000d8 0xe main.o + 0x000000d8 main + 0x000000e6 . = ALIGN (0x2) *(.fini9) - .fini9 0x000000de 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) - 0x000000de _exit - 0x000000de exit + .fini9 0x000000e6 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) + 0x000000e6 _exit + 0x000000e6 exit *(.fini9) *(.fini8) *(.fini8) @@ -263,11 +265,11 @@ END GROUP *(.fini1) *(.fini1) *(.fini0) - .fini0 0x000000de 0x4 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) + .fini0 0x000000e6 0x4 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) *(.fini0) - 0x000000e2 _etext = . + 0x000000ea _etext = . -.data 0x00800100 0x0 load address 0x000000e2 +.data 0x00800100 0x0 load address 0x000000ea 0x00800100 PROVIDE (__data_start, .) *(.data) *(.data*) @@ -284,8 +286,8 @@ END GROUP *(.bss*) *(COMMON) 0x00800100 PROVIDE (__bss_end, .) - 0x000000e2 __data_load_start = LOADADDR (.data) - 0x000000e2 __data_load_end = (__data_load_start + SIZEOF (.data)) + 0x000000ea __data_load_start = LOADADDR (.data) + 0x000000ea __data_load_end = (__data_load_start + SIZEOF (.data)) .noinit 0x00800100 0x0 0x00800100 PROVIDE (__noinit_start, .) @@ -356,38 +358,38 @@ END GROUP .debug_sfnames *(.debug_sfnames) -.debug_aranges 0x00000000 0x30 +.debug_aranges 0x00000000 0x40 *(.debug_aranges) .debug_aranges - 0x00000000 0x30 main.o + 0x00000000 0x40 main.o .debug_pubnames *(.debug_pubnames) -.debug_info 0x00000000 0x1bc +.debug_info 0x00000000 0x242 *(.debug_info .gnu.linkonce.wi.*) - .debug_info 0x00000000 0x1bc main.o + .debug_info 0x00000000 0x242 main.o -.debug_abbrev 0x00000000 0x138 +.debug_abbrev 0x00000000 0x161 *(.debug_abbrev) - .debug_abbrev 0x00000000 0x138 main.o + .debug_abbrev 0x00000000 0x161 main.o -.debug_line 0x00000000 0x16b +.debug_line 0x00000000 0x1cf *(.debug_line .debug_line.* .debug_line_end) - .debug_line 0x00000000 0x16b main.o + .debug_line 0x00000000 0x1cf main.o -.debug_frame 0x00000000 0x44 +.debug_frame 0x00000000 0x70 *(.debug_frame) - .debug_frame 0x00000000 0x44 main.o + .debug_frame 0x00000000 0x70 main.o -.debug_str 0x00000000 0x184 +.debug_str 0x00000000 0x194 *(.debug_str) - .debug_str 0x00000000 0x184 main.o - 0x1b8 (size before relaxing) + .debug_str 0x00000000 0x194 main.o + 0x1c8 (size before relaxing) -.debug_loc 0x00000000 0x6a +.debug_loc 0x00000000 0xcf *(.debug_loc) - .debug_loc 0x00000000 0x6a main.o + .debug_loc 0x00000000 0xcf main.o .debug_macinfo *(.debug_macinfo) @@ -407,9 +409,9 @@ END GROUP .debug_pubtypes *(.debug_pubtypes) -.debug_ranges 0x00000000 0x20 +.debug_ranges 0x00000000 0x30 *(.debug_ranges) - .debug_ranges 0x00000000 0x20 main.o + .debug_ranges 0x00000000 0x30 main.o .debug_macro *(.debug_macro) diff --git a/MIC-Week1/Debug/MIC-Week1.srec b/MIC-Week1/Debug/MIC-Week1.srec index 1ed338a..ba7a536 100644 --- a/MIC-Week1/Debug/MIC-Week1.srec +++ b/MIC-Week1/Debug/MIC-Week1.srec @@ -8,10 +8,10 @@ S113005025C0000023C0000021C000001FC0000014 S11300601DC000001BC0000019C0000017C0000024 S113007015C0000013C0000011C000000FC0000034 S11300800DC000000BC0000009C0000011241FBEF9 -S1130090CFEFD0E1DEBFCDBF1ED021C0B1CF181647 +S1130090CFEFD0E1DEBFCDBF1FD025C0B1CF181642 S11300A019066CF420E030E0EFECF7E03197F1F75B S11300B000C000002F5F3F4F28173907A9F70895A4 -S11300C080E882BB84EF91E0EADF80E482BB84EFC6 -S11300D091E0E5CF08958FEF81BBF2DFFECFF89476 -S10500E0FFCF4C +S11300C082E390E0ECDFAF9B03C081E085BB089541 +S11300D085B3880F85BB089511BA8FEF84BB81E087 +S10D00E085BBEEDFFECFF894FFCFDE S9030000FC diff --git a/MIC-Week1/main.c b/MIC-Week1/main.c index 37f6434..618a745 100644 --- a/MIC-Week1/main.c +++ b/MIC-Week1/main.c @@ -30,16 +30,39 @@ Version : DMK, Initial code int main(void) { - DDRD = 0b11111111; // All pins PORTD are set to output + DDRD = 0b00000000; //input + DDRC = 0b11111111; //output + + //Alleen voor opgave 4 + PORTC = 0x1; while (1) { - opgave1( ); + //opgave1(); + //opgave2(); + //opgave3(); + opgave4(); + + /* + if( (PIND) != 0 ) + { + speaker( PIND ); + } + */ } return 1; } +void speaker(int i) +{ + //PORTC moet hiervoor output zijn en PORTD input + PORTC = 0b01010101; + wait( i ); + PORTC = 0b00000000; + wait( i ); +} + void opgave1(void) { PORTD = 0b10000000; @@ -48,3 +71,16 @@ void opgave1(void) wait ( 500 ); } +void opgave4(void) +{ + wait( 50 ); + if (PORTC>= 0x80) + { + PORTC= 0x1; + } + else + { + PORTC = (PORTC<<1); + } +} + From 548e467e25742da69109962fb86c4cf8e12c1e2e Mon Sep 17 00:00:00 2001 From: Kenneth van Ewijk Date: Tue, 2 Feb 2016 17:36:55 +0100 Subject: [PATCH 4/6] Added opgave6 with interrupts --- MIC-Week1/.vs/MIC-Week1/v14/.atsuo | Bin 10240 -> 19456 bytes MIC-Week1/Debug/MIC-Week1.lss | 372 +++++++++++++++++++---------- MIC-Week1/Debug/MIC-Week1.map | 222 ++++++++++------- MIC-Week1/Debug/MIC-Week1.srec | 51 ++-- MIC-Week1/Debug/main.d | 3 + MIC-Week1/main.c | 158 ++++++++++-- 6 files changed, 567 insertions(+), 239 deletions(-) diff --git a/MIC-Week1/.vs/MIC-Week1/v14/.atsuo b/MIC-Week1/.vs/MIC-Week1/v14/.atsuo index fecfe895528282bcc77b9cb0da7f14bed95115f1..e86099e9846b2a2e2e4ce80234dccf58a2006344 100644 GIT binary patch delta 2916 zcmds3O>7&-72cJppURYENs%Kbc4Wbp-G*to6#pGN(UME7ghLs6cxu(wy2u4lM%oQlP!mMP(py-^ilMwD7H` zKH}rdyqPyM@4asx_MUw2N8}G~lcooEj>rR3m|Q{Irmf|@*b}X@ecC7IHW2Gf>8@8GQOs=yteG#n0G7AenhjwzG zFAzEN`Xy}kU$??rq1xs((>(MZM62Y%CKbj$W7`#IF923g$5@A*#qBh(&v<9-HxA+z zz+@hMXLECW0~9v_Up<|86x|7+b(zoT>ci@uGA> z3m@v8mzIbPn4OtgVW(kW0$_;~C89~lM4o699q4z6F7)d}7XBGPAH1Xp3$X9fg;$9g z5)%anaB|$irfC81gXLiH^0@#pK=$G@ZSq^mf(I+MW{mS$U@|)`WfB>?>jBv<(p{l<|Fj&oA*9kyZHZ@^TmJX9P<3x zB+t`thkQ<+BjyPkaLi5^@tma3o+KR|Z}3YbCjTp^vBoy2d+}pT7(|&&J7$~(5E%&3 zAj&|2EKmYd0nKb~qW;!7xwwN40%fet49j^-JuRsq|V=@IyL4&oh89({0 zDLuJ?9^kbL17X)-78i?&2P&&t(A}E#E~StXwzain93Sd6GcK=fM;g32cT1$Lhoj zbJ)E8ANskkf#Pqo=!uy(pNB3kK3}p~5|)Uopu|;bGBJna@U0p2WPOD8woE@6yg-tN zXt)6nW}dR+8%^HU|KOQE9GKoA4`2Gtj1xzOA_gZfn}Xi6-)m3@aLRR<#R11FD5!g< zTJ)#O_Jb=XI}XURsfpp#qUV_2H*JII!|;`#&XAv?e{6mCSur?2RSeMES4ZfNCfDKi zy_p$^<6GB$ca9_&^!;mh(c$&{+y@I32-@CRN7kKa$Vrns<>d^Dy zAszM88g2_7tG9?d^u82Rs1V)mII^xNRw(tTYJ=7OLD}egw5W=ed^S)_Weu8UIwB0+ z44uvOTP!vZgqW)M5=>FvPe@}a?UQ^#*|D2Rg?r6PHC`HO#cnQE>sHuS!yjstD!HyZ zM(F~r=bJuF4rGj`UvgFQzCgbn%>@~o%VP`mLR{Z)rfH{8@+5_U5)RgP+c92`rERQY zO?3-)zU<9e^GtUny2ZRT;&r=iN|YOyv|+mFv&XY3mD$$MCdK_ah+(<0*0Fie@B5yI9~;vQa_xhqPGM+VIpGmU1#&C>v>|mTvakl+TcPOU*H&#by9v=vEmqP_1T! zY%xYjsZqml?T?yv+9jo30mEjCMI0Gb=OV^95@h|nGRo$gqo8gp6p~iUzDkLjJn%D7 zN5E0@b-GM!II4Gq@E{uQ$yN)??&dg8q%4F|hKCais+%oTVxuP2YBZZ_%9h=Yr(!f~ z)0*Klvm4L0cYU1F;j(&}cSg9OOXT}ZXSc`(=&EC^H7jzR)g6+}SBsYXsexv12TOXe z-=p$LD$Qgf{$gA*3{FaFde&R2P%N)g{!Bp(YgWBwbutB`lc;iuOm1MY=xUs@iVZdC z&#@`LGZv2mRnrwZpL1wck2u`dL#}uyT;oeAV`PtM_HoWyl3SH_I^eVCT>>RE{3Var z>G{h0Bga6Ot6hJgYUA>i5u-7&fH&?*Hr1%u@;7@KAw`GEe6U%wN0Z)ig7svS6dfD5 zbw=q9i&n)*8$-$H+6G~z5y~h`qMI&je8)ydTM0Gbb6NUgd0edy_uYC?9hTy4B`G9> zBVnk^*#u(6*Li&UEV3s6t!luF|W=iXJ){WZ@~oo8}eO8E98{UDxm6k0=6vrJczpLBi)v?`&*- p^gZa~I)&cfxqEnHk6iui*MI)>#$SixTa^V(c<&GInxK?h{{?Q0j79(e delta 477 zcmY+A%Syvg5QZ~pdQne$Q`>@tRx6@znlu$$SOnWmFQ~mBu&k6TN5rU~xaSJ1H3c z@c5AsqdafxrKC65>AnnRq%=+QOupCK+|1hiRx)_5_mmW7kqR1+!)|2M&m&YMY*><# zW#GQV8O0d`agYEjU=@5LCz!Y=K?^V&X_tqS}> TV|`GLU3(OjnbZCv6VLquKn9dC diff --git a/MIC-Week1/Debug/MIC-Week1.lss b/MIC-Week1/Debug/MIC-Week1.lss index 1e76538..53b8cd8 100644 --- a/MIC-Week1/Debug/MIC-Week1.lss +++ b/MIC-Week1/Debug/MIC-Week1.lss @@ -3,29 +3,31 @@ MIC-Week1.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .data 00000000 00800100 00800100 0000013e 2**0 + 0 .data 00000002 00800100 00000226 000002ba 2**0 CONTENTS, ALLOC, LOAD, DATA - 1 .text 000000ea 00000000 00000000 00000054 2**1 + 1 .text 00000226 00000000 00000000 00000094 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 2 .comment 00000030 00000000 00000000 0000013e 2**0 + 2 .bss 00000006 00800102 00800102 000002bc 2**0 + ALLOC + 3 .comment 00000030 00000000 00000000 000002bc 2**0 CONTENTS, READONLY - 3 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00000170 2**2 + 4 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 000002ec 2**2 CONTENTS, READONLY - 4 .debug_aranges 00000040 00000000 00000000 000001ac 2**0 + 5 .debug_aranges 00000068 00000000 00000000 00000328 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_info 00000242 00000000 00000000 000001ec 2**0 + 6 .debug_info 000003fa 00000000 00000000 00000390 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_abbrev 00000161 00000000 00000000 0000042e 2**0 + 7 .debug_abbrev 000001cb 00000000 00000000 0000078a 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_line 000001cf 00000000 00000000 0000058f 2**0 + 8 .debug_line 00000333 00000000 00000000 00000955 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_frame 00000070 00000000 00000000 00000760 2**2 + 9 .debug_frame 000000dc 00000000 00000000 00000c88 2**2 CONTENTS, READONLY, DEBUGGING - 9 .debug_str 00000194 00000000 00000000 000007d0 2**0 + 10 .debug_str 00000207 00000000 00000000 00000d64 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_loc 000000cf 00000000 00000000 00000964 2**0 + 11 .debug_loc 00000163 00000000 00000000 00000f6b 2**0 CONTENTS, READONLY, DEBUGGING - 11 .debug_ranges 00000030 00000000 00000000 00000a33 2**0 + 12 .debug_ranges 00000058 00000000 00000000 000010ce 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -33,73 +35,73 @@ Disassembly of section .text: 00000000 <__vectors>: 0: 45 c0 rjmp .+138 ; 0x8c <__ctors_end> 2: 00 00 nop - 4: 4b c0 rjmp .+150 ; 0x9c <__bad_interrupt> + 4: 60 c0 rjmp .+192 ; 0xc6 <__bad_interrupt> 6: 00 00 nop - 8: 49 c0 rjmp .+146 ; 0x9c <__bad_interrupt> + 8: 5e c0 rjmp .+188 ; 0xc6 <__bad_interrupt> a: 00 00 nop - c: 47 c0 rjmp .+142 ; 0x9c <__bad_interrupt> + c: 5c c0 rjmp .+184 ; 0xc6 <__bad_interrupt> e: 00 00 nop - 10: 45 c0 rjmp .+138 ; 0x9c <__bad_interrupt> + 10: 5a c0 rjmp .+180 ; 0xc6 <__bad_interrupt> 12: 00 00 nop - 14: 43 c0 rjmp .+134 ; 0x9c <__bad_interrupt> + 14: 58 c0 rjmp .+176 ; 0xc6 <__bad_interrupt> 16: 00 00 nop - 18: 41 c0 rjmp .+130 ; 0x9c <__bad_interrupt> + 18: 56 c0 rjmp .+172 ; 0xc6 <__bad_interrupt> 1a: 00 00 nop - 1c: 3f c0 rjmp .+126 ; 0x9c <__bad_interrupt> + 1c: 54 c0 rjmp .+168 ; 0xc6 <__bad_interrupt> 1e: 00 00 nop - 20: 3d c0 rjmp .+122 ; 0x9c <__bad_interrupt> + 20: 52 c0 rjmp .+164 ; 0xc6 <__bad_interrupt> 22: 00 00 nop - 24: 3b c0 rjmp .+118 ; 0x9c <__bad_interrupt> + 24: 50 c0 rjmp .+160 ; 0xc6 <__bad_interrupt> 26: 00 00 nop - 28: 39 c0 rjmp .+114 ; 0x9c <__bad_interrupt> + 28: 4e c0 rjmp .+156 ; 0xc6 <__bad_interrupt> 2a: 00 00 nop - 2c: 37 c0 rjmp .+110 ; 0x9c <__bad_interrupt> + 2c: 4c c0 rjmp .+152 ; 0xc6 <__bad_interrupt> 2e: 00 00 nop - 30: 35 c0 rjmp .+106 ; 0x9c <__bad_interrupt> + 30: 4a c0 rjmp .+148 ; 0xc6 <__bad_interrupt> 32: 00 00 nop - 34: 33 c0 rjmp .+102 ; 0x9c <__bad_interrupt> + 34: 48 c0 rjmp .+144 ; 0xc6 <__bad_interrupt> 36: 00 00 nop - 38: 31 c0 rjmp .+98 ; 0x9c <__bad_interrupt> + 38: 46 c0 rjmp .+140 ; 0xc6 <__bad_interrupt> 3a: 00 00 nop - 3c: 2f c0 rjmp .+94 ; 0x9c <__bad_interrupt> + 3c: 44 c0 rjmp .+136 ; 0xc6 <__bad_interrupt> 3e: 00 00 nop - 40: 2d c0 rjmp .+90 ; 0x9c <__bad_interrupt> + 40: 68 c0 rjmp .+208 ; 0x112 <__vector_16> 42: 00 00 nop - 44: 2b c0 rjmp .+86 ; 0x9c <__bad_interrupt> + 44: 40 c0 rjmp .+128 ; 0xc6 <__bad_interrupt> 46: 00 00 nop - 48: 29 c0 rjmp .+82 ; 0x9c <__bad_interrupt> + 48: 3e c0 rjmp .+124 ; 0xc6 <__bad_interrupt> 4a: 00 00 nop - 4c: 27 c0 rjmp .+78 ; 0x9c <__bad_interrupt> + 4c: 3c c0 rjmp .+120 ; 0xc6 <__bad_interrupt> 4e: 00 00 nop - 50: 25 c0 rjmp .+74 ; 0x9c <__bad_interrupt> + 50: 3a c0 rjmp .+116 ; 0xc6 <__bad_interrupt> 52: 00 00 nop - 54: 23 c0 rjmp .+70 ; 0x9c <__bad_interrupt> + 54: 38 c0 rjmp .+112 ; 0xc6 <__bad_interrupt> 56: 00 00 nop - 58: 21 c0 rjmp .+66 ; 0x9c <__bad_interrupt> + 58: 36 c0 rjmp .+108 ; 0xc6 <__bad_interrupt> 5a: 00 00 nop - 5c: 1f c0 rjmp .+62 ; 0x9c <__bad_interrupt> + 5c: 34 c0 rjmp .+104 ; 0xc6 <__bad_interrupt> 5e: 00 00 nop - 60: 1d c0 rjmp .+58 ; 0x9c <__bad_interrupt> + 60: 32 c0 rjmp .+100 ; 0xc6 <__bad_interrupt> 62: 00 00 nop - 64: 1b c0 rjmp .+54 ; 0x9c <__bad_interrupt> + 64: 30 c0 rjmp .+96 ; 0xc6 <__bad_interrupt> 66: 00 00 nop - 68: 19 c0 rjmp .+50 ; 0x9c <__bad_interrupt> + 68: 2e c0 rjmp .+92 ; 0xc6 <__bad_interrupt> 6a: 00 00 nop - 6c: 17 c0 rjmp .+46 ; 0x9c <__bad_interrupt> + 6c: 2c c0 rjmp .+88 ; 0xc6 <__bad_interrupt> 6e: 00 00 nop - 70: 15 c0 rjmp .+42 ; 0x9c <__bad_interrupt> + 70: 2a c0 rjmp .+84 ; 0xc6 <__bad_interrupt> 72: 00 00 nop - 74: 13 c0 rjmp .+38 ; 0x9c <__bad_interrupt> + 74: 28 c0 rjmp .+80 ; 0xc6 <__bad_interrupt> 76: 00 00 nop - 78: 11 c0 rjmp .+34 ; 0x9c <__bad_interrupt> + 78: 26 c0 rjmp .+76 ; 0xc6 <__bad_interrupt> 7a: 00 00 nop - 7c: 0f c0 rjmp .+30 ; 0x9c <__bad_interrupt> + 7c: 24 c0 rjmp .+72 ; 0xc6 <__bad_interrupt> 7e: 00 00 nop - 80: 0d c0 rjmp .+26 ; 0x9c <__bad_interrupt> + 80: 22 c0 rjmp .+68 ; 0xc6 <__bad_interrupt> 82: 00 00 nop - 84: 0b c0 rjmp .+22 ; 0x9c <__bad_interrupt> + 84: 20 c0 rjmp .+64 ; 0xc6 <__bad_interrupt> 86: 00 00 nop - 88: 09 c0 rjmp .+18 ; 0x9c <__bad_interrupt> + 88: 1e c0 rjmp .+60 ; 0xc6 <__bad_interrupt> ... 0000008c <__ctors_end>: @@ -109,96 +111,224 @@ Disassembly of section .text: 92: d0 e1 ldi r29, 0x10 ; 16 94: de bf out 0x3e, r29 ; 62 96: cd bf out 0x3d, r28 ; 61 - 98: 1f d0 rcall .+62 ; 0xd8
- 9a: 25 c0 rjmp .+74 ; 0xe6 <_exit> -0000009c <__bad_interrupt>: - 9c: b1 cf rjmp .-158 ; 0x0 <__vectors> +00000098 <__do_copy_data>: + 98: 11 e0 ldi r17, 0x01 ; 1 + 9a: a0 e0 ldi r26, 0x00 ; 0 + 9c: b1 e0 ldi r27, 0x01 ; 1 + 9e: e6 e2 ldi r30, 0x26 ; 38 + a0: f2 e0 ldi r31, 0x02 ; 2 + a2: 00 e0 ldi r16, 0x00 ; 0 + a4: 0b bf out 0x3b, r16 ; 59 + a6: 02 c0 rjmp .+4 ; 0xac <__do_copy_data+0x14> + a8: 07 90 elpm r0, Z+ + aa: 0d 92 st X+, r0 + ac: a2 30 cpi r26, 0x02 ; 2 + ae: b1 07 cpc r27, r17 + b0: d9 f7 brne .-10 ; 0xa8 <__do_copy_data+0x10> -0000009e : -void opgave1(void) -{ - PORTD = 0b10000000; - wait( 500 ); - PORTD = 0b01000000; - wait ( 500 ); - 9e: 18 16 cp r1, r24 - a0: 19 06 cpc r1, r25 - a2: 6c f4 brge .+26 ; 0xbe - a4: 20 e0 ldi r18, 0x00 ; 0 - a6: 30 e0 ldi r19, 0x00 ; 0 - a8: ef ec ldi r30, 0xCF ; 207 - aa: f7 e0 ldi r31, 0x07 ; 7 - ac: 31 97 sbiw r30, 0x01 ; 1 - ae: f1 f7 brne .-4 ; 0xac - b0: 00 c0 rjmp .+0 ; 0xb2 - b2: 00 00 nop - b4: 2f 5f subi r18, 0xFF ; 255 - b6: 3f 4f sbci r19, 0xFF ; 255 - b8: 28 17 cp r18, r24 - ba: 39 07 cpc r19, r25 - bc: a9 f7 brne .-22 ; 0xa8 - be: 08 95 ret +000000b2 <__do_clear_bss>: + b2: 21 e0 ldi r18, 0x01 ; 1 + b4: a2 e0 ldi r26, 0x02 ; 2 + b6: b1 e0 ldi r27, 0x01 ; 1 + b8: 01 c0 rjmp .+2 ; 0xbc <.do_clear_bss_start> -000000c0 : +000000ba <.do_clear_bss_loop>: + ba: 1d 92 st X+, r1 + +000000bc <.do_clear_bss_start>: + bc: a8 30 cpi r26, 0x08 ; 8 + be: b2 07 cpc r27, r18 + c0: e1 f7 brne .-8 ; 0xba <.do_clear_bss_loop> + c2: a2 d0 rcall .+324 ; 0x208
+ c4: ae c0 rjmp .+348 ; 0x222 <_exit> + +000000c6 <__bad_interrupt>: + c6: 9c cf rjmp .-200 ; 0x0 <__vectors> + +000000c8 : + wait(pattern[count].delay * speed); + + count++; + if(count >= NELEMS(pattern)) + { + count = 0; + c8: 18 16 cp r1, r24 + ca: 19 06 cpc r1, r25 + cc: 0c f5 brge .+66 ; 0x110 + ce: 20 91 06 01 lds r18, 0x0106 + d2: 30 91 07 01 lds r19, 0x0107 + d6: 21 30 cpi r18, 0x01 ; 1 + d8: 31 05 cpc r19, r1 + da: 51 f0 breq .+20 ; 0xf0 + dc: 20 e0 ldi r18, 0x00 ; 0 + de: 30 e0 ldi r19, 0x00 ; 0 + e0: 0c c0 rjmp .+24 ; 0xfa + e2: 40 91 06 01 lds r20, 0x0106 + e6: 50 91 07 01 lds r21, 0x0107 + ea: 41 30 cpi r20, 0x01 ; 1 + ec: 51 05 cpc r21, r1 + ee: 29 f4 brne .+10 ; 0xfa + f0: 10 92 07 01 sts 0x0107, r1 + f4: 10 92 06 01 sts 0x0106, r1 + f8: 08 95 ret + fa: ef ec ldi r30, 0xCF ; 207 + fc: f7 e0 ldi r31, 0x07 ; 7 + fe: 31 97 sbiw r30, 0x01 ; 1 + 100: f1 f7 brne .-4 ; 0xfe + 102: 00 c0 rjmp .+0 ; 0x104 + 104: 00 00 nop + 106: 2f 5f subi r18, 0xFF ; 255 + 108: 3f 4f sbci r19, 0xFF ; 255 + 10a: 28 17 cp r18, r24 + 10c: 39 07 cpc r19, r25 + 10e: 49 f7 brne .-46 ; 0xe2 + 110: 08 95 ret + +00000112 <__vector_16>: + 112: 1f 92 push r1 + 114: 0f 92 push r0 + 116: 0f b6 in r0, 0x3f ; 63 + 118: 0f 92 push r0 + 11a: 11 24 eor r1, r1 + 11c: 2f 93 push r18 + 11e: 8f 93 push r24 + 120: 9f 93 push r25 + 122: 98 9b sbis 0x13, 0 ; 19 + 124: 1a c0 rjmp .+52 ; 0x15a <__vector_16+0x48> + 126: 80 91 04 01 lds r24, 0x0104 + 12a: 90 91 05 01 lds r25, 0x0105 + 12e: 89 2b or r24, r25 + 130: a1 f4 brne .+40 ; 0x15a <__vector_16+0x48> + 132: 80 91 00 01 lds r24, 0x0100 + 136: 90 91 01 01 lds r25, 0x0101 + 13a: 88 0f add r24, r24 + 13c: 99 1f adc r25, r25 + 13e: 90 93 01 01 sts 0x0101, r25 + 142: 80 93 00 01 sts 0x0100, r24 + 146: 81 e0 ldi r24, 0x01 ; 1 + 148: 90 e0 ldi r25, 0x00 ; 0 + 14a: 90 93 07 01 sts 0x0107, r25 + 14e: 80 93 06 01 sts 0x0106, r24 + 152: 90 93 05 01 sts 0x0105, r25 + 156: 80 93 04 01 sts 0x0104, r24 + 15a: 99 9b sbis 0x13, 1 ; 19 + 15c: 1d c0 rjmp .+58 ; 0x198 <__vector_16+0x86> + 15e: 80 91 02 01 lds r24, 0x0102 + 162: 90 91 03 01 lds r25, 0x0103 + 166: 89 2b or r24, r25 + 168: b9 f4 brne .+46 ; 0x198 <__vector_16+0x86> + 16a: 80 91 00 01 lds r24, 0x0100 + 16e: 90 91 01 01 lds r25, 0x0101 + 172: 99 23 and r25, r25 + 174: 0c f4 brge .+2 ; 0x178 <__vector_16+0x66> + 176: 01 96 adiw r24, 0x01 ; 1 + 178: 95 95 asr r25 + 17a: 87 95 ror r24 + 17c: 90 93 01 01 sts 0x0101, r25 + 180: 80 93 00 01 sts 0x0100, r24 + 184: 81 e0 ldi r24, 0x01 ; 1 + 186: 90 e0 ldi r25, 0x00 ; 0 + 188: 90 93 07 01 sts 0x0107, r25 + 18c: 80 93 06 01 sts 0x0106, r24 + 190: 90 93 03 01 sts 0x0103, r25 + 194: 80 93 02 01 sts 0x0102, r24 + 198: 83 b3 in r24, 0x13 ; 19 + 19a: 81 11 cpse r24, r1 + 19c: 08 c0 rjmp .+16 ; 0x1ae <__vector_16+0x9c> + 19e: 10 92 05 01 sts 0x0105, r1 + 1a2: 10 92 04 01 sts 0x0104, r1 + 1a6: 10 92 03 01 sts 0x0103, r1 + 1aa: 10 92 02 01 sts 0x0102, r1 + 1ae: 80 91 00 01 lds r24, 0x0100 + 1b2: 90 91 01 01 lds r25, 0x0101 + 1b6: 84 31 cpi r24, 0x14 ; 20 + 1b8: 91 05 cpc r25, r1 + 1ba: 3c f4 brge .+14 ; 0x1ca <__vector_16+0xb8> + 1bc: 84 e1 ldi r24, 0x14 ; 20 + 1be: 90 e0 ldi r25, 0x00 ; 0 + 1c0: 90 93 01 01 sts 0x0101, r25 + 1c4: 80 93 00 01 sts 0x0100, r24 + 1c8: 09 c0 rjmp .+18 ; 0x1dc <__vector_16+0xca> + 1ca: 81 3a cpi r24, 0xA1 ; 161 + 1cc: 9f 40 sbci r25, 0x0F ; 15 + 1ce: 34 f0 brlt .+12 ; 0x1dc <__vector_16+0xca> + 1d0: 80 ea ldi r24, 0xA0 ; 160 + 1d2: 9f e0 ldi r25, 0x0F ; 15 + 1d4: 90 93 01 01 sts 0x0101, r25 + 1d8: 80 93 00 01 sts 0x0100, r24 + 1dc: 9f 91 pop r25 + 1de: 8f 91 pop r24 + 1e0: 2f 91 pop r18 + 1e2: 0f 90 pop r0 + 1e4: 0f be out 0x3f, r0 ; 63 + 1e6: 0f 90 pop r0 + 1e8: 1f 90 pop r1 + 1ea: 18 95 reti + +000001ec : + } } -void opgave4(void) +void opgave6(void) { - wait( 50 ); - c0: 82 e3 ldi r24, 0x32 ; 50 - c2: 90 e0 ldi r25, 0x00 ; 0 - c4: ec df rcall .-40 ; 0x9e - if (PORTC>= 0x80) - c6: af 9b sbis 0x15, 7 ; 21 - c8: 03 c0 rjmp .+6 ; 0xd0 - { - PORTC= 0x1; - ca: 81 e0 ldi r24, 0x01 ; 1 - cc: 85 bb out 0x15, r24 ; 21 - ce: 08 95 ret - } - else - { - PORTC = (PORTC<<1); - d0: 85 b3 in r24, 0x15 ; 21 - d2: 88 0f add r24, r24 - d4: 85 bb out 0x15, r24 ; 21 - d6: 08 95 ret + PORTD = 0b10000000; + 1ec: 80 e8 ldi r24, 0x80 ; 128 + 1ee: 82 bb out 0x12, r24 ; 18 + wait( blink ); + 1f0: 80 91 00 01 lds r24, 0x0100 + 1f4: 90 91 01 01 lds r25, 0x0101 + 1f8: 67 df rcall .-306 ; 0xc8 + PORTD = 0b00000000; + 1fa: 12 ba out 0x12, r1 ; 18 + wait( blink ); + 1fc: 80 91 00 01 lds r24, 0x0100 + 200: 90 91 01 01 lds r25, 0x0101 + 204: 61 cf rjmp .-318 ; 0xc8 + 206: 08 95 ret -000000d8
: - } +00000208
: + } } int main(void) { - DDRD = 0b00000000; //input - d8: 11 ba out 0x11, r1 ; 17 - DDRC = 0b11111111; //output - da: 8f ef ldi r24, 0xFF ; 255 - dc: 84 bb out 0x14, r24 ; 20 + DDRC = 0b00000000; //input + 208: 14 ba out 0x14, r1 ; 20 + DDRD = 0b11111111; //output + 20a: 8f ef ldi r24, 0xFF ; 255 + 20c: 81 bb out 0x11, r24 ; 17 - //Alleen voor opgave 4 - PORTC = 0x1; - de: 81 e0 ldi r24, 0x01 ; 1 - e0: 85 bb out 0x15, r24 ; 21 - while (1) - { + // Prescaler = FCPU/8000000 + TCCR0 |= (1 << CS01) | (1 << CS00); + 20e: 83 b7 in r24, 0x33 ; 51 + 210: 83 60 ori r24, 0x03 ; 3 + 212: 83 bf out 0x33, r24 ; 51 + //Enable Overflow Interrupt Enable + TIMSK|=(1< - if( (PIND) != 0 ) - { - speaker( PIND ); - } - */ + //opgave4(); + //opgave5(); + opgave6(); + 21e: e6 df rcall .-52 ; 0x1ec + + //extraopgave(); } - e4: fe cf rjmp .-4 ; 0xe2 + 220: fe cf rjmp .-4 ; 0x21e -000000e6 <_exit>: - e6: f8 94 cli +00000222 <_exit>: + 222: f8 94 cli -000000e8 <__stop_program>: - e8: ff cf rjmp .-2 ; 0xe8 <__stop_program> +00000224 <__stop_program>: + 224: ff cf rjmp .-2 ; 0x224 <__stop_program> diff --git a/MIC-Week1/Debug/MIC-Week1.map b/MIC-Week1/Debug/MIC-Week1.map index aac5e35..17411ff 100644 --- a/MIC-Week1/Debug/MIC-Week1.map +++ b/MIC-Week1/Debug/MIC-Week1.map @@ -2,6 +2,10 @@ Archive member included to satisfy reference by file (symbol) c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) C:/Program Files (x86)/Atmel/Studio/7.0/Packs/Atmel/ATmega_DFP/1.0.91/gcc/dev/atmega128/avr51/crtatmega128.o (exit) +c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_copy_data.o) + main.o (__do_copy_data) +c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_clear_bss.o) + main.o (__do_clear_bss) Discarded input sections @@ -11,7 +15,15 @@ Discarded input sections .data 0x00000000 0x0 main.o .bss 0x00000000 0x0 main.o .text.speaker 0x00000000 0x1e main.o + .text.extraopgave + 0x00000000 0x10 main.o .text.opgave1 0x00000000 0x1a main.o + .text.opgave3 0x00000000 0x1c main.o + .text.opgave4 0x00000000 0x1a main.o + .text.opgave5 0x00000000 0x8a main.o + .data.speed 0x00000000 0x2 main.o + .bss.count 0x00000000 0x2 main.o + .data.pattern 0x00000000 0x4b main.o .text 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) .data 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) .bss 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) @@ -28,6 +40,38 @@ Discarded input sections 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) .text.libgcc.fixed 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) + .text 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_copy_data.o) + .data 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_copy_data.o) + .bss 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_copy_data.o) + .text.libgcc.mul + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_copy_data.o) + .text.libgcc.div + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_copy_data.o) + .text.libgcc 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_copy_data.o) + .text.libgcc.prologue + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_copy_data.o) + .text.libgcc.builtins + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_copy_data.o) + .text.libgcc.fmul + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_copy_data.o) + .text.libgcc.fixed + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_copy_data.o) + .text 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_clear_bss.o) + .data 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_clear_bss.o) + .bss 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_clear_bss.o) + .text.libgcc.mul + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_clear_bss.o) + .text.libgcc.div + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_clear_bss.o) + .text.libgcc 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_clear_bss.o) + .text.libgcc.prologue + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_clear_bss.o) + .text.libgcc.builtins + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_clear_bss.o) + .text.libgcc.fmul + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_clear_bss.o) + .text.libgcc.fixed + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_clear_bss.o) Memory Configuration @@ -146,7 +190,7 @@ END GROUP .rela.plt *(.rela.plt) -.text 0x00000000 0xea +.text 0x00000000 0x226 *(.vectors) .vectors 0x00000000 0x8c C:/Program Files (x86)/Atmel/Studio/7.0/Packs/Atmel/ATmega_DFP/1.0.91/gcc/dev/atmega128/avr51/crtatmega128.o 0x00000000 __vector_default @@ -185,6 +229,10 @@ END GROUP *(.init3) *(.init3) *(.init4) + .init4 0x00000098 0x1a c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_copy_data.o) + 0x00000098 __do_copy_data + .init4 0x000000b2 0x10 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_clear_bss.o) + 0x000000b2 __do_clear_bss *(.init4) *(.init5) *(.init5) @@ -195,58 +243,60 @@ END GROUP *(.init8) *(.init8) *(.init9) - .init9 0x00000098 0x4 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/Atmel/ATmega_DFP/1.0.91/gcc/dev/atmega128/avr51/crtatmega128.o + .init9 0x000000c2 0x4 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/Atmel/ATmega_DFP/1.0.91/gcc/dev/atmega128/avr51/crtatmega128.o *(.init9) *(.text) - .text 0x0000009c 0x2 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/Atmel/ATmega_DFP/1.0.91/gcc/dev/atmega128/avr51/crtatmega128.o - 0x0000009c __vector_22 - 0x0000009c __vector_28 - 0x0000009c __vector_1 - 0x0000009c __vector_32 - 0x0000009c __vector_34 - 0x0000009c __vector_24 - 0x0000009c __vector_12 - 0x0000009c __bad_interrupt - 0x0000009c __vector_6 - 0x0000009c __vector_31 - 0x0000009c __vector_3 - 0x0000009c __vector_23 - 0x0000009c __vector_30 - 0x0000009c __vector_25 - 0x0000009c __vector_11 - 0x0000009c __vector_13 - 0x0000009c __vector_17 - 0x0000009c __vector_19 - 0x0000009c __vector_7 - 0x0000009c __vector_27 - 0x0000009c __vector_5 - 0x0000009c __vector_33 - 0x0000009c __vector_4 - 0x0000009c __vector_9 - 0x0000009c __vector_2 - 0x0000009c __vector_21 - 0x0000009c __vector_15 - 0x0000009c __vector_29 - 0x0000009c __vector_8 - 0x0000009c __vector_26 - 0x0000009c __vector_14 - 0x0000009c __vector_10 - 0x0000009c __vector_16 - 0x0000009c __vector_18 - 0x0000009c __vector_20 - 0x0000009e . = ALIGN (0x2) + .text 0x000000c6 0x2 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/Atmel/ATmega_DFP/1.0.91/gcc/dev/atmega128/avr51/crtatmega128.o + 0x000000c6 __vector_22 + 0x000000c6 __vector_28 + 0x000000c6 __vector_1 + 0x000000c6 __vector_32 + 0x000000c6 __vector_34 + 0x000000c6 __vector_24 + 0x000000c6 __vector_12 + 0x000000c6 __bad_interrupt + 0x000000c6 __vector_6 + 0x000000c6 __vector_31 + 0x000000c6 __vector_3 + 0x000000c6 __vector_23 + 0x000000c6 __vector_30 + 0x000000c6 __vector_25 + 0x000000c6 __vector_11 + 0x000000c6 __vector_13 + 0x000000c6 __vector_17 + 0x000000c6 __vector_19 + 0x000000c6 __vector_7 + 0x000000c6 __vector_27 + 0x000000c6 __vector_5 + 0x000000c6 __vector_33 + 0x000000c6 __vector_4 + 0x000000c6 __vector_9 + 0x000000c6 __vector_2 + 0x000000c6 __vector_21 + 0x000000c6 __vector_15 + 0x000000c6 __vector_29 + 0x000000c6 __vector_8 + 0x000000c6 __vector_26 + 0x000000c6 __vector_14 + 0x000000c6 __vector_10 + 0x000000c6 __vector_18 + 0x000000c6 __vector_20 + 0x000000c8 . = ALIGN (0x2) *(.text.*) - .text.wait 0x0000009e 0x22 main.o - 0x0000009e wait - .text.opgave4 0x000000c0 0x18 main.o - 0x000000c0 opgave4 - .text.main 0x000000d8 0xe main.o - 0x000000d8 main - 0x000000e6 . = ALIGN (0x2) + .text.wait 0x000000c8 0x4a main.o + 0x000000c8 wait + .text.__vector_16 + 0x00000112 0xda main.o + 0x00000112 __vector_16 + .text.opgave6 0x000001ec 0x1c main.o + 0x000001ec opgave6 + .text.main 0x00000208 0x1a main.o + 0x00000208 main + 0x00000222 . = ALIGN (0x2) *(.fini9) - .fini9 0x000000e6 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) - 0x000000e6 _exit - 0x000000e6 exit + .fini9 0x00000222 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) + 0x00000222 _exit + 0x00000222 exit *(.fini9) *(.fini8) *(.fini8) @@ -265,36 +315,44 @@ END GROUP *(.fini1) *(.fini1) *(.fini0) - .fini0 0x000000e6 0x4 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) + .fini0 0x00000222 0x4 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) *(.fini0) - 0x000000ea _etext = . + 0x00000226 _etext = . -.data 0x00800100 0x0 load address 0x000000ea +.data 0x00800100 0x2 load address 0x00000226 0x00800100 PROVIDE (__data_start, .) *(.data) *(.data*) + .data.blink 0x00800100 0x2 main.o + 0x00800100 blink *(.rodata) *(.rodata*) *(.gnu.linkonce.d*) - 0x00800100 . = ALIGN (0x2) - 0x00800100 _edata = . - 0x00800100 PROVIDE (__data_end, .) + 0x00800102 . = ALIGN (0x2) + 0x00800102 _edata = . + 0x00800102 PROVIDE (__data_end, .) -.bss 0x00800100 0x0 - 0x00800100 PROVIDE (__bss_start, .) +.bss 0x00800102 0x6 + 0x00800102 PROVIDE (__bss_start, .) *(.bss) *(.bss*) + .bss.b2 0x00800102 0x2 main.o + 0x00800102 b2 + .bss.b1 0x00800104 0x2 main.o + 0x00800104 b1 + .bss.reset 0x00800106 0x2 main.o + 0x00800106 reset *(COMMON) - 0x00800100 PROVIDE (__bss_end, .) - 0x000000ea __data_load_start = LOADADDR (.data) - 0x000000ea __data_load_end = (__data_load_start + SIZEOF (.data)) + 0x00800108 PROVIDE (__bss_end, .) + 0x00000226 __data_load_start = LOADADDR (.data) + 0x00000228 __data_load_end = (__data_load_start + SIZEOF (.data)) -.noinit 0x00800100 0x0 - 0x00800100 PROVIDE (__noinit_start, .) +.noinit 0x00800108 0x0 + 0x00800108 PROVIDE (__noinit_start, .) *(.noinit*) - 0x00800100 PROVIDE (__noinit_end, .) - 0x00800100 _end = . - 0x00800100 PROVIDE (__heap_start, .) + 0x00800108 PROVIDE (__noinit_end, .) + 0x00800108 _end = . + 0x00800108 PROVIDE (__heap_start, .) .eeprom 0x00810000 0x0 *(.eeprom*) @@ -358,38 +416,38 @@ END GROUP .debug_sfnames *(.debug_sfnames) -.debug_aranges 0x00000000 0x40 +.debug_aranges 0x00000000 0x68 *(.debug_aranges) .debug_aranges - 0x00000000 0x40 main.o + 0x00000000 0x68 main.o .debug_pubnames *(.debug_pubnames) -.debug_info 0x00000000 0x242 +.debug_info 0x00000000 0x3fa *(.debug_info .gnu.linkonce.wi.*) - .debug_info 0x00000000 0x242 main.o + .debug_info 0x00000000 0x3fa main.o -.debug_abbrev 0x00000000 0x161 +.debug_abbrev 0x00000000 0x1cb *(.debug_abbrev) - .debug_abbrev 0x00000000 0x161 main.o + .debug_abbrev 0x00000000 0x1cb main.o -.debug_line 0x00000000 0x1cf +.debug_line 0x00000000 0x333 *(.debug_line .debug_line.* .debug_line_end) - .debug_line 0x00000000 0x1cf main.o + .debug_line 0x00000000 0x333 main.o -.debug_frame 0x00000000 0x70 +.debug_frame 0x00000000 0xdc *(.debug_frame) - .debug_frame 0x00000000 0x70 main.o + .debug_frame 0x00000000 0xdc main.o -.debug_str 0x00000000 0x194 +.debug_str 0x00000000 0x207 *(.debug_str) - .debug_str 0x00000000 0x194 main.o - 0x1c8 (size before relaxing) + .debug_str 0x00000000 0x207 main.o + 0x23b (size before relaxing) -.debug_loc 0x00000000 0xcf +.debug_loc 0x00000000 0x163 *(.debug_loc) - .debug_loc 0x00000000 0xcf main.o + .debug_loc 0x00000000 0x163 main.o .debug_macinfo *(.debug_macinfo) @@ -409,9 +467,9 @@ END GROUP .debug_pubtypes *(.debug_pubtypes) -.debug_ranges 0x00000000 0x30 +.debug_ranges 0x00000000 0x58 *(.debug_ranges) - .debug_ranges 0x00000000 0x30 main.o + .debug_ranges 0x00000000 0x58 main.o .debug_macro *(.debug_macro) diff --git a/MIC-Week1/Debug/MIC-Week1.srec b/MIC-Week1/Debug/MIC-Week1.srec index ba7a536..fb7d4dc 100644 --- a/MIC-Week1/Debug/MIC-Week1.srec +++ b/MIC-Week1/Debug/MIC-Week1.srec @@ -1,17 +1,38 @@ S01100004D49432D5765656B312E7372656350 -S113000045C000004BC0000049C0000047C00000CC -S113001045C0000043C0000041C000003FC00000D4 -S11300203DC000003BC0000039C0000037C00000E4 -S113003035C0000033C0000031C000002FC00000F4 -S11300402DC000002BC0000029C0000027C0000004 -S113005025C0000023C0000021C000001FC0000014 -S11300601DC000001BC0000019C0000017C0000024 -S113007015C0000013C0000011C000000FC0000034 -S11300800DC000000BC0000009C0000011241FBEF9 -S1130090CFEFD0E1DEBFCDBF1FD025C0B1CF181642 -S11300A019066CF420E030E0EFECF7E03197F1F75B -S11300B000C000002F5F3F4F28173907A9F70895A4 -S11300C082E390E0ECDFAF9B03C081E085BB089541 -S11300D085B3880F85BB089511BA8FEF84BB81E087 -S10D00E085BBEEDFFECFF894FFCFDE +S113000045C0000060C000005EC000005CC000008D +S11300105AC0000058C0000056C0000054C0000080 +S113002052C0000050C000004EC000004CC0000090 +S11300304AC0000048C0000046C0000044C00000A0 +S113004068C0000040C000003EC000003CC000008A +S11300503AC0000038C0000036C0000034C00000C0 +S113006032C0000030C000002EC000002CC00000D0 +S11300702AC0000028C0000026C0000024C00000E0 +S113008022C0000020C000001EC0000011241FBEBA +S1130090CFEFD0E1DEBFCDBF11E0A0E0B1E0E6E2FA +S11300A0F2E000E00BBF02C007900D92A230B1074E +S11300B0D9F721E0A2E0B1E001C01D92A830B20757 +S11300C0E1F7A2D0AEC09CCF181619060CF520910A +S11300D00601309107012130310551F020E030E074 +S11300E00CC040910601509107014130510529F49B +S11300F010920701109206010895EFECF7E0319792 +S1130100F1F700C000002F5F3F4F2817390749F768 +S113011008951F920F920FB60F9211242F938F936D +S11301209F93989B1AC08091040190910501892B9B +S1130130A1F48091000190910101880F991F90937F +S113014001018093000181E090E090930701809386 +S113015006019093050180930401999B1DC0809131 +S1130160020190910301892BB9F4809100019091CF +S1130170010199230CF401969595879590930101BB +S11301808093000181E090E0909307018093060141 +S1130190909303018093020183B3811108C01092EC +S11301A00501109204011092030110920201809142 +S11301B0000190910101843191053CF484E190E0C7 +S11301C0909301018093000109C0813A9F4034F06B +S11301D080EA9FE090930101809300019F918F91A9 +S11301E02F910F900FBE0F901F90189580E882BB3F +S11301F0809100019091010167DF12BA80910001A2 +S11302009091010161CF089514BA8FEF81BB83B738 +S1130210836083BF87B7816087BF12BE7894E6DFAF +S1090220FECFF894FFCFAD +S1050226E803E7 S9030000FC diff --git a/MIC-Week1/Debug/main.d b/MIC-Week1/Debug/main.d index affe786..ffef84e 100644 --- a/MIC-Week1/Debug/main.d +++ b/MIC-Week1/Debug/main.d @@ -1,4 +1,5 @@ main.d main.o: .././main.c \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h \ c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \ c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \ c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h \ @@ -14,6 +15,8 @@ main.d main.o: .././main.c \ c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h \ c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h: + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h: c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h: diff --git a/MIC-Week1/main.c b/MIC-Week1/main.c index 618a745..034cb38 100644 --- a/MIC-Week1/main.c +++ b/MIC-Week1/main.c @@ -6,10 +6,14 @@ */ #define F_CPU 8000000UL +#define NELEMS(x) (sizeof(x) / sizeof(x[0])) +#include #include #include +int reset = 0; + /******************************************************************/ void wait( int ms ) /* @@ -24,42 +28,116 @@ Version : DMK, Initial code { for (int i=0; i 4000) + { + blink = 4000; + } +} + int main(void) { - DDRD = 0b00000000; //input - DDRC = 0b11111111; //output + DDRC = 0b00000000; //input + DDRD = 0b11111111; //output + + // Prescaler = FCPU/8000000 + TCCR0 |= (1 << CS01) | (1 << CS00); + //Enable Overflow Interrupt Enable + TIMSK|=(1<= 0x80) + if( (0b00000001 & PINC) != 0 ) { - PORTC= 0x1; - } - else - { - PORTC = (PORTC<<1); + PORTD = 0b10000000; + wait( 100 ); + PORTD = 0b00000000; + wait( 100 ); } } +void opgave4(void) +{ + wait( 50 ); + if (PORTD>= 0x80) + { + PORTD= 0x1; + } + else + { + PORTD = (PORTD<<1); + } +} + +void opgave5(void) +{ + if(PINC != 0 ) + { + speed = PINC; + } + + // Write data to PORTD + PORTD = pattern[count].data; + // wait + wait(pattern[count].delay * speed); + + count++; + if(count >= NELEMS(pattern)) + { + count = 0; + } +} + +void opgave6(void) +{ + PORTD = 0b10000000; + wait( blink ); + PORTD = 0b00000000; + wait( blink ); +} + From 4bf8ed5b8828c6f4eac3455eb0706c689ce7cd31 Mon Sep 17 00:00:00 2001 From: Kenneth van Ewijk Date: Mon, 15 Feb 2016 14:05:13 +0100 Subject: [PATCH 5/6] Added opgave 7b --- MIC-Week1/.vs/MIC-Week1/v14/.atsuo | Bin 19456 -> 19456 bytes MIC-Week1/Debug/MIC-Week1.lss | 380 ++++++++++++++++------------- MIC-Week1/Debug/MIC-Week1.map | 67 ++--- MIC-Week1/Debug/MIC-Week1.srec | 51 ++-- MIC-Week1/main.c | 50 +++- 5 files changed, 314 insertions(+), 234 deletions(-) diff --git a/MIC-Week1/.vs/MIC-Week1/v14/.atsuo b/MIC-Week1/.vs/MIC-Week1/v14/.atsuo index e86099e9846b2a2e2e4ce80234dccf58a2006344..ab3c1ac2ba2f79a8ab416c5f6268bc19c3302cd7 100644 GIT binary patch delta 1607 zcmcIk%}*0i5bvvnE@ii{d{#7+f)XKZQ%Y$mXejI!1j<)b@PdITnt%!+Z9)(OK@$n_ zAUlb0ki@8efVdnzkU*mGBZiZn@aV;h0iqZcXBMg(BvC?~=I!>)yf^cEzxnMOn_*)! z>~X}%lEGoLTkrcvYd>CEW`_+1!$LX?8;4mltQ%YSO|%qr(i_@Rj<5*C%q<|Nc?27} zFEV_fB>^+p6^kh|2Pd?a?8nw?GYh6TyOLuP4`R@YgLY=qLbzfoU_}^C$Gz%1+c7rP zTI1I3)OP$rkJJUjq(GN23W|+ukU=%u@{q4sAQJ)Ce(tl-0s|@fL+feJ~6$p;=%& z`UJgShIOHZCroh`=@5#|qz+jpnBtT9r0wPLIv9f?UxZIZ{~=wf#3GzbC&E`>gVw=x zT}<0k)+n$8=;U+(-j0)VgcR+8h3)0=1c*$N$nV3S;{N5}Nir5RQB{}=b%~W?UBKFx zP&HrYTM4hUbsI<@P@O9wVRxlxpN2<2uikkJVucTu3co2H2^KR>z?f%=r(&e7I1-4K z+*YjeZj{216)D&$7<)Qv1%N{ziVo0{sMXM6?*=!=QhOR(UC zgN@P#gj5CNz8ao9yLYCU+qEl{i`p5_32SAoJZYD7`pX%zW8?iV1xB>RRiQ~f8fXz1 z0n62`-vXv?1kIe1+9`HC?Ww=@{zG?ka?-XMbN2p)VW+H#NS{!RI!`lr?sX>AVHpuN zN?vSp_DBP}ld>=3D|N|zlX1jH{1lq9J^w-3^eO6(o`?GI(mBgO5EoM2K#$QV5;Ck)&6sw4axgY(yk7MXH9vtc&@n7#YWc= kT}yN|kU>Xb5iA@%$=nFuO*%6q9={s9457jhEHs9G0>Kp(R{#J2 delta 1509 zcmb7EO-vI(6yCRNWv#Q6(jtOVihsq@Vp|*9;$MMM(Gp4nF~+Dt3Pxj$7kWUVu8Btv z(s$5{2e}z9>YC`m14%h}F=*o1i#I(G6G+4Z`d;h8g5lsa-*)z!H*daq^UdmyL4OP{ z24rwxtK3qPtm#@=xcCY7NRpJS!&~w#=*ML_D>Nb+2*0Ue&aof*uuwIKB{{6^BKiu@ zgPI#bX_*-fpjT0v8;RIWXd>(+@O%!gC#>QPWgkAYE3o=9cO8oIKt+M(ojtLpK*A|` z8Zui8$ck3VwT)ov!li02G-7zi$$F;$SsJe?KBzWk)SL2wRhqOJY1a0aKTZ8JlxksS zR1`%@@ETQ?wIGEBaTj`VS(GaQJy_5NwetRCYg{)jYgxf1U_G3MOK42iJOF&{zv#SL z|K`o^V;@SP(%VPhjjrbs&L}PlIf;6Mj-!ro!i8dFUNqBmrzHiraXB)m0jIR4hB_=9 zA)ZUH!xE2k?Fy*4(mV~CQSej&jNnvDR`pn7Y<7B~nBW;cU7YM#(8_jD*JIj1kh%<} z9LI|G&~dI;4UIYowFI+%E=%9!`25)ytd_m8=7R)B_=ssE93uD$?Sud!Na!G#S*-uj z$_b6X+W%fgug`5kE!8cGA)jJA@I8~Eh@JjBxYzGOXZw^f*X;o~ia)w@_%;!N(Mp$B&HXW0831wxBFk zRQ^kt%&2(Q5l20fMEziLwgG6r$yqxzTkB)?*PM+{m9M6q*&u8l_T##p-NP!A+{y!6 z_}bP@vlVhmM(|NuO=L`VjDX5g%_O!{^y0*oa7JvWp2bac5h9-f`y+8fkLpm|Q^L~W zFfN5YifW2vJDN!p-VFY93<&-}G0TlL;$-cR;1jD*6>=N5mFdcDjvm=W1^_a^f{{X6s0(<}f diff --git a/MIC-Week1/Debug/MIC-Week1.lss b/MIC-Week1/Debug/MIC-Week1.lss index 53b8cd8..35b1ca2 100644 --- a/MIC-Week1/Debug/MIC-Week1.lss +++ b/MIC-Week1/Debug/MIC-Week1.lss @@ -3,31 +3,31 @@ MIC-Week1.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .data 00000002 00800100 00000226 000002ba 2**0 + 0 .data 00000002 00800100 00000214 000002a8 2**0 CONTENTS, ALLOC, LOAD, DATA - 1 .text 00000226 00000000 00000000 00000094 2**1 + 1 .text 00000214 00000000 00000000 00000094 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 2 .bss 00000006 00800102 00800102 000002bc 2**0 + 2 .bss 00000006 00800102 00800102 000002aa 2**0 ALLOC - 3 .comment 00000030 00000000 00000000 000002bc 2**0 + 3 .comment 00000030 00000000 00000000 000002aa 2**0 CONTENTS, READONLY - 4 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 000002ec 2**2 + 4 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 000002dc 2**2 CONTENTS, READONLY - 5 .debug_aranges 00000068 00000000 00000000 00000328 2**0 + 5 .debug_aranges 00000070 00000000 00000000 00000318 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_info 000003fa 00000000 00000000 00000390 2**0 + 6 .debug_info 00000410 00000000 00000000 00000388 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_abbrev 000001cb 00000000 00000000 0000078a 2**0 + 7 .debug_abbrev 000001e3 00000000 00000000 00000798 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_line 00000333 00000000 00000000 00000955 2**0 + 8 .debug_line 000003b0 00000000 00000000 0000097b 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_frame 000000dc 00000000 00000000 00000c88 2**2 + 9 .debug_frame 000000ec 00000000 00000000 00000d2c 2**2 CONTENTS, READONLY, DEBUGGING - 10 .debug_str 00000207 00000000 00000000 00000d64 2**0 + 10 .debug_str 00000216 00000000 00000000 00000e18 2**0 CONTENTS, READONLY, DEBUGGING - 11 .debug_loc 00000163 00000000 00000000 00000f6b 2**0 + 11 .debug_loc 00000163 00000000 00000000 0000102e 2**0 CONTENTS, READONLY, DEBUGGING - 12 .debug_ranges 00000058 00000000 00000000 000010ce 2**0 + 12 .debug_ranges 00000060 00000000 00000000 00001191 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -65,7 +65,7 @@ Disassembly of section .text: 3a: 00 00 nop 3c: 44 c0 rjmp .+136 ; 0xc6 <__bad_interrupt> 3e: 00 00 nop - 40: 68 c0 rjmp .+208 ; 0x112 <__vector_16> + 40: 43 c0 rjmp .+134 ; 0xc8 <__vector_16> 42: 00 00 nop 44: 40 c0 rjmp .+128 ; 0xc6 <__bad_interrupt> 46: 00 00 nop @@ -116,7 +116,7 @@ Disassembly of section .text: 98: 11 e0 ldi r17, 0x01 ; 1 9a: a0 e0 ldi r26, 0x00 ; 0 9c: b1 e0 ldi r27, 0x01 ; 1 - 9e: e6 e2 ldi r30, 0x26 ; 38 + 9e: e4 e1 ldi r30, 0x14 ; 20 a0: f2 e0 ldi r31, 0x02 ; 2 a2: 00 e0 ldi r16, 0x00 ; 0 a4: 0b bf out 0x3b, r16 ; 59 @@ -140,195 +140,229 @@ Disassembly of section .text: bc: a8 30 cpi r26, 0x08 ; 8 be: b2 07 cpc r27, r18 c0: e1 f7 brne .-8 ; 0xba <.do_clear_bss_loop> - c2: a2 d0 rcall .+324 ; 0x208
- c4: ae c0 rjmp .+348 ; 0x222 <_exit> + c2: 99 d0 rcall .+306 ; 0x1f6
+ c4: a5 c0 rjmp .+330 ; 0x210 <_exit> 000000c6 <__bad_interrupt>: c6: 9c cf rjmp .-200 ; 0x0 <__vectors> -000000c8 : - wait(pattern[count].delay * speed); - - count++; - if(count >= NELEMS(pattern)) - { - count = 0; - c8: 18 16 cp r1, r24 - ca: 19 06 cpc r1, r25 - cc: 0c f5 brge .+66 ; 0x110 - ce: 20 91 06 01 lds r18, 0x0106 - d2: 30 91 07 01 lds r19, 0x0107 - d6: 21 30 cpi r18, 0x01 ; 1 - d8: 31 05 cpc r19, r1 - da: 51 f0 breq .+20 ; 0xf0 - dc: 20 e0 ldi r18, 0x00 ; 0 - de: 30 e0 ldi r19, 0x00 ; 0 - e0: 0c c0 rjmp .+24 ; 0xfa - e2: 40 91 06 01 lds r20, 0x0106 - e6: 50 91 07 01 lds r21, 0x0107 - ea: 41 30 cpi r20, 0x01 ; 1 - ec: 51 05 cpc r21, r1 - ee: 29 f4 brne .+10 ; 0xfa - f0: 10 92 07 01 sts 0x0107, r1 - f4: 10 92 06 01 sts 0x0106, r1 - f8: 08 95 ret - fa: ef ec ldi r30, 0xCF ; 207 - fc: f7 e0 ldi r31, 0x07 ; 7 - fe: 31 97 sbiw r30, 0x01 ; 1 - 100: f1 f7 brne .-4 ; 0xfe - 102: 00 c0 rjmp .+0 ; 0x104 - 104: 00 00 nop - 106: 2f 5f subi r18, 0xFF ; 255 - 108: 3f 4f sbci r19, 0xFF ; 255 - 10a: 28 17 cp r18, r24 - 10c: 39 07 cpc r19, r25 - 10e: 49 f7 brne .-46 ; 0xe2 - 110: 08 95 ret - -00000112 <__vector_16>: - 112: 1f 92 push r1 - 114: 0f 92 push r0 - 116: 0f b6 in r0, 0x3f ; 63 - 118: 0f 92 push r0 - 11a: 11 24 eor r1, r1 - 11c: 2f 93 push r18 - 11e: 8f 93 push r24 - 120: 9f 93 push r25 - 122: 98 9b sbis 0x13, 0 ; 19 - 124: 1a c0 rjmp .+52 ; 0x15a <__vector_16+0x48> - 126: 80 91 04 01 lds r24, 0x0104 - 12a: 90 91 05 01 lds r25, 0x0105 - 12e: 89 2b or r24, r25 - 130: a1 f4 brne .+40 ; 0x15a <__vector_16+0x48> - 132: 80 91 00 01 lds r24, 0x0100 - 136: 90 91 01 01 lds r25, 0x0101 - 13a: 88 0f add r24, r24 - 13c: 99 1f adc r25, r25 - 13e: 90 93 01 01 sts 0x0101, r25 - 142: 80 93 00 01 sts 0x0100, r24 - 146: 81 e0 ldi r24, 0x01 ; 1 - 148: 90 e0 ldi r25, 0x00 ; 0 - 14a: 90 93 07 01 sts 0x0107, r25 - 14e: 80 93 06 01 sts 0x0106, r24 - 152: 90 93 05 01 sts 0x0105, r25 - 156: 80 93 04 01 sts 0x0104, r24 - 15a: 99 9b sbis 0x13, 1 ; 19 - 15c: 1d c0 rjmp .+58 ; 0x198 <__vector_16+0x86> - 15e: 80 91 02 01 lds r24, 0x0102 - 162: 90 91 03 01 lds r25, 0x0103 - 166: 89 2b or r24, r25 - 168: b9 f4 brne .+46 ; 0x198 <__vector_16+0x86> - 16a: 80 91 00 01 lds r24, 0x0100 - 16e: 90 91 01 01 lds r25, 0x0101 - 172: 99 23 and r25, r25 - 174: 0c f4 brge .+2 ; 0x178 <__vector_16+0x66> - 176: 01 96 adiw r24, 0x01 ; 1 - 178: 95 95 asr r25 - 17a: 87 95 ror r24 - 17c: 90 93 01 01 sts 0x0101, r25 - 180: 80 93 00 01 sts 0x0100, r24 - 184: 81 e0 ldi r24, 0x01 ; 1 - 186: 90 e0 ldi r25, 0x00 ; 0 - 188: 90 93 07 01 sts 0x0107, r25 - 18c: 80 93 06 01 sts 0x0106, r24 - 190: 90 93 03 01 sts 0x0103, r25 - 194: 80 93 02 01 sts 0x0102, r24 - 198: 83 b3 in r24, 0x13 ; 19 - 19a: 81 11 cpse r24, r1 - 19c: 08 c0 rjmp .+16 ; 0x1ae <__vector_16+0x9c> - 19e: 10 92 05 01 sts 0x0105, r1 - 1a2: 10 92 04 01 sts 0x0104, r1 - 1a6: 10 92 03 01 sts 0x0103, r1 - 1aa: 10 92 02 01 sts 0x0102, r1 - 1ae: 80 91 00 01 lds r24, 0x0100 - 1b2: 90 91 01 01 lds r25, 0x0101 - 1b6: 84 31 cpi r24, 0x14 ; 20 - 1b8: 91 05 cpc r25, r1 - 1ba: 3c f4 brge .+14 ; 0x1ca <__vector_16+0xb8> - 1bc: 84 e1 ldi r24, 0x14 ; 20 - 1be: 90 e0 ldi r25, 0x00 ; 0 - 1c0: 90 93 01 01 sts 0x0101, r25 - 1c4: 80 93 00 01 sts 0x0100, r24 - 1c8: 09 c0 rjmp .+18 ; 0x1dc <__vector_16+0xca> - 1ca: 81 3a cpi r24, 0xA1 ; 161 - 1cc: 9f 40 sbci r25, 0x0F ; 15 - 1ce: 34 f0 brlt .+12 ; 0x1dc <__vector_16+0xca> - 1d0: 80 ea ldi r24, 0xA0 ; 160 - 1d2: 9f e0 ldi r25, 0x0F ; 15 - 1d4: 90 93 01 01 sts 0x0101, r25 - 1d8: 80 93 00 01 sts 0x0100, r24 - 1dc: 9f 91 pop r25 - 1de: 8f 91 pop r24 - 1e0: 2f 91 pop r18 - 1e2: 0f 90 pop r0 - 1e4: 0f be out 0x3f, r0 ; 63 - 1e6: 0f 90 pop r0 - 1e8: 1f 90 pop r1 - 1ea: 18 95 reti - -000001ec : - } -} - +000000c8 <__vector_16>: void opgave6(void) { PORTD = 0b10000000; - 1ec: 80 e8 ldi r24, 0x80 ; 128 - 1ee: 82 bb out 0x12, r24 ; 18 wait( blink ); - 1f0: 80 91 00 01 lds r24, 0x0100 - 1f4: 90 91 01 01 lds r25, 0x0101 - 1f8: 67 df rcall .-306 ; 0xc8 PORTD = 0b00000000; - 1fa: 12 ba out 0x12, r1 ; 18 wait( blink ); - 1fc: 80 91 00 01 lds r24, 0x0100 - 200: 90 91 01 01 lds r25, 0x0101 - 204: 61 cf rjmp .-318 ; 0xc8 - 206: 08 95 ret + c8: 1f 92 push r1 + ca: 0f 92 push r0 + cc: 0f b6 in r0, 0x3f ; 63 + ce: 0f 92 push r0 + d0: 11 24 eor r1, r1 + d2: 2f 93 push r18 + d4: 8f 93 push r24 + d6: 9f 93 push r25 + d8: 98 9b sbis 0x13, 0 ; 19 + da: 1a c0 rjmp .+52 ; 0x110 <__vector_16+0x48> + dc: 80 91 04 01 lds r24, 0x0104 + e0: 90 91 05 01 lds r25, 0x0105 + e4: 89 2b or r24, r25 + e6: a1 f4 brne .+40 ; 0x110 <__vector_16+0x48> + e8: 80 91 00 01 lds r24, 0x0100 + ec: 90 91 01 01 lds r25, 0x0101 + f0: 88 0f add r24, r24 + f2: 99 1f adc r25, r25 + f4: 90 93 01 01 sts 0x0101, r25 + f8: 80 93 00 01 sts 0x0100, r24 + fc: 81 e0 ldi r24, 0x01 ; 1 + fe: 90 e0 ldi r25, 0x00 ; 0 + 100: 90 93 07 01 sts 0x0107, r25 + 104: 80 93 06 01 sts 0x0106, r24 + 108: 90 93 05 01 sts 0x0105, r25 + 10c: 80 93 04 01 sts 0x0104, r24 + 110: 99 9b sbis 0x13, 1 ; 19 + 112: 1d c0 rjmp .+58 ; 0x14e <__vector_16+0x86> + 114: 80 91 02 01 lds r24, 0x0102 + 118: 90 91 03 01 lds r25, 0x0103 + 11c: 89 2b or r24, r25 + 11e: b9 f4 brne .+46 ; 0x14e <__vector_16+0x86> + 120: 80 91 00 01 lds r24, 0x0100 + 124: 90 91 01 01 lds r25, 0x0101 + 128: 99 23 and r25, r25 + 12a: 0c f4 brge .+2 ; 0x12e <__vector_16+0x66> + 12c: 01 96 adiw r24, 0x01 ; 1 + 12e: 95 95 asr r25 + 130: 87 95 ror r24 + 132: 90 93 01 01 sts 0x0101, r25 + 136: 80 93 00 01 sts 0x0100, r24 + 13a: 81 e0 ldi r24, 0x01 ; 1 + 13c: 90 e0 ldi r25, 0x00 ; 0 + 13e: 90 93 07 01 sts 0x0107, r25 + 142: 80 93 06 01 sts 0x0106, r24 + 146: 90 93 03 01 sts 0x0103, r25 + 14a: 80 93 02 01 sts 0x0102, r24 + 14e: 83 b3 in r24, 0x13 ; 19 + 150: 81 11 cpse r24, r1 + 152: 08 c0 rjmp .+16 ; 0x164 <__vector_16+0x9c> + 154: 10 92 05 01 sts 0x0105, r1 + 158: 10 92 04 01 sts 0x0104, r1 + 15c: 10 92 03 01 sts 0x0103, r1 + 160: 10 92 02 01 sts 0x0102, r1 + 164: 80 91 00 01 lds r24, 0x0100 + 168: 90 91 01 01 lds r25, 0x0101 + 16c: 84 31 cpi r24, 0x14 ; 20 + 16e: 91 05 cpc r25, r1 + 170: 3c f4 brge .+14 ; 0x180 <__vector_16+0xb8> + 172: 84 e1 ldi r24, 0x14 ; 20 + 174: 90 e0 ldi r25, 0x00 ; 0 + 176: 90 93 01 01 sts 0x0101, r25 + 17a: 80 93 00 01 sts 0x0100, r24 + 17e: 09 c0 rjmp .+18 ; 0x192 <__vector_16+0xca> + 180: 81 3a cpi r24, 0xA1 ; 161 + 182: 9f 40 sbci r25, 0x0F ; 15 + 184: 34 f0 brlt .+12 ; 0x192 <__vector_16+0xca> + 186: 80 ea ldi r24, 0xA0 ; 160 + 188: 9f e0 ldi r25, 0x0F ; 15 + 18a: 90 93 01 01 sts 0x0101, r25 + 18e: 80 93 00 01 sts 0x0100, r24 + 192: 9f 91 pop r25 + 194: 8f 91 pop r24 + 196: 2f 91 pop r18 + 198: 0f 90 pop r0 + 19a: 0f be out 0x3f, r0 ; 63 + 19c: 0f 90 pop r0 + 19e: 1f 90 pop r1 + 1a0: 18 95 reti -00000208
: +000001a2 : +} + +void charlieplexing(void) +{ + //Button C0 + if( (0b00000001 & PINC) != 0) + 1a2: 98 9b sbis 0x13, 0 ; 19 + 1a4: 05 c0 rjmp .+10 ; 0x1b0 + { + DDRD = 0b00000011; //PIN 1 & 2 as output. Pin 3 as input (TRI-STATE) + 1a6: 83 e0 ldi r24, 0x03 ; 3 + 1a8: 81 bb out 0x11, r24 ; 17 + PORTD = 0b00000001; //PIN 1 High, PIN 2 Low + 1aa: 81 e0 ldi r24, 0x01 ; 1 + 1ac: 82 bb out 0x12, r24 ; 18 + 1ae: 08 95 ret + } + + //Button C1 + else if( (0b00000010 & PINC) != 0) + 1b0: 99 9b sbis 0x13, 1 ; 19 + 1b2: 05 c0 rjmp .+10 ; 0x1be + { + DDRD = 0b00000011; //PIN 1 & 2 as output. Pin 3 as input (TRI-STATE) + 1b4: 83 e0 ldi r24, 0x03 ; 3 + 1b6: 81 bb out 0x11, r24 ; 17 + PORTD = 0b00000010; //PIN 2 High, PIN 1 Low + 1b8: 82 e0 ldi r24, 0x02 ; 2 + 1ba: 82 bb out 0x12, r24 ; 18 + 1bc: 08 95 ret + } + + //Button C2 + else if( (0b00000100 & PINC) != 0) + 1be: 9a 9b sbis 0x13, 2 ; 19 + 1c0: 05 c0 rjmp .+10 ; 0x1cc + { + DDRD = 0b00000110; //PIN 2 & 3 as output. Pin 1 as input (TRI-STATE) + 1c2: 86 e0 ldi r24, 0x06 ; 6 + 1c4: 81 bb out 0x11, r24 ; 17 + PORTD = 0b00000010; //PIN 2 High, PIN 3 Low + 1c6: 82 e0 ldi r24, 0x02 ; 2 + 1c8: 82 bb out 0x12, r24 ; 18 + 1ca: 08 95 ret + } + + //Button C3 + else if( (0b00001000 & PINC) != 0) + 1cc: 9b 9b sbis 0x13, 3 ; 19 + 1ce: 05 c0 rjmp .+10 ; 0x1da + { + DDRD = 0b00000110; //PIN 2 & 3 as output. Pin 1 as input (TRI-STATE) + 1d0: 86 e0 ldi r24, 0x06 ; 6 + 1d2: 81 bb out 0x11, r24 ; 17 + PORTD = 0b00000100; //PIN 3 High, PIN 2 Low + 1d4: 84 e0 ldi r24, 0x04 ; 4 + 1d6: 82 bb out 0x12, r24 ; 18 + 1d8: 08 95 ret + } + + //Button C4 + else if( (0b00010000 & PINC) != 0) + 1da: 9c 9b sbis 0x13, 4 ; 19 + 1dc: 05 c0 rjmp .+10 ; 0x1e8 + { + DDRD = 0b00000101; //PIN 3 & 1 as output. Pin 2 as input (TRI-STATE) + 1de: 85 e0 ldi r24, 0x05 ; 5 + 1e0: 81 bb out 0x11, r24 ; 17 + PORTD = 0b00000100; //PIN 3 High, PIN 1 Low + 1e2: 84 e0 ldi r24, 0x04 ; 4 + 1e4: 82 bb out 0x12, r24 ; 18 + 1e6: 08 95 ret + } + + //Button C5 + else if( (0b00100000 & PINC) != 0) + 1e8: 9d 9b sbis 0x13, 5 ; 19 + 1ea: 04 c0 rjmp .+8 ; 0x1f4 + { + DDRD = 0b00000101; //PIN 3 & 1 as output. Pin 2 as input (TRI-STATE) + 1ec: 85 e0 ldi r24, 0x05 ; 5 + 1ee: 81 bb out 0x11, r24 ; 17 + PORTD = 0b00000001; //PIN 1 High, PIN 3 Low + 1f0: 81 e0 ldi r24, 0x01 ; 1 + 1f2: 82 bb out 0x12, r24 ; 18 + 1f4: 08 95 ret + +000001f6
: } } int main(void) { DDRC = 0b00000000; //input - 208: 14 ba out 0x14, r1 ; 20 + 1f6: 14 ba out 0x14, r1 ; 20 DDRD = 0b11111111; //output - 20a: 8f ef ldi r24, 0xFF ; 255 - 20c: 81 bb out 0x11, r24 ; 17 + 1f8: 8f ef ldi r24, 0xFF ; 255 + 1fa: 81 bb out 0x11, r24 ; 17 - // Prescaler = FCPU/8000000 + // Prescaler TCCR0 |= (1 << CS01) | (1 << CS00); - 20e: 83 b7 in r24, 0x33 ; 51 - 210: 83 60 ori r24, 0x03 ; 3 - 212: 83 bf out 0x33, r24 ; 51 + 1fc: 83 b7 in r24, 0x33 ; 51 + 1fe: 83 60 ori r24, 0x03 ; 3 + 200: 83 bf out 0x33, r24 ; 51 //Enable Overflow Interrupt Enable TIMSK|=(1< + //opgave6(); + + charlieplexing(); + 20c: ca df rcall .-108 ; 0x1a2 //extraopgave(); } - 220: fe cf rjmp .-4 ; 0x21e + 20e: fe cf rjmp .-4 ; 0x20c -00000222 <_exit>: - 222: f8 94 cli +00000210 <_exit>: + 210: f8 94 cli -00000224 <__stop_program>: - 224: ff cf rjmp .-2 ; 0x224 <__stop_program> +00000212 <__stop_program>: + 212: ff cf rjmp .-2 ; 0x212 <__stop_program> diff --git a/MIC-Week1/Debug/MIC-Week1.map b/MIC-Week1/Debug/MIC-Week1.map index 17411ff..e2aa74a 100644 --- a/MIC-Week1/Debug/MIC-Week1.map +++ b/MIC-Week1/Debug/MIC-Week1.map @@ -14,6 +14,7 @@ Discarded input sections .text 0x00000000 0x0 main.o .data 0x00000000 0x0 main.o .bss 0x00000000 0x0 main.o + .text.wait 0x00000000 0x4a main.o .text.speaker 0x00000000 0x1e main.o .text.extraopgave 0x00000000 0x10 main.o @@ -21,6 +22,7 @@ Discarded input sections .text.opgave3 0x00000000 0x1c main.o .text.opgave4 0x00000000 0x1a main.o .text.opgave5 0x00000000 0x8a main.o + .text.opgave6 0x00000000 0x20 main.o .data.speed 0x00000000 0x2 main.o .bss.count 0x00000000 0x2 main.o .data.pattern 0x00000000 0x4b main.o @@ -190,7 +192,7 @@ END GROUP .rela.plt *(.rela.plt) -.text 0x00000000 0x226 +.text 0x00000000 0x214 *(.vectors) .vectors 0x00000000 0x8c C:/Program Files (x86)/Atmel/Studio/7.0/Packs/Atmel/ATmega_DFP/1.0.91/gcc/dev/atmega128/avr51/crtatmega128.o 0x00000000 __vector_default @@ -283,20 +285,19 @@ END GROUP 0x000000c6 __vector_20 0x000000c8 . = ALIGN (0x2) *(.text.*) - .text.wait 0x000000c8 0x4a main.o - 0x000000c8 wait .text.__vector_16 - 0x00000112 0xda main.o - 0x00000112 __vector_16 - .text.opgave6 0x000001ec 0x1c main.o - 0x000001ec opgave6 - .text.main 0x00000208 0x1a main.o - 0x00000208 main - 0x00000222 . = ALIGN (0x2) + 0x000000c8 0xda main.o + 0x000000c8 __vector_16 + .text.charlieplexing + 0x000001a2 0x54 main.o + 0x000001a2 charlieplexing + .text.main 0x000001f6 0x1a main.o + 0x000001f6 main + 0x00000210 . = ALIGN (0x2) *(.fini9) - .fini9 0x00000222 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) - 0x00000222 _exit - 0x00000222 exit + .fini9 0x00000210 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) + 0x00000210 _exit + 0x00000210 exit *(.fini9) *(.fini8) *(.fini8) @@ -315,11 +316,11 @@ END GROUP *(.fini1) *(.fini1) *(.fini0) - .fini0 0x00000222 0x4 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) + .fini0 0x00000210 0x4 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) *(.fini0) - 0x00000226 _etext = . + 0x00000214 _etext = . -.data 0x00800100 0x2 load address 0x00000226 +.data 0x00800100 0x2 load address 0x00000214 0x00800100 PROVIDE (__data_start, .) *(.data) *(.data*) @@ -344,8 +345,8 @@ END GROUP 0x00800106 reset *(COMMON) 0x00800108 PROVIDE (__bss_end, .) - 0x00000226 __data_load_start = LOADADDR (.data) - 0x00000228 __data_load_end = (__data_load_start + SIZEOF (.data)) + 0x00000214 __data_load_start = LOADADDR (.data) + 0x00000216 __data_load_end = (__data_load_start + SIZEOF (.data)) .noinit 0x00800108 0x0 0x00800108 PROVIDE (__noinit_start, .) @@ -416,34 +417,34 @@ END GROUP .debug_sfnames *(.debug_sfnames) -.debug_aranges 0x00000000 0x68 +.debug_aranges 0x00000000 0x70 *(.debug_aranges) .debug_aranges - 0x00000000 0x68 main.o + 0x00000000 0x70 main.o .debug_pubnames *(.debug_pubnames) -.debug_info 0x00000000 0x3fa +.debug_info 0x00000000 0x410 *(.debug_info .gnu.linkonce.wi.*) - .debug_info 0x00000000 0x3fa main.o + .debug_info 0x00000000 0x410 main.o -.debug_abbrev 0x00000000 0x1cb +.debug_abbrev 0x00000000 0x1e3 *(.debug_abbrev) - .debug_abbrev 0x00000000 0x1cb main.o + .debug_abbrev 0x00000000 0x1e3 main.o -.debug_line 0x00000000 0x333 +.debug_line 0x00000000 0x3b0 *(.debug_line .debug_line.* .debug_line_end) - .debug_line 0x00000000 0x333 main.o + .debug_line 0x00000000 0x3b0 main.o -.debug_frame 0x00000000 0xdc +.debug_frame 0x00000000 0xec *(.debug_frame) - .debug_frame 0x00000000 0xdc main.o + .debug_frame 0x00000000 0xec main.o -.debug_str 0x00000000 0x207 +.debug_str 0x00000000 0x216 *(.debug_str) - .debug_str 0x00000000 0x207 main.o - 0x23b (size before relaxing) + .debug_str 0x00000000 0x216 main.o + 0x24a (size before relaxing) .debug_loc 0x00000000 0x163 *(.debug_loc) @@ -467,9 +468,9 @@ END GROUP .debug_pubtypes *(.debug_pubtypes) -.debug_ranges 0x00000000 0x58 +.debug_ranges 0x00000000 0x60 *(.debug_ranges) - .debug_ranges 0x00000000 0x58 main.o + .debug_ranges 0x00000000 0x60 main.o .debug_macro *(.debug_macro) diff --git a/MIC-Week1/Debug/MIC-Week1.srec b/MIC-Week1/Debug/MIC-Week1.srec index fb7d4dc..3bbbd9d 100644 --- a/MIC-Week1/Debug/MIC-Week1.srec +++ b/MIC-Week1/Debug/MIC-Week1.srec @@ -3,36 +3,35 @@ S113000045C0000060C000005EC000005CC000008D S11300105AC0000058C0000056C0000054C0000080 S113002052C0000050C000004EC000004CC0000090 S11300304AC0000048C0000046C0000044C00000A0 -S113004068C0000040C000003EC000003CC000008A +S113004043C0000040C000003EC000003CC00000AF S11300503AC0000038C0000036C0000034C00000C0 S113006032C0000030C000002EC000002CC00000D0 S11300702AC0000028C0000026C0000024C00000E0 S113008022C0000020C000001EC0000011241FBEBA -S1130090CFEFD0E1DEBFCDBF11E0A0E0B1E0E6E2FA +S1130090CFEFD0E1DEBFCDBF11E0A0E0B1E0E4E1FD S11300A0F2E000E00BBF02C007900D92A230B1074E S11300B0D9F721E0A2E0B1E001C01D92A830B20757 -S11300C0E1F7A2D0AEC09CCF181619060CF520910A -S11300D00601309107012130310551F020E030E074 -S11300E00CC040910601509107014130510529F49B -S11300F010920701109206010895EFECF7E0319792 -S1130100F1F700C000002F5F3F4F2817390749F768 -S113011008951F920F920FB60F9211242F938F936D -S11301209F93989B1AC08091040190910501892B9B -S1130130A1F48091000190910101880F991F90937F -S113014001018093000181E090E090930701809386 -S113015006019093050180930401999B1DC0809131 -S1130160020190910301892BB9F4809100019091CF -S1130170010199230CF401969595879590930101BB -S11301808093000181E090E0909307018093060141 -S1130190909303018093020183B3811108C01092EC -S11301A00501109204011092030110920201809142 -S11301B0000190910101843191053CF484E190E0C7 -S11301C0909301018093000109C0813A9F4034F06B -S11301D080EA9FE090930101809300019F918F91A9 -S11301E02F910F900FBE0F901F90189580E882BB3F -S11301F0809100019091010167DF12BA80910001A2 -S11302009091010161CF089514BA8FEF81BB83B738 -S1130210836083BF87B7816087BF12BE7894E6DFAF -S1090220FECFF894FFCFAD -S1050226E803E7 +S11300C0E1F799D0A5C09CCF1F920F920FB60F9263 +S11300D011242F938F939F93989B1AC080910401AE +S11300E090910501892BA1F4809100019091010167 +S11300F0880F991F909301018093000181E090E0A3 +S11301009093070180930601909305018093040165 +S1130110999B1DC08091020190910301892BB9F430 +S1130120809100019091010199230CF40196959519 +S11301308795909301018093000181E090E0909372 +S1130140070180930601909303018093020183B316 +S1130150811108C01092050110920401109203014C +S11301601092020180910001909101018431910566 +S11301703CF484E190E0909301018093000109C074 +S1130180813A9F4034F080EA9FE09093010180938C +S113019000019F918F912F910F900FBE0F901F9090 +S11301A01895989B05C083E081BB81E082BB0895CC +S11301B0999B05C083E081BB82E082BB08959A9B32 +S11301C005C086E081BB82E082BB08959B9B05C08D +S11301D086E081BB84E082BB08959C9B05C085E0DA +S11301E081BB84E082BB08959D9B04C085E081BBF4 +S11301F081E082BB089514BA8FEF81BB83B783601B +S113020083BF87B7816087BF12BE7894CADFFECFF1 +S1070210F894FFCF8C +S1050214E803F9 S9030000FC diff --git a/MIC-Week1/main.c b/MIC-Week1/main.c index 034cb38..779bd86 100644 --- a/MIC-Week1/main.c +++ b/MIC-Week1/main.c @@ -97,7 +97,7 @@ int main(void) DDRC = 0b00000000; //input DDRD = 0b11111111; //output - // Prescaler = FCPU/8000000 + // Prescaler TCCR0 |= (1 << CS01) | (1 << CS00); //Enable Overflow Interrupt Enable TIMSK|=(1< Date: Mon, 15 Feb 2016 14:20:45 +0100 Subject: [PATCH 6/6] Opgave 4 aangepast --- MIC-Week1/Debug/MIC-Week1.lss | 414 +++++++++++++++++---------------- MIC-Week1/Debug/MIC-Week1.map | 82 +++---- MIC-Week1/Debug/MIC-Week1.srec | 56 ++--- MIC-Week1/main.c | 19 +- 4 files changed, 294 insertions(+), 277 deletions(-) diff --git a/MIC-Week1/Debug/MIC-Week1.lss b/MIC-Week1/Debug/MIC-Week1.lss index 35b1ca2..4d6b9c4 100644 --- a/MIC-Week1/Debug/MIC-Week1.lss +++ b/MIC-Week1/Debug/MIC-Week1.lss @@ -3,31 +3,31 @@ MIC-Week1.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .data 00000002 00800100 00000214 000002a8 2**0 + 0 .data 00000002 00800100 00000252 000002e6 2**0 CONTENTS, ALLOC, LOAD, DATA - 1 .text 00000214 00000000 00000000 00000094 2**1 + 1 .text 00000252 00000000 00000000 00000094 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 2 .bss 00000006 00800102 00800102 000002aa 2**0 + 2 .bss 00000008 00800102 00800102 000002e8 2**0 ALLOC - 3 .comment 00000030 00000000 00000000 000002aa 2**0 + 3 .comment 00000030 00000000 00000000 000002e8 2**0 CONTENTS, READONLY - 4 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 000002dc 2**2 + 4 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00000318 2**2 CONTENTS, READONLY - 5 .debug_aranges 00000070 00000000 00000000 00000318 2**0 + 5 .debug_aranges 00000070 00000000 00000000 00000354 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_info 00000410 00000000 00000000 00000388 2**0 + 6 .debug_info 00000422 00000000 00000000 000003c4 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_abbrev 000001e3 00000000 00000000 00000798 2**0 + 7 .debug_abbrev 000001e3 00000000 00000000 000007e6 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_line 000003b0 00000000 00000000 0000097b 2**0 + 8 .debug_line 000003ce 00000000 00000000 000009c9 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_frame 000000ec 00000000 00000000 00000d2c 2**2 + 9 .debug_frame 000000ec 00000000 00000000 00000d98 2**2 CONTENTS, READONLY, DEBUGGING - 10 .debug_str 00000216 00000000 00000000 00000e18 2**0 + 10 .debug_str 00000220 00000000 00000000 00000e84 2**0 CONTENTS, READONLY, DEBUGGING - 11 .debug_loc 00000163 00000000 00000000 0000102e 2**0 + 11 .debug_loc 00000163 00000000 00000000 000010a4 2**0 CONTENTS, READONLY, DEBUGGING - 12 .debug_ranges 00000060 00000000 00000000 00001191 2**0 + 12 .debug_ranges 00000060 00000000 00000000 00001207 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -65,7 +65,7 @@ Disassembly of section .text: 3a: 00 00 nop 3c: 44 c0 rjmp .+136 ; 0xc6 <__bad_interrupt> 3e: 00 00 nop - 40: 43 c0 rjmp .+134 ; 0xc8 <__vector_16> + 40: 68 c0 rjmp .+208 ; 0x112 <__vector_16> 42: 00 00 nop 44: 40 c0 rjmp .+128 ; 0xc6 <__bad_interrupt> 46: 00 00 nop @@ -116,7 +116,7 @@ Disassembly of section .text: 98: 11 e0 ldi r17, 0x01 ; 1 9a: a0 e0 ldi r26, 0x00 ; 0 9c: b1 e0 ldi r27, 0x01 ; 1 - 9e: e4 e1 ldi r30, 0x14 ; 20 + 9e: e2 e5 ldi r30, 0x52 ; 82 a0: f2 e0 ldi r31, 0x02 ; 2 a2: 00 e0 ldi r16, 0x00 ; 0 a4: 0b bf out 0x3b, r16 ; 59 @@ -137,232 +137,234 @@ Disassembly of section .text: ba: 1d 92 st X+, r1 000000bc <.do_clear_bss_start>: - bc: a8 30 cpi r26, 0x08 ; 8 + bc: aa 30 cpi r26, 0x0A ; 10 be: b2 07 cpc r27, r18 c0: e1 f7 brne .-8 ; 0xba <.do_clear_bss_loop> - c2: 99 d0 rcall .+306 ; 0x1f6
- c4: a5 c0 rjmp .+330 ; 0x210 <_exit> + c2: b6 d0 rcall .+364 ; 0x230
+ c4: c4 c0 rjmp .+392 ; 0x24e <_exit> 000000c6 <__bad_interrupt>: c6: 9c cf rjmp .-200 ; 0x0 <__vectors> -000000c8 <__vector_16>: -void opgave6(void) -{ - PORTD = 0b10000000; - wait( blink ); - PORTD = 0b00000000; - wait( blink ); - c8: 1f 92 push r1 - ca: 0f 92 push r0 - cc: 0f b6 in r0, 0x3f ; 63 - ce: 0f 92 push r0 - d0: 11 24 eor r1, r1 - d2: 2f 93 push r18 - d4: 8f 93 push r24 - d6: 9f 93 push r25 - d8: 98 9b sbis 0x13, 0 ; 19 - da: 1a c0 rjmp .+52 ; 0x110 <__vector_16+0x48> - dc: 80 91 04 01 lds r24, 0x0104 - e0: 90 91 05 01 lds r25, 0x0105 - e4: 89 2b or r24, r25 - e6: a1 f4 brne .+40 ; 0x110 <__vector_16+0x48> - e8: 80 91 00 01 lds r24, 0x0100 - ec: 90 91 01 01 lds r25, 0x0101 - f0: 88 0f add r24, r24 - f2: 99 1f adc r25, r25 - f4: 90 93 01 01 sts 0x0101, r25 - f8: 80 93 00 01 sts 0x0100, r24 - fc: 81 e0 ldi r24, 0x01 ; 1 - fe: 90 e0 ldi r25, 0x00 ; 0 - 100: 90 93 07 01 sts 0x0107, r25 - 104: 80 93 06 01 sts 0x0106, r24 - 108: 90 93 05 01 sts 0x0105, r25 - 10c: 80 93 04 01 sts 0x0104, r24 - 110: 99 9b sbis 0x13, 1 ; 19 - 112: 1d c0 rjmp .+58 ; 0x14e <__vector_16+0x86> - 114: 80 91 02 01 lds r24, 0x0102 - 118: 90 91 03 01 lds r25, 0x0103 - 11c: 89 2b or r24, r25 - 11e: b9 f4 brne .+46 ; 0x14e <__vector_16+0x86> - 120: 80 91 00 01 lds r24, 0x0100 - 124: 90 91 01 01 lds r25, 0x0101 - 128: 99 23 and r25, r25 - 12a: 0c f4 brge .+2 ; 0x12e <__vector_16+0x66> - 12c: 01 96 adiw r24, 0x01 ; 1 - 12e: 95 95 asr r25 - 130: 87 95 ror r24 - 132: 90 93 01 01 sts 0x0101, r25 - 136: 80 93 00 01 sts 0x0100, r24 - 13a: 81 e0 ldi r24, 0x01 ; 1 - 13c: 90 e0 ldi r25, 0x00 ; 0 - 13e: 90 93 07 01 sts 0x0107, r25 - 142: 80 93 06 01 sts 0x0106, r24 - 146: 90 93 03 01 sts 0x0103, r25 - 14a: 80 93 02 01 sts 0x0102, r24 - 14e: 83 b3 in r24, 0x13 ; 19 - 150: 81 11 cpse r24, r1 - 152: 08 c0 rjmp .+16 ; 0x164 <__vector_16+0x9c> - 154: 10 92 05 01 sts 0x0105, r1 - 158: 10 92 04 01 sts 0x0104, r1 - 15c: 10 92 03 01 sts 0x0103, r1 - 160: 10 92 02 01 sts 0x0102, r1 - 164: 80 91 00 01 lds r24, 0x0100 - 168: 90 91 01 01 lds r25, 0x0101 - 16c: 84 31 cpi r24, 0x14 ; 20 - 16e: 91 05 cpc r25, r1 - 170: 3c f4 brge .+14 ; 0x180 <__vector_16+0xb8> - 172: 84 e1 ldi r24, 0x14 ; 20 - 174: 90 e0 ldi r25, 0x00 ; 0 - 176: 90 93 01 01 sts 0x0101, r25 - 17a: 80 93 00 01 sts 0x0100, r24 - 17e: 09 c0 rjmp .+18 ; 0x192 <__vector_16+0xca> - 180: 81 3a cpi r24, 0xA1 ; 161 - 182: 9f 40 sbci r25, 0x0F ; 15 - 184: 34 f0 brlt .+12 ; 0x192 <__vector_16+0xca> - 186: 80 ea ldi r24, 0xA0 ; 160 - 188: 9f e0 ldi r25, 0x0F ; 15 - 18a: 90 93 01 01 sts 0x0101, r25 - 18e: 80 93 00 01 sts 0x0100, r24 - 192: 9f 91 pop r25 - 194: 8f 91 pop r24 - 196: 2f 91 pop r18 - 198: 0f 90 pop r0 - 19a: 0f be out 0x3f, r0 ; 63 - 19c: 0f 90 pop r0 - 19e: 1f 90 pop r1 - 1a0: 18 95 reti +000000c8 : + if( (0b00000001 & PINC) != 0 ) + { + PORTD = 0b10000000; + wait( 100 ); + PORTD = 0b00000000; + wait( 100 ); + c8: 18 16 cp r1, r24 + ca: 19 06 cpc r1, r25 + cc: 0c f5 brge .+66 ; 0x110 + ce: 20 91 08 01 lds r18, 0x0108 + d2: 30 91 09 01 lds r19, 0x0109 + d6: 21 30 cpi r18, 0x01 ; 1 + d8: 31 05 cpc r19, r1 + da: 51 f0 breq .+20 ; 0xf0 + dc: 20 e0 ldi r18, 0x00 ; 0 + de: 30 e0 ldi r19, 0x00 ; 0 + e0: 0c c0 rjmp .+24 ; 0xfa + e2: 40 91 08 01 lds r20, 0x0108 + e6: 50 91 09 01 lds r21, 0x0109 + ea: 41 30 cpi r20, 0x01 ; 1 + ec: 51 05 cpc r21, r1 + ee: 29 f4 brne .+10 ; 0xfa + f0: 10 92 09 01 sts 0x0109, r1 + f4: 10 92 08 01 sts 0x0108, r1 + f8: 08 95 ret + fa: ef ec ldi r30, 0xCF ; 207 + fc: f7 e0 ldi r31, 0x07 ; 7 + fe: 31 97 sbiw r30, 0x01 ; 1 + 100: f1 f7 brne .-4 ; 0xfe + 102: 00 c0 rjmp .+0 ; 0x104 + 104: 00 00 nop + 106: 2f 5f subi r18, 0xFF ; 255 + 108: 3f 4f sbci r19, 0xFF ; 255 + 10a: 28 17 cp r18, r24 + 10c: 39 07 cpc r19, r25 + 10e: 49 f7 brne .-46 ; 0xe2 + 110: 08 95 ret -000001a2 : +00000112 <__vector_16>: + 112: 1f 92 push r1 + 114: 0f 92 push r0 + 116: 0f b6 in r0, 0x3f ; 63 + 118: 0f 92 push r0 + 11a: 11 24 eor r1, r1 + 11c: 2f 93 push r18 + 11e: 8f 93 push r24 + 120: 9f 93 push r25 + 122: 98 9b sbis 0x13, 0 ; 19 + 124: 1a c0 rjmp .+52 ; 0x15a <__vector_16+0x48> + 126: 80 91 06 01 lds r24, 0x0106 + 12a: 90 91 07 01 lds r25, 0x0107 + 12e: 89 2b or r24, r25 + 130: a1 f4 brne .+40 ; 0x15a <__vector_16+0x48> + 132: 80 91 00 01 lds r24, 0x0100 + 136: 90 91 01 01 lds r25, 0x0101 + 13a: 88 0f add r24, r24 + 13c: 99 1f adc r25, r25 + 13e: 90 93 01 01 sts 0x0101, r25 + 142: 80 93 00 01 sts 0x0100, r24 + 146: 81 e0 ldi r24, 0x01 ; 1 + 148: 90 e0 ldi r25, 0x00 ; 0 + 14a: 90 93 09 01 sts 0x0109, r25 + 14e: 80 93 08 01 sts 0x0108, r24 + 152: 90 93 07 01 sts 0x0107, r25 + 156: 80 93 06 01 sts 0x0106, r24 + 15a: 99 9b sbis 0x13, 1 ; 19 + 15c: 1d c0 rjmp .+58 ; 0x198 <__vector_16+0x86> + 15e: 80 91 04 01 lds r24, 0x0104 + 162: 90 91 05 01 lds r25, 0x0105 + 166: 89 2b or r24, r25 + 168: b9 f4 brne .+46 ; 0x198 <__vector_16+0x86> + 16a: 80 91 00 01 lds r24, 0x0100 + 16e: 90 91 01 01 lds r25, 0x0101 + 172: 99 23 and r25, r25 + 174: 0c f4 brge .+2 ; 0x178 <__vector_16+0x66> + 176: 01 96 adiw r24, 0x01 ; 1 + 178: 95 95 asr r25 + 17a: 87 95 ror r24 + 17c: 90 93 01 01 sts 0x0101, r25 + 180: 80 93 00 01 sts 0x0100, r24 + 184: 81 e0 ldi r24, 0x01 ; 1 + 186: 90 e0 ldi r25, 0x00 ; 0 + 188: 90 93 09 01 sts 0x0109, r25 + 18c: 80 93 08 01 sts 0x0108, r24 + 190: 90 93 05 01 sts 0x0105, r25 + 194: 80 93 04 01 sts 0x0104, r24 + 198: 83 b3 in r24, 0x13 ; 19 + 19a: 81 11 cpse r24, r1 + 19c: 08 c0 rjmp .+16 ; 0x1ae <__vector_16+0x9c> + 19e: 10 92 07 01 sts 0x0107, r1 + 1a2: 10 92 06 01 sts 0x0106, r1 + 1a6: 10 92 05 01 sts 0x0105, r1 + 1aa: 10 92 04 01 sts 0x0104, r1 + 1ae: 80 91 00 01 lds r24, 0x0100 + 1b2: 90 91 01 01 lds r25, 0x0101 + 1b6: 84 31 cpi r24, 0x14 ; 20 + 1b8: 91 05 cpc r25, r1 + 1ba: 3c f4 brge .+14 ; 0x1ca <__vector_16+0xb8> + 1bc: 84 e1 ldi r24, 0x14 ; 20 + 1be: 90 e0 ldi r25, 0x00 ; 0 + 1c0: 90 93 01 01 sts 0x0101, r25 + 1c4: 80 93 00 01 sts 0x0100, r24 + 1c8: 09 c0 rjmp .+18 ; 0x1dc <__vector_16+0xca> + 1ca: 81 3a cpi r24, 0xA1 ; 161 + 1cc: 9f 40 sbci r25, 0x0F ; 15 + 1ce: 34 f0 brlt .+12 ; 0x1dc <__vector_16+0xca> + 1d0: 80 ea ldi r24, 0xA0 ; 160 + 1d2: 9f e0 ldi r25, 0x0F ; 15 + 1d4: 90 93 01 01 sts 0x0101, r25 + 1d8: 80 93 00 01 sts 0x0100, r24 + 1dc: 9f 91 pop r25 + 1de: 8f 91 pop r24 + 1e0: 2f 91 pop r18 + 1e2: 0f 90 pop r0 + 1e4: 0f be out 0x3f, r0 ; 63 + 1e6: 0f 90 pop r0 + 1e8: 1f 90 pop r1 + 1ea: 18 95 reti + +000001ec : + } } -void charlieplexing(void) +void opgave4(void) { - //Button C0 - if( (0b00000001 & PINC) != 0) - 1a2: 98 9b sbis 0x13, 0 ; 19 - 1a4: 05 c0 rjmp .+10 ; 0x1b0 + wait( 50 ); + 1ec: 82 e3 ldi r24, 0x32 ; 50 + 1ee: 90 e0 ldi r25, 0x00 ; 0 + 1f0: 6b df rcall .-298 ; 0xc8 + if (PORTD>= 0x80) + 1f2: 97 9b sbis 0x12, 7 ; 18 + 1f4: 07 c0 rjmp .+14 ; 0x204 { - DDRD = 0b00000011; //PIN 1 & 2 as output. Pin 3 as input (TRI-STATE) - 1a6: 83 e0 ldi r24, 0x03 ; 3 - 1a8: 81 bb out 0x11, r24 ; 17 - PORTD = 0b00000001; //PIN 1 High, PIN 2 Low - 1aa: 81 e0 ldi r24, 0x01 ; 1 - 1ac: 82 bb out 0x12, r24 ; 18 - 1ae: 08 95 ret + direction = 1; + 1f6: 81 e0 ldi r24, 0x01 ; 1 + 1f8: 90 e0 ldi r25, 0x00 ; 0 + 1fa: 90 93 03 01 sts 0x0103, r25 + 1fe: 80 93 02 01 sts 0x0102, r24 + 202: 0e c0 rjmp .+28 ; 0x220 + } + else if (PORTD <= 0x1) + 204: 82 b3 in r24, 0x12 ; 18 + 206: 82 30 cpi r24, 0x02 ; 2 + 208: 28 f4 brcc .+10 ; 0x214 + { + direction = 0; + 20a: 10 92 03 01 sts 0x0103, r1 + 20e: 10 92 02 01 sts 0x0102, r1 + 212: 0a c0 rjmp .+20 ; 0x228 } - //Button C1 - else if( (0b00000010 & PINC) != 0) - 1b0: 99 9b sbis 0x13, 1 ; 19 - 1b2: 05 c0 rjmp .+10 ; 0x1be - { - DDRD = 0b00000011; //PIN 1 & 2 as output. Pin 3 as input (TRI-STATE) - 1b4: 83 e0 ldi r24, 0x03 ; 3 - 1b6: 81 bb out 0x11, r24 ; 17 - PORTD = 0b00000010; //PIN 2 High, PIN 1 Low - 1b8: 82 e0 ldi r24, 0x02 ; 2 - 1ba: 82 bb out 0x12, r24 ; 18 - 1bc: 08 95 ret - } + if(direction) + 214: 80 91 02 01 lds r24, 0x0102 + 218: 90 91 03 01 lds r25, 0x0103 + 21c: 89 2b or r24, r25 + 21e: 21 f0 breq .+8 ; 0x228 + PORTD = (PORTD>>1); + 220: 82 b3 in r24, 0x12 ; 18 + 222: 86 95 lsr r24 + 224: 82 bb out 0x12, r24 ; 18 + 226: 08 95 ret + else + PORTD = (PORTD<<1); + 228: 82 b3 in r24, 0x12 ; 18 + 22a: 88 0f add r24, r24 + 22c: 82 bb out 0x12, r24 ; 18 + 22e: 08 95 ret - //Button C2 - else if( (0b00000100 & PINC) != 0) - 1be: 9a 9b sbis 0x13, 2 ; 19 - 1c0: 05 c0 rjmp .+10 ; 0x1cc - { - DDRD = 0b00000110; //PIN 2 & 3 as output. Pin 1 as input (TRI-STATE) - 1c2: 86 e0 ldi r24, 0x06 ; 6 - 1c4: 81 bb out 0x11, r24 ; 17 - PORTD = 0b00000010; //PIN 2 High, PIN 3 Low - 1c6: 82 e0 ldi r24, 0x02 ; 2 - 1c8: 82 bb out 0x12, r24 ; 18 - 1ca: 08 95 ret - } - - //Button C3 - else if( (0b00001000 & PINC) != 0) - 1cc: 9b 9b sbis 0x13, 3 ; 19 - 1ce: 05 c0 rjmp .+10 ; 0x1da - { - DDRD = 0b00000110; //PIN 2 & 3 as output. Pin 1 as input (TRI-STATE) - 1d0: 86 e0 ldi r24, 0x06 ; 6 - 1d2: 81 bb out 0x11, r24 ; 17 - PORTD = 0b00000100; //PIN 3 High, PIN 2 Low - 1d4: 84 e0 ldi r24, 0x04 ; 4 - 1d6: 82 bb out 0x12, r24 ; 18 - 1d8: 08 95 ret - } - - //Button C4 - else if( (0b00010000 & PINC) != 0) - 1da: 9c 9b sbis 0x13, 4 ; 19 - 1dc: 05 c0 rjmp .+10 ; 0x1e8 - { - DDRD = 0b00000101; //PIN 3 & 1 as output. Pin 2 as input (TRI-STATE) - 1de: 85 e0 ldi r24, 0x05 ; 5 - 1e0: 81 bb out 0x11, r24 ; 17 - PORTD = 0b00000100; //PIN 3 High, PIN 1 Low - 1e2: 84 e0 ldi r24, 0x04 ; 4 - 1e4: 82 bb out 0x12, r24 ; 18 - 1e6: 08 95 ret - } - - //Button C5 - else if( (0b00100000 & PINC) != 0) - 1e8: 9d 9b sbis 0x13, 5 ; 19 - 1ea: 04 c0 rjmp .+8 ; 0x1f4 - { - DDRD = 0b00000101; //PIN 3 & 1 as output. Pin 2 as input (TRI-STATE) - 1ec: 85 e0 ldi r24, 0x05 ; 5 - 1ee: 81 bb out 0x11, r24 ; 17 - PORTD = 0b00000001; //PIN 1 High, PIN 3 Low - 1f0: 81 e0 ldi r24, 0x01 ; 1 - 1f2: 82 bb out 0x12, r24 ; 18 - 1f4: 08 95 ret - -000001f6
: +00000230
: } } int main(void) { DDRC = 0b00000000; //input - 1f6: 14 ba out 0x14, r1 ; 20 + 230: 14 ba out 0x14, r1 ; 20 DDRD = 0b11111111; //output - 1f8: 8f ef ldi r24, 0xFF ; 255 - 1fa: 81 bb out 0x11, r24 ; 17 + 232: 8f ef ldi r24, 0xFF ; 255 + 234: 81 bb out 0x11, r24 ; 17 // Prescaler TCCR0 |= (1 << CS01) | (1 << CS00); - 1fc: 83 b7 in r24, 0x33 ; 51 - 1fe: 83 60 ori r24, 0x03 ; 3 - 200: 83 bf out 0x33, r24 ; 51 + 236: 83 b7 in r24, 0x33 ; 51 + 238: 83 60 ori r24, 0x03 ; 3 + 23a: 83 bf out 0x33, r24 ; 51 //Enable Overflow Interrupt Enable TIMSK|=(1< //opgave6(); - charlieplexing(); - 20c: ca df rcall .-108 ; 0x1a2 + //charlieplexing(); //extraopgave(); } - 20e: fe cf rjmp .-4 ; 0x20c + 24c: fe cf rjmp .-4 ; 0x24a -00000210 <_exit>: - 210: f8 94 cli +0000024e <_exit>: + 24e: f8 94 cli -00000212 <__stop_program>: - 212: ff cf rjmp .-2 ; 0x212 <__stop_program> +00000250 <__stop_program>: + 250: ff cf rjmp .-2 ; 0x250 <__stop_program> diff --git a/MIC-Week1/Debug/MIC-Week1.map b/MIC-Week1/Debug/MIC-Week1.map index e2aa74a..0d2151c 100644 --- a/MIC-Week1/Debug/MIC-Week1.map +++ b/MIC-Week1/Debug/MIC-Week1.map @@ -14,15 +14,15 @@ Discarded input sections .text 0x00000000 0x0 main.o .data 0x00000000 0x0 main.o .bss 0x00000000 0x0 main.o - .text.wait 0x00000000 0x4a main.o .text.speaker 0x00000000 0x1e main.o .text.extraopgave 0x00000000 0x10 main.o .text.opgave1 0x00000000 0x1a main.o .text.opgave3 0x00000000 0x1c main.o - .text.opgave4 0x00000000 0x1a main.o .text.opgave5 0x00000000 0x8a main.o .text.opgave6 0x00000000 0x20 main.o + .text.charlieplexing + 0x00000000 0x54 main.o .data.speed 0x00000000 0x2 main.o .bss.count 0x00000000 0x2 main.o .data.pattern 0x00000000 0x4b main.o @@ -192,7 +192,7 @@ END GROUP .rela.plt *(.rela.plt) -.text 0x00000000 0x214 +.text 0x00000000 0x252 *(.vectors) .vectors 0x00000000 0x8c C:/Program Files (x86)/Atmel/Studio/7.0/Packs/Atmel/ATmega_DFP/1.0.91/gcc/dev/atmega128/avr51/crtatmega128.o 0x00000000 __vector_default @@ -285,19 +285,20 @@ END GROUP 0x000000c6 __vector_20 0x000000c8 . = ALIGN (0x2) *(.text.*) + .text.wait 0x000000c8 0x4a main.o + 0x000000c8 wait .text.__vector_16 - 0x000000c8 0xda main.o - 0x000000c8 __vector_16 - .text.charlieplexing - 0x000001a2 0x54 main.o - 0x000001a2 charlieplexing - .text.main 0x000001f6 0x1a main.o - 0x000001f6 main - 0x00000210 . = ALIGN (0x2) + 0x00000112 0xda main.o + 0x00000112 __vector_16 + .text.opgave4 0x000001ec 0x44 main.o + 0x000001ec opgave4 + .text.main 0x00000230 0x1e main.o + 0x00000230 main + 0x0000024e . = ALIGN (0x2) *(.fini9) - .fini9 0x00000210 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) - 0x00000210 _exit - 0x00000210 exit + .fini9 0x0000024e 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) + 0x0000024e _exit + 0x0000024e exit *(.fini9) *(.fini8) *(.fini8) @@ -316,11 +317,11 @@ END GROUP *(.fini1) *(.fini1) *(.fini0) - .fini0 0x00000210 0x4 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) + .fini0 0x0000024e 0x4 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o) *(.fini0) - 0x00000214 _etext = . + 0x00000252 _etext = . -.data 0x00800100 0x2 load address 0x00000214 +.data 0x00800100 0x2 load address 0x00000252 0x00800100 PROVIDE (__data_start, .) *(.data) *(.data*) @@ -333,27 +334,30 @@ END GROUP 0x00800102 _edata = . 0x00800102 PROVIDE (__data_end, .) -.bss 0x00800102 0x6 +.bss 0x00800102 0x8 0x00800102 PROVIDE (__bss_start, .) *(.bss) *(.bss*) - .bss.b2 0x00800102 0x2 main.o - 0x00800102 b2 - .bss.b1 0x00800104 0x2 main.o - 0x00800104 b1 - .bss.reset 0x00800106 0x2 main.o - 0x00800106 reset + .bss.direction + 0x00800102 0x2 main.o + 0x00800102 direction + .bss.b2 0x00800104 0x2 main.o + 0x00800104 b2 + .bss.b1 0x00800106 0x2 main.o + 0x00800106 b1 + .bss.reset 0x00800108 0x2 main.o + 0x00800108 reset *(COMMON) - 0x00800108 PROVIDE (__bss_end, .) - 0x00000214 __data_load_start = LOADADDR (.data) - 0x00000216 __data_load_end = (__data_load_start + SIZEOF (.data)) + 0x0080010a PROVIDE (__bss_end, .) + 0x00000252 __data_load_start = LOADADDR (.data) + 0x00000254 __data_load_end = (__data_load_start + SIZEOF (.data)) -.noinit 0x00800108 0x0 - 0x00800108 PROVIDE (__noinit_start, .) +.noinit 0x0080010a 0x0 + 0x0080010a PROVIDE (__noinit_start, .) *(.noinit*) - 0x00800108 PROVIDE (__noinit_end, .) - 0x00800108 _end = . - 0x00800108 PROVIDE (__heap_start, .) + 0x0080010a PROVIDE (__noinit_end, .) + 0x0080010a _end = . + 0x0080010a PROVIDE (__heap_start, .) .eeprom 0x00810000 0x0 *(.eeprom*) @@ -425,26 +429,26 @@ END GROUP .debug_pubnames *(.debug_pubnames) -.debug_info 0x00000000 0x410 +.debug_info 0x00000000 0x422 *(.debug_info .gnu.linkonce.wi.*) - .debug_info 0x00000000 0x410 main.o + .debug_info 0x00000000 0x422 main.o .debug_abbrev 0x00000000 0x1e3 *(.debug_abbrev) .debug_abbrev 0x00000000 0x1e3 main.o -.debug_line 0x00000000 0x3b0 +.debug_line 0x00000000 0x3ce *(.debug_line .debug_line.* .debug_line_end) - .debug_line 0x00000000 0x3b0 main.o + .debug_line 0x00000000 0x3ce main.o .debug_frame 0x00000000 0xec *(.debug_frame) .debug_frame 0x00000000 0xec main.o -.debug_str 0x00000000 0x216 +.debug_str 0x00000000 0x220 *(.debug_str) - .debug_str 0x00000000 0x216 main.o - 0x24a (size before relaxing) + .debug_str 0x00000000 0x220 main.o + 0x254 (size before relaxing) .debug_loc 0x00000000 0x163 *(.debug_loc) diff --git a/MIC-Week1/Debug/MIC-Week1.srec b/MIC-Week1/Debug/MIC-Week1.srec index 3bbbd9d..f3fba6e 100644 --- a/MIC-Week1/Debug/MIC-Week1.srec +++ b/MIC-Week1/Debug/MIC-Week1.srec @@ -3,35 +3,39 @@ S113000045C0000060C000005EC000005CC000008D S11300105AC0000058C0000056C0000054C0000080 S113002052C0000050C000004EC000004CC0000090 S11300304AC0000048C0000046C0000044C00000A0 -S113004043C0000040C000003EC000003CC00000AF +S113004068C0000040C000003EC000003CC000008A S11300503AC0000038C0000036C0000034C00000C0 S113006032C0000030C000002EC000002CC00000D0 S11300702AC0000028C0000026C0000024C00000E0 S113008022C0000020C000001EC0000011241FBEBA -S1130090CFEFD0E1DEBFCDBF11E0A0E0B1E0E4E1FD +S1130090CFEFD0E1DEBFCDBF11E0A0E0B1E0E2E5FB S11300A0F2E000E00BBF02C007900D92A230B1074E -S11300B0D9F721E0A2E0B1E001C01D92A830B20757 -S11300C0E1F799D0A5C09CCF1F920F920FB60F9263 -S11300D011242F938F939F93989B1AC080910401AE -S11300E090910501892BA1F4809100019091010167 -S11300F0880F991F909301018093000181E090E0A3 -S11301009093070180930601909305018093040165 -S1130110999B1DC08091020190910301892BB9F430 -S1130120809100019091010199230CF40196959519 -S11301308795909301018093000181E090E0909372 -S1130140070180930601909303018093020183B316 -S1130150811108C01092050110920401109203014C -S11301601092020180910001909101018431910566 -S11301703CF484E190E0909301018093000109C074 -S1130180813A9F4034F080EA9FE09093010180938C -S113019000019F918F912F910F900FBE0F901F9090 -S11301A01895989B05C083E081BB81E082BB0895CC -S11301B0999B05C083E081BB82E082BB08959A9B32 -S11301C005C086E081BB82E082BB08959B9B05C08D -S11301D086E081BB84E082BB08959C9B05C085E0DA -S11301E081BB84E082BB08959D9B04C085E081BBF4 -S11301F081E082BB089514BA8FEF81BB83B783601B -S113020083BF87B7816087BF12BE7894CADFFECFF1 -S1070210F894FFCF8C -S1050214E803F9 +S11300B0D9F721E0A2E0B1E001C01D92AA30B20755 +S11300C0E1F7B6D0C4C09CCF181619060CF52091E0 +S11300D00801309109012130310551F020E030E070 +S11300E00CC040910801509109014130510529F497 +S11300F010920901109208010895EFECF7E031978E +S1130100F1F700C000002F5F3F4F2817390749F768 +S113011008951F920F920FB60F9211242F938F936D +S11301209F93989B1AC08091060190910701892B97 +S1130130A1F48091000190910101880F991F90937F +S113014001018093000181E090E090930901809384 +S113015008019093070180930601999B1DC080912B +S1130160040190910501892BB9F4809100019091CB +S1130170010199230CF401969595879590930101BB +S11301808093000181E090E090930901809308013D +S1130190909305018093040183B3811108C01092E8 +S11301A0070110920601109205011092040180913A +S11301B0000190910101843191053CF484E190E0C7 +S11301C0909301018093000109C0813A9F4034F06B +S11301D080EA9FE090930101809300019F918F91A9 +S11301E02F910F900FBE0F901F90189582E390E00F +S11301F06BDF979B07C081E090E0909303018093AD +S113020002010EC082B3823028F4109203011092CE +S113021002010AC08091020190910301892B21F00F +S113022082B3869582BB089582B3880F82BB0895FA +S113023014BA8FEF81BB83B7836083BF87B78160B4 +S113024087BF12BE789481E082BBD0DFFECFF894E2 +S1050250FFCFDA +S1050252E803BB S9030000FC diff --git a/MIC-Week1/main.c b/MIC-Week1/main.c index 779bd86..a429727 100644 --- a/MIC-Week1/main.c +++ b/MIC-Week1/main.c @@ -59,6 +59,7 @@ int speed = 1; int blink = 1000; int b1 = 0; int b2 = 0; +int direction = 0; ISR(TIMER0_OVF_vect) { @@ -107,18 +108,18 @@ int main(void) sei(); //Alleen voor opgave 4 - //PORTC = 0x1; + PORTD = 0x1; while (1) { //opgave1(); //opgave2(); //opgave3(); - //opgave4(); + opgave4(); //opgave5(); //opgave6(); - charlieplexing(); + //charlieplexing(); //extraopgave(); } @@ -167,12 +168,18 @@ void opgave4(void) wait( 50 ); if (PORTD>= 0x80) { - PORTD= 0x1; + direction = 1; } - else + else if (PORTD <= 0x1) { - PORTD = (PORTD<<1); + direction = 0; } + + if(direction) + PORTD = (PORTD>>1); + else + PORTD = (PORTD<<1); + } void opgave5(void)