diff --git a/Microcontrollers/Microcontrollers.atsln b/Microcontrollers/Microcontrollers.atsln index 32d8297..4439245 100644 --- a/Microcontrollers/Microcontrollers.atsln +++ b/Microcontrollers/Microcontrollers.atsln @@ -25,6 +25,8 @@ Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "testlcd", "testlcd\testlcd. EndProject Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 3.2", "opdracht 3.2\opdracht 3.2.cproj", "{EB7415C6-2130-46AD-9842-612C67ADE6D4}" EndProject +Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht C", "opdracht C\opdracht C.cproj", "{2DF6F5F3-181F-430E-B49A-3D9794F91482}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|AVR = Debug|AVR @@ -75,6 +77,10 @@ Global {EB7415C6-2130-46AD-9842-612C67ADE6D4}.Debug|AVR.Build.0 = Debug|AVR {EB7415C6-2130-46AD-9842-612C67ADE6D4}.Release|AVR.ActiveCfg = Release|AVR {EB7415C6-2130-46AD-9842-612C67ADE6D4}.Release|AVR.Build.0 = Release|AVR + {2DF6F5F3-181F-430E-B49A-3D9794F91482}.Debug|AVR.ActiveCfg = Debug|AVR + {2DF6F5F3-181F-430E-B49A-3D9794F91482}.Debug|AVR.Build.0 = Debug|AVR + {2DF6F5F3-181F-430E-B49A-3D9794F91482}.Release|AVR.ActiveCfg = Release|AVR + {2DF6F5F3-181F-430E-B49A-3D9794F91482}.Release|AVR.Build.0 = Release|AVR EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Microcontrollers/Opdracht 2.2/Debug/Opdracht 2.2.eep b/Microcontrollers/Opdracht 2.2/Debug/Opdracht 2.2.eep new file mode 100644 index 0000000..7c166a1 --- /dev/null +++ b/Microcontrollers/Opdracht 2.2/Debug/Opdracht 2.2.eep @@ -0,0 +1 @@ +:00000001FF diff --git a/Microcontrollers/Opdracht 2.2/Debug/Opdracht 2.2.lss b/Microcontrollers/Opdracht 2.2/Debug/Opdracht 2.2.lss new file mode 100644 index 0000000..b973cb7 --- /dev/null +++ b/Microcontrollers/Opdracht 2.2/Debug/Opdracht 2.2.lss @@ -0,0 +1,207 @@ + +Opdracht 2.2.elf: file format elf32-avr + +Sections: +Idx Name Size VMA LMA File off Algn + 0 .data 00000000 00800100 00800100 0000016c 2**0 + ALLOC, LOAD, DATA + 1 .text 000000a4 00000000 00000000 00000054 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 2 .comment 0000002f 00000000 00000000 0000016c 2**0 + CONTENTS, READONLY + 3 .debug_aranges 00000038 00000000 00000000 0000019b 2**0 + CONTENTS, READONLY, DEBUGGING + 4 .debug_info 00000b3a 00000000 00000000 000001d3 2**0 + CONTENTS, READONLY, DEBUGGING + 5 .debug_abbrev 00000819 00000000 00000000 00000d0d 2**0 + CONTENTS, READONLY, DEBUGGING + 6 .debug_line 000002da 00000000 00000000 00001526 2**0 + CONTENTS, READONLY, DEBUGGING + 7 .debug_frame 00000074 00000000 00000000 00001800 2**2 + CONTENTS, READONLY, DEBUGGING + 8 .debug_str 0000027d 00000000 00000000 00001874 2**0 + CONTENTS, READONLY, DEBUGGING + 9 .debug_loc 000000e2 00000000 00000000 00001af1 2**0 + CONTENTS, READONLY, DEBUGGING + 10 .debug_ranges 00000028 00000000 00000000 00001bd3 2**0 + CONTENTS, READONLY, DEBUGGING + 11 .text 00000004 00000114 00000114 00000168 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 12 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00001bfc 2**2 + CONTENTS, READONLY, DEBUGGING + 13 .text.__vector_2 00000028 000000a4 000000a4 000000f8 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 14 .text.__vector_3 00000028 000000cc 000000cc 00000120 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 15 .text.main 00000020 000000f4 000000f4 00000148 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + +Disassembly of section .text: + +00000000 <__vectors>: + 0: 0c 94 46 00 jmp 0x8c ; 0x8c <__ctors_end> + 4: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 8: 0c 94 52 00 jmp 0xa4 ; 0xa4 <_etext> + c: 0c 94 66 00 jmp 0xcc ; 0xcc <__vector_3> + 10: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 14: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 18: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 1c: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 20: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 24: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 28: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 2c: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 30: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 34: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 38: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 3c: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 40: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 44: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 48: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 4c: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 50: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 54: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 58: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 5c: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 60: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 64: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 68: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 6c: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 70: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 74: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 78: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 7c: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 80: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 84: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + 88: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt> + +0000008c <__ctors_end>: + 8c: 11 24 eor r1, r1 + 8e: 1f be out 0x3f, r1 ; 63 + 90: cf ef ldi r28, 0xFF ; 255 + 92: d0 e1 ldi r29, 0x10 ; 16 + 94: de bf out 0x3e, r29 ; 62 + 96: cd bf out 0x3d, r28 ; 61 + 98: 0e 94 7a 00 call 0xf4 ; 0xf4
+ 9c: 0c 94 50 00 jmp 0xa0 ; 0xa0 <_exit> + +000000a0 <_exit>: + a0: f8 94 cli + +000000a2 <__stop_program>: + a2: ff cf rjmp .-2 ; 0xa2 <__stop_program> + +Disassembly of section .text: + +00000114 <__bad_interrupt>: + 114: 0c 94 00 00 jmp 0 ; 0x0 <__TEXT_REGION_ORIGIN__> + +Disassembly of section .text.__vector_2: + +000000a4 <__vector_2>: +} +/************************************************************************/ +/* interrupt 1 +walk the light 1 down */ +/************************************************************************/ +ISR( INT1_vect ) { + a4: 1f 92 push r1 + a6: 0f 92 push r0 + a8: 0f b6 in r0, 0x3f ; 63 + aa: 0f 92 push r0 + ac: 11 24 eor r1, r1 + ae: 8f 93 push r24 + if (PORTC == 0b10000000) + b0: 85 b3 in r24, 0x15 ; 21 + b2: 80 38 cpi r24, 0x80 ; 128 + b4: 11 f4 brne .+4 ; 0xba <__vector_2+0x16> + { + PORTC == 0b00000001; + b6: 85 b3 in r24, 0x15 ; 21 + b8: 03 c0 rjmp .+6 ; 0xc0 <__vector_2+0x1c> + } else { + PORTC = PORTC << 1; + ba: 85 b3 in r24, 0x15 ; 21 + bc: 88 0f add r24, r24 + be: 85 bb out 0x15, r24 ; 21 + } + + +} + c0: 8f 91 pop r24 + c2: 0f 90 pop r0 + c4: 0f be out 0x3f, r0 ; 63 + c6: 0f 90 pop r0 + c8: 1f 90 pop r1 + ca: 18 95 reti + +Disassembly of section .text.__vector_3: + +000000cc <__vector_3>: + +/************************************************************************/ +/* interrupt 2 +walk the light 1 up */ +/************************************************************************/ +ISR( INT2_vect ) { + cc: 1f 92 push r1 + ce: 0f 92 push r0 + d0: 0f b6 in r0, 0x3f ; 63 + d2: 0f 92 push r0 + d4: 11 24 eor r1, r1 + d6: 8f 93 push r24 + if (PORTC == 0b00000001) + d8: 85 b3 in r24, 0x15 ; 21 + da: 81 30 cpi r24, 0x01 ; 1 + dc: 11 f4 brne .+4 ; 0xe2 <__vector_3+0x16> + { + PORTC = 0b10000000; + de: 80 e8 ldi r24, 0x80 ; 128 + e0: 85 bb out 0x15, r24 ; 21 + } + PORTC = PORTC >> 1; + e2: 85 b3 in r24, 0x15 ; 21 + e4: 86 95 lsr r24 + e6: 85 bb out 0x15, r24 ; 21 +} + e8: 8f 91 pop r24 + ea: 0f 90 pop r0 + ec: 0f be out 0x3f, r0 ; 63 + ee: 0f 90 pop r0 + f0: 1f 90 pop r1 + f2: 18 95 reti + +Disassembly of section .text.main: + +000000f4
: +int main(void) +{ + /* Replace with your application code */ + + // Init I/O + DDRD = 0xF0; // PORTD (7:4) is output, (3:0) is input + f4: 80 ef ldi r24, 0xF0 ; 240 + f6: 81 bb out 0x11, r24 ; 17 + DDRC = 0xFF; + f8: 8f ef ldi r24, 0xFF ; 255 + fa: 84 bb out 0x14, r24 ; 20 + + // Init Interrupt hardware + EICRA |= 0x2C; // INT2 falling edge, INT1 rising edge + fc: ea e6 ldi r30, 0x6A ; 106 + fe: f0 e0 ldi r31, 0x00 ; 0 + 100: 80 81 ld r24, Z + 102: 8c 62 ori r24, 0x2C ; 44 + 104: 80 83 st Z, r24 + EIMSK |= 0x06; // Enable INT2 & INT1 + 106: 89 b7 in r24, 0x39 ; 57 + 108: 86 60 ori r24, 0x06 ; 6 + 10a: 89 bf out 0x39, r24 ; 57 + + PORTC = 0x01; // init the first bit + 10c: 81 e0 ldi r24, 0x01 ; 1 + 10e: 85 bb out 0x15, r24 ; 21 + + sei(); // enable input mechanism + 110: 78 94 sei + 112: ff cf rjmp .-2 ; 0x112 diff --git a/Microcontrollers/Opdracht 2.2/Debug/memoryfile.xml b/Microcontrollers/Opdracht 2.2/Debug/memoryfile.xml index d62a7ce..699facf 100644 --- a/Microcontrollers/Opdracht 2.2/Debug/memoryfile.xml +++ b/Microcontrollers/Opdracht 2.2/Debug/memoryfile.xml @@ -4,8 +4,8 @@ bytes 131072 - 318 - 130754 + 280 + 130792 bytes diff --git a/Microcontrollers/opdracht 2.3/Debug/opdracht 2.3.lss b/Microcontrollers/opdracht 2.3/Debug/opdracht 2.3.lss index d0ae71f..d2d828f 100644 --- a/Microcontrollers/opdracht 2.3/Debug/opdracht 2.3.lss +++ b/Microcontrollers/opdracht 2.3/Debug/opdracht 2.3.lss @@ -137,7 +137,7 @@ Disassembly of section .text: Disassembly of section .text: 000002fe <__bad_interrupt>: - 2fe: 0c 94 00 00 jmp 0 ; 0x0 <__vectors> + 2fe: 0c 94 00 00 jmp 0 ; 0x0 <__TEXT_REGION_ORIGIN__> Disassembly of section .text.__vector_1: @@ -165,13 +165,13 @@ Disassembly of section .text.__vector_1: 126: df 93 push r29 128: cd b7 in r28, 0x3d ; 61 12a: de b7 in r29, 0x3e ; 62 - 12c: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata> - 130: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1> + 12c: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <__DATA_REGION_ORIGIN__> + 130: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <__DATA_REGION_ORIGIN__+0x1> 134: 01 96 adiw r24, 0x01 ; 1 - 136: 90 93 01 01 sts 0x0101, r25 ; 0x800101 <_edata+0x1> - 13a: 80 93 00 01 sts 0x0100, r24 ; 0x800100 <_edata> - 13e: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata> - 142: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1> + 136: 90 93 01 01 sts 0x0101, r25 ; 0x800101 <__DATA_REGION_ORIGIN__+0x1> + 13a: 80 93 00 01 sts 0x0100, r24 ; 0x800100 <__DATA_REGION_ORIGIN__> + 13e: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <__DATA_REGION_ORIGIN__> + 142: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <__DATA_REGION_ORIGIN__+0x1> 146: 0e 94 3a 01 call 0x274 ; 0x274 14a: 00 00 nop 14c: df 91 pop r29 @@ -222,13 +222,13 @@ Disassembly of section .text.__vector_2: 1a6: df 93 push r29 1a8: cd b7 in r28, 0x3d ; 61 1aa: de b7 in r29, 0x3e ; 62 - 1ac: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata> - 1b0: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1> + 1ac: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <__DATA_REGION_ORIGIN__> + 1b0: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <__DATA_REGION_ORIGIN__+0x1> 1b4: 01 97 sbiw r24, 0x01 ; 1 - 1b6: 90 93 01 01 sts 0x0101, r25 ; 0x800101 <_edata+0x1> - 1ba: 80 93 00 01 sts 0x0100, r24 ; 0x800100 <_edata> - 1be: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata> - 1c2: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1> + 1b6: 90 93 01 01 sts 0x0101, r25 ; 0x800101 <__DATA_REGION_ORIGIN__+0x1> + 1ba: 80 93 00 01 sts 0x0100, r24 ; 0x800100 <__DATA_REGION_ORIGIN__> + 1be: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <__DATA_REGION_ORIGIN__> + 1c2: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <__DATA_REGION_ORIGIN__+0x1> 1c6: 0e 94 3a 01 call 0x274 ; 0x274 1ca: 00 00 nop 1cc: df 91 pop r29 @@ -361,8 +361,8 @@ Disassembly of section .text.main: 240: fc 01 movw r30, r24 242: 20 83 st Z, r18 244: 78 94 sei - 246: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata> - 24a: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1> + 246: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <__DATA_REGION_ORIGIN__> + 24a: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <__DATA_REGION_ORIGIN__+0x1> 24e: 89 2b or r24, r25 250: d1 f3 breq .-12 ; 0x246 252: 80 e3 ldi r24, 0x30 ; 48 @@ -371,10 +371,10 @@ Disassembly of section .text.main: 258: 80 81 ld r24, Z 25a: 83 30 cpi r24, 0x03 ; 3 25c: a1 f7 brne .-24 ; 0x246 - 25e: 10 92 01 01 sts 0x0101, r1 ; 0x800101 <_edata+0x1> - 262: 10 92 00 01 sts 0x0100, r1 ; 0x800100 <_edata> - 266: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata> - 26a: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1> + 25e: 10 92 01 01 sts 0x0101, r1 ; 0x800101 <__DATA_REGION_ORIGIN__+0x1> + 262: 10 92 00 01 sts 0x0100, r1 ; 0x800100 <__DATA_REGION_ORIGIN__> + 266: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <__DATA_REGION_ORIGIN__> + 26a: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <__DATA_REGION_ORIGIN__+0x1> 26e: 0e 94 3a 01 call 0x274 ; 0x274 272: e9 cf rjmp .-46 ; 0x246 diff --git a/Microcontrollers/opdracht 2.5/Debug/opdracht 2.5.lss b/Microcontrollers/opdracht 2.5/Debug/opdracht 2.5.lss index 3c1ea22..f1e3168 100644 --- a/Microcontrollers/opdracht 2.5/Debug/opdracht 2.5.lss +++ b/Microcontrollers/opdracht 2.5/Debug/opdracht 2.5.lss @@ -11,23 +11,23 @@ Idx Name Size VMA LMA File off Algn CONTENTS, READONLY 3 .debug_aranges 00000090 00000000 00000000 000002a3 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 000011bb 00000000 00000000 00000333 2**0 + 4 .debug_info 00001209 00000000 00000000 00000333 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 0000095a 00000000 00000000 000014ee 2**0 + 5 .debug_abbrev 0000095a 00000000 00000000 0000153c 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000526 00000000 00000000 00001e48 2**0 + 6 .debug_line 00000526 00000000 00000000 00001e96 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000110 00000000 00000000 00002370 2**2 + 7 .debug_frame 00000110 00000000 00000000 000023bc 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 000002ae 00000000 00000000 00002480 2**0 + 8 .debug_str 000002ae 00000000 00000000 000024cc 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 00000242 00000000 00000000 0000272e 2**0 + 9 .debug_loc 00000242 00000000 00000000 0000277a 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000070 00000000 00000000 00002970 2**0 + 10 .debug_ranges 00000070 00000000 00000000 000029bc 2**0 CONTENTS, READONLY, DEBUGGING 11 .text 00000004 0000021c 0000021c 00000270 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 12 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 000029e0 2**2 + 12 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00002a2c 2**2 CONTENTS, READONLY, DEBUGGING 13 .text.sbi_porta 00000016 000001f8 000001f8 0000024c 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE diff --git a/Microcontrollers/opdracht 2.5/opdracht 2.5.cproj b/Microcontrollers/opdracht 2.5/opdracht 2.5.cproj index ca12b1f..163526b 100644 --- a/Microcontrollers/opdracht 2.5/opdracht 2.5.cproj +++ b/Microcontrollers/opdracht 2.5/opdracht 2.5.cproj @@ -20,10 +20,10 @@ false true true - + 0x20000000 true - + exception_table 2 0 0 diff --git a/Microcontrollers/opdracht 3.2/Debug/opdracht 3.2.lss b/Microcontrollers/opdracht 3.2/Debug/opdracht 3.2.lss index 296dd5c..3c9dbb7 100644 --- a/Microcontrollers/opdracht 3.2/Debug/opdracht 3.2.lss +++ b/Microcontrollers/opdracht 3.2/Debug/opdracht 3.2.lss @@ -23,11 +23,11 @@ Idx Name Size VMA LMA File off Algn CONTENTS, READONLY, DEBUGGING 9 .debug_frame 000001b4 00000000 00000000 00002bb8 2**2 CONTENTS, READONLY, DEBUGGING - 10 .debug_str 0000051e 00000000 00000000 00002d6c 2**0 + 10 .debug_str 00000545 00000000 00000000 00002d6c 2**0 CONTENTS, READONLY, DEBUGGING - 11 .debug_loc 000003e7 00000000 00000000 0000328a 2**0 + 11 .debug_loc 000003e7 00000000 00000000 000032b1 2**0 CONTENTS, READONLY, DEBUGGING - 12 .debug_ranges 00000090 00000000 00000000 00003671 2**0 + 12 .debug_ranges 00000090 00000000 00000000 00003698 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: diff --git a/Microcontrollers/opdracht 3.2/opdracht 3.2.cproj b/Microcontrollers/opdracht 3.2/opdracht 3.2.cproj index 89335d7..8e3214a 100644 --- a/Microcontrollers/opdracht 3.2/opdracht 3.2.cproj +++ b/Microcontrollers/opdracht 3.2/opdracht 3.2.cproj @@ -28,85 +28,97 @@ 0 0 + + + + + + + + + + + + - -mmcu=atmega128 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128" - True - True - True - True - True - False - True - True - - - NDEBUG - - - - - %24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\ - - - Optimize for size (-Os) - True - True - True - - - libm - - - - - %24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\ - - - + -mmcu=atmega128 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128" + True + True + True + True + True + False + True + True + + + NDEBUG + + + + + %24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\ + + + Optimize for size (-Os) + True + True + True + + + libm + + + + + %24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\ + + + - -mmcu=atmega128 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128" - True - True - True - True - True - False - True - True - - - DEBUG - - - - - %24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\ - - - Optimize debugging experience (-Og) - True - True - Default (-g2) - True - - - libm - - - - - %24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\ - - - Default (-Wa,-g) - + -mmcu=atmega128 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128" + True + True + True + True + True + False + True + True + + + DEBUG + + + + + %24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\ + + + Optimize debugging experience (-Og) + True + True + Default (-g2) + True + + + libm + + + + + %24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\ + + + Default (-Wa,-g) + diff --git a/Microcontrollers/opdracht C/Debug/Makefile b/Microcontrollers/opdracht C/Debug/Makefile new file mode 100644 index 0000000..125106c --- /dev/null +++ b/Microcontrollers/opdracht C/Debug/Makefile @@ -0,0 +1,127 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +SHELL := cmd.exe +RM := rm -rf + +USER_OBJS := + +LIBS := +PROJ := + +O_SRCS := +C_SRCS := +S_SRCS := +S_UPPER_SRCS := +OBJ_SRCS := +ASM_SRCS := +PREPROCESSING_SRCS := +OBJS := +OBJS_AS_ARGS := +C_DEPS := +C_DEPS_AS_ARGS := +EXECUTABLES := +OUTPUT_FILE_PATH := +OUTPUT_FILE_PATH_AS_ARGS := +AVR_APP_PATH :=$$$AVR_APP_PATH$$$ +QUOTE := " +ADDITIONAL_DEPENDENCIES:= +OUTPUT_FILE_DEP:= +LIB_DEP:= +LINKER_SCRIPT_DEP:= + +# Every subdirectory with source files must be described here +SUBDIRS := + + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +../main.c + + +PREPROCESSING_SRCS += + + +ASM_SRCS += + + +OBJS += \ +main.o + +OBJS_AS_ARGS += \ +main.o + +C_DEPS += \ +main.d + +C_DEPS_AS_ARGS += \ +main.d + +OUTPUT_FILE_PATH +=opdracht\ C.elf + +OUTPUT_FILE_PATH_AS_ARGS +="opdracht C.elf" + +ADDITIONAL_DEPENDENCIES:= + +OUTPUT_FILE_DEP:= ./makedep.mk + +LIB_DEP+= + +LINKER_SCRIPT_DEP+= + + +# AVR32/GNU C Compiler +./main.o: .././main.c + @echo Building file: $< + @echo Invoking: AVR/GNU C Compiler : 5.4.0 + $(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.6.364\include" -Og -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.6.364\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 : 5.4.0 + $(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="opdracht C.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.6.364\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 "opdracht C.elf" "opdracht C.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 "opdracht C.elf" "opdracht C.eep" || exit 0 + "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objdump.exe" -h -S "opdracht C.elf" > "opdracht C.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 "opdracht C.elf" "opdracht C.srec" + "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-size.exe" "opdracht C.elf" + + + + + + + +# Other Targets +clean: + -$(RM) $(OBJS_AS_ARGS) $(EXECUTABLES) + -$(RM) $(C_DEPS_AS_ARGS) + rm -rf "opdracht C.elf" "opdracht C.a" "opdracht C.hex" "opdracht C.lss" "opdracht C.eep" "opdracht C.map" "opdracht C.srec" "opdracht C.usersignatures" + \ No newline at end of file diff --git a/Microcontrollers/opdracht C/Debug/makedep.mk b/Microcontrollers/opdracht C/Debug/makedep.mk new file mode 100644 index 0000000..6a14fde --- /dev/null +++ b/Microcontrollers/opdracht C/Debug/makedep.mk @@ -0,0 +1,6 @@ +################################################################################ +# Automatically-generated file. Do not edit or delete the file +################################################################################ + +main.c + diff --git a/Microcontrollers/opdracht C/Debug/opdracht C.eep b/Microcontrollers/opdracht C/Debug/opdracht C.eep new file mode 100644 index 0000000..7c166a1 --- /dev/null +++ b/Microcontrollers/opdracht C/Debug/opdracht C.eep @@ -0,0 +1 @@ +:00000001FF diff --git a/Microcontrollers/opdracht C/Debug/opdracht C.lss b/Microcontrollers/opdracht C/Debug/opdracht C.lss new file mode 100644 index 0000000..b37642d --- /dev/null +++ b/Microcontrollers/opdracht C/Debug/opdracht C.lss @@ -0,0 +1,327 @@ + +opdracht C.elf: file format elf32-avr + +Sections: +Idx Name Size VMA LMA File off Algn + 0 .data 00000000 00800100 00800100 00000204 2**0 + CONTENTS, ALLOC, LOAD, DATA + 1 .text 000001b0 00000000 00000000 00000054 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 2 .comment 00000030 00000000 00000000 00000204 2**0 + CONTENTS, READONLY + 3 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00000234 2**2 + CONTENTS, READONLY + 4 .debug_aranges 00000070 00000000 00000000 00000270 2**0 + CONTENTS, READONLY, DEBUGGING + 5 .debug_info 00000cd9 00000000 00000000 000002e0 2**0 + CONTENTS, READONLY, DEBUGGING + 6 .debug_abbrev 000008c5 00000000 00000000 00000fb9 2**0 + CONTENTS, READONLY, DEBUGGING + 7 .debug_line 000004b8 00000000 00000000 0000187e 2**0 + CONTENTS, READONLY, DEBUGGING + 8 .debug_frame 000000d8 00000000 00000000 00001d38 2**2 + CONTENTS, READONLY, DEBUGGING + 9 .debug_str 000004d9 00000000 00000000 00001e10 2**0 + CONTENTS, READONLY, DEBUGGING + 10 .debug_loc 0000016f 00000000 00000000 000022e9 2**0 + CONTENTS, READONLY, DEBUGGING + 11 .debug_ranges 00000060 00000000 00000000 00002458 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: 67 d0 rcall .+206 ; 0x168
+ 9a: 88 c0 rjmp .+272 ; 0x1ac <_exit> + +0000009c <__bad_interrupt>: + 9c: b1 cf rjmp .-158 ; 0x0 <__vectors> + +0000009e : +void displayOff() +{ + spi_slaveSelect(0); // Select display chip + spi_write(0x0C); // Register 0B: Shutdown register + spi_write(0x00); // -> 1 = Normal operation + spi_slaveDeSelect(0); // Deselect display chip + 9e: 20 e0 ldi r18, 0x00 ; 0 + a0: 30 e0 ldi r19, 0x00 ; 0 + a2: 08 c0 rjmp .+16 ; 0xb4 + a4: e3 ec ldi r30, 0xC3 ; 195 + a6: f9 e0 ldi r31, 0x09 ; 9 + a8: 31 97 sbiw r30, 0x01 ; 1 + aa: f1 f7 brne .-4 ; 0xa8 + ac: 00 c0 rjmp .+0 ; 0xae + ae: 00 00 nop + b0: 2f 5f subi r18, 0xFF ; 255 + b2: 3f 4f sbci r19, 0xFF ; 255 + b4: 28 17 cp r18, r24 + b6: 39 07 cpc r19, r25 + b8: ac f3 brlt .-22 ; 0xa4 + ba: 08 95 ret + +000000bc : + bc: 8f ef ldi r24, 0xFF ; 255 + be: 87 bb out 0x17, r24 ; 23 + c0: 87 b3 in r24, 0x17 ; 23 + c2: 87 7f andi r24, 0xF7 ; 247 + c4: 87 bb out 0x17, r24 ; 23 + c6: 88 b3 in r24, 0x18 ; 24 + c8: 81 60 ori r24, 0x01 ; 1 + ca: 88 bb out 0x18, r24 ; 24 + cc: 82 e5 ldi r24, 0x52 ; 82 + ce: 8d b9 out 0x0d, r24 ; 13 + d0: 08 95 ret + +000000d2 : + d2: 8f b9 out 0x0f, r24 ; 15 + d4: 77 9b sbis 0x0e, 7 ; 14 + d6: fe cf rjmp .-4 ; 0xd4 + d8: 08 95 ret + +000000da : + da: 98 b3 in r25, 0x18 ; 24 + dc: 21 e0 ldi r18, 0x01 ; 1 + de: 30 e0 ldi r19, 0x00 ; 0 + e0: 02 c0 rjmp .+4 ; 0xe6 + e2: 22 0f add r18, r18 + e4: 33 1f adc r19, r19 + e6: 8a 95 dec r24 + e8: e2 f7 brpl .-8 ; 0xe2 + ea: 20 95 com r18 + ec: 29 23 and r18, r25 + ee: 28 bb out 0x18, r18 ; 24 + f0: 08 95 ret + +000000f2 : + f2: 98 b3 in r25, 0x18 ; 24 + f4: 21 e0 ldi r18, 0x01 ; 1 + f6: 30 e0 ldi r19, 0x00 ; 0 + f8: 02 c0 rjmp .+4 ; 0xfe + fa: 22 0f add r18, r18 + fc: 33 1f adc r19, r19 + fe: 8a 95 dec r24 + 100: e2 f7 brpl .-8 ; 0xfa + 102: 29 2b or r18, r25 + 104: 28 bb out 0x18, r18 ; 24 + 106: 08 95 ret + +00000108 : + 108: cf 93 push r28 + 10a: df 93 push r29 + 10c: d8 2f mov r29, r24 + 10e: c6 2f mov r28, r22 + 110: 80 e0 ldi r24, 0x00 ; 0 + 112: e3 df rcall .-58 ; 0xda + 114: 8d 2f mov r24, r29 + 116: dd df rcall .-70 ; 0xd2 + 118: 8c 2f mov r24, r28 + 11a: db df rcall .-74 ; 0xd2 + 11c: 80 e0 ldi r24, 0x00 ; 0 + 11e: e9 df rcall .-46 ; 0xf2 + 120: df 91 pop r29 + 122: cf 91 pop r28 + 124: 08 95 ret + +00000126 : + 126: 80 e0 ldi r24, 0x00 ; 0 + 128: d8 df rcall .-80 ; 0xda + 12a: 89 e0 ldi r24, 0x09 ; 9 + 12c: d2 df rcall .-92 ; 0xd2 + 12e: 8f ef ldi r24, 0xFF ; 255 + 130: d0 df rcall .-96 ; 0xd2 + 132: 80 e0 ldi r24, 0x00 ; 0 + 134: de df rcall .-68 ; 0xf2 + 136: 80 e0 ldi r24, 0x00 ; 0 + 138: d0 df rcall .-96 ; 0xda + 13a: 8a e0 ldi r24, 0x0A ; 10 + 13c: ca df rcall .-108 ; 0xd2 + 13e: 84 e0 ldi r24, 0x04 ; 4 + 140: c8 df rcall .-112 ; 0xd2 + 142: 80 e0 ldi r24, 0x00 ; 0 + 144: d6 df rcall .-84 ; 0xf2 + 146: 80 e0 ldi r24, 0x00 ; 0 + 148: c8 df rcall .-112 ; 0xda + 14a: 8b e0 ldi r24, 0x0B ; 11 + 14c: c2 df rcall .-124 ; 0xd2 + 14e: 83 e0 ldi r24, 0x03 ; 3 + 150: c0 df rcall .-128 ; 0xd2 + 152: 80 e0 ldi r24, 0x00 ; 0 + 154: ce df rcall .-100 ; 0xf2 + 156: 80 e0 ldi r24, 0x00 ; 0 + 158: c0 df rcall .-128 ; 0xda + 15a: 8c e0 ldi r24, 0x0C ; 12 + 15c: ba df rcall .-140 ; 0xd2 + 15e: 81 e0 ldi r24, 0x01 ; 1 + 160: b8 df rcall .-144 ; 0xd2 + 162: 80 e0 ldi r24, 0x00 ; 0 + 164: c6 cf rjmp .-116 ; 0xf2 + 166: 08 95 ret + +00000168
: +} +int main() +{ + 168: cf 93 push r28 +DDRB=0x01; // Set PB0 pin as output for display select + 16a: 81 e0 ldi r24, 0x01 ; 1 + 16c: 87 bb out 0x17, r24 ; 23 +spi_masterInit(); // Initialize spi module + 16e: a6 df rcall .-180 ; 0xbc +displayDriverInit(); // Initialize display chip + 170: da df rcall .-76 ; 0x126 + 172: c1 e0 ldi r28, 0x01 ; 1 +// clear display (all zero's) +for (unsigned char i =1; i<=4; i++) + 174: 04 c0 rjmp .+8 ; 0x17e + 176: 6c 2f mov r22, r28 +{ +// spi_slaveSelect(0); // Select display chip + //spi_write(i); // digit adress: (digit place) + //spi_write(0); // digit value: 0 + //spi_slaveDeSelect(0); // Deselect display chip +spi_writeCommand(i,i); + 178: 8c 2f mov r24, r28 + 17a: c6 df rcall .-116 ; 0x108 + 17c: cf 5f subi r28, 0xFF ; 255 +{ +DDRB=0x01; // Set PB0 pin as output for display select +spi_masterInit(); // Initialize spi module +displayDriverInit(); // Initialize display chip +// clear display (all zero's) +for (unsigned char i =1; i<=4; i++) + 17e: c5 30 cpi r28, 0x05 ; 5 + 180: d0 f3 brcs .-12 ; 0x176 + //spi_write(i); // digit adress: (digit place) + //spi_write(0); // digit value: 0 + //spi_slaveDeSelect(0); // Deselect display chip +spi_writeCommand(i,i); +} +wait(1000); + 182: 88 ee ldi r24, 0xE8 ; 232 + 184: 93 e0 ldi r25, 0x03 ; 3 + 186: 8b df rcall .-234 ; 0x9e + 188: c1 e0 ldi r28, 0x01 ; 1 +// write 4-digit data +for (unsigned char i =1; i<=4; i++) + 18a: 07 c0 rjmp .+14 ; 0x19a + { +//spi_slaveSelect(0); // Select display chip +//spi_write(i); // digit adress: (digit place) +//spi_write(i); // digit value: i (= digit place) +//spi_slaveDeSelect(0); // Deselect display chip +spi_writeCommand(i,i); + 18c: 6c 2f mov r22, r28 + 18e: 8c 2f mov r24, r28 + 190: bb df rcall .-138 ; 0x108 +wait(1000); + 192: 88 ee ldi r24, 0xE8 ; 232 + 194: 93 e0 ldi r25, 0x03 ; 3 + 196: 83 df rcall .-250 ; 0x9e + //spi_slaveDeSelect(0); // Deselect display chip +spi_writeCommand(i,i); +} +wait(1000); +// write 4-digit data +for (unsigned char i =1; i<=4; i++) + 198: cf 5f subi r28, 0xFF ; 255 + 19a: c5 30 cpi r28, 0x05 ; 5 + 19c: b8 f3 brcs .-18 ; 0x18c +//spi_write(i); // digit value: i (= digit place) +//spi_slaveDeSelect(0); // Deselect display chip +spi_writeCommand(i,i); +wait(1000); + } +wait(1000); + 19e: 88 ee ldi r24, 0xE8 ; 232 + 1a0: 93 e0 ldi r25, 0x03 ; 3 + 1a2: 7d df rcall .-262 ; 0x9e + 1a4: 81 e0 ldi r24, 0x01 ; 1 + return (1); + 1a6: 90 e0 ldi r25, 0x00 ; 0 + 1a8: cf 91 pop r28 + 1aa: 08 95 ret + +000001ac <_exit>: + 1ac: f8 94 cli + +000001ae <__stop_program>: + 1ae: ff cf rjmp .-2 ; 0x1ae <__stop_program> diff --git a/Microcontrollers/opdracht C/Debug/opdracht C.srec b/Microcontrollers/opdracht C/Debug/opdracht C.srec new file mode 100644 index 0000000..7bcfe90 --- /dev/null +++ b/Microcontrollers/opdracht C/Debug/opdracht C.srec @@ -0,0 +1,29 @@ +S01200006F7064726163687420432E737265635A +S113000045C000004BC0000049C0000047C00000CC +S113001045C0000043C0000041C000003FC00000D4 +S11300203DC000003BC0000039C0000037C00000E4 +S113003035C0000033C0000031C000002FC00000F4 +S11300402DC000002BC0000029C0000027C0000004 +S113005025C0000023C0000021C000001FC0000014 +S11300601DC000001BC0000019C0000017C0000024 +S113007015C0000013C0000011C000000FC0000034 +S11300800DC000000BC0000009C0000011241FBEF9 +S1130090CFEFD0E1DEBFCDBF67D088C0B1CF20E0C5 +S11300A030E008C0E3ECF9E03197F1F700C000005C +S11300B02F5F3F4F28173907ACF308958FEF87BBA5 +S11300C087B3877F87BB88B3816088BB82E58DB99E +S11300D008958FB9779BFECF089598B321E030E05F +S11300E002C0220F331F8A95E2F72095292328BBEB +S11300F0089598B321E030E002C0220F331F8A959F +S1130100E2F7292B28BB0895CF93DF93D82FC62F6E +S113011080E0E3DF8D2FDDDF8C2FDBDF80E0E9DFA4 +S1130120DF91CF91089580E0D8DF89E0D2DF8FEFAF +S1130130D0DF80E0DEDF80E0D0DF8AE0CADF84E069 +S1130140C8DF80E0D6DF80E0C8DF8BE0C2DF83E079 +S1130150C0DF80E0CEDF80E0C0DF8CE0BADF81E08A +S1130160B8DF80E0C6CF0895CF9381E087BBA6DFD8 +S1130170DADFC1E004C06C2F8C2FC6DFCF5FC5303F +S1130180D0F388EE93E08BDFC1E007C06C2F8C2F97 +S1130190BBDF88EE93E083DFCF5FC530B8F388EE32 +S11301A093E07DDF81E090E0CF910895F894FFCF54 +S9030000FC diff --git a/Microcontrollers/opdracht C/main.c b/Microcontrollers/opdracht C/main.c new file mode 100644 index 0000000..b4069cb --- /dev/null +++ b/Microcontrollers/opdracht C/main.c @@ -0,0 +1,136 @@ +/* +* Project name : Demo5_7a : spi - 7 segments display +* Author : Avans-TI, WvdE, JW +* Revision History : 20110228: - initial release; 20120307: - this version +* Description : This program sends data to a 4-digit display with spi +* Test configuration: + MCU: ATmega128 + Dev.Board: BIGAVR6 + Oscillator: External Clock 08.0000 MHz + Ext. Modules: Serial 7-seg display + SW: AVR-GCC +* NOTES : Turn ON switch 15, PB1/PB2/PB3 to MISO/MOSI/SCK +*/ +#define F_CPU 10e6 +#include +#include +#define BIT(x) ( 1< starts transmission +while( !(SPSR & BIT(SPIF)) ); // Wait for transmission complete +} +// Write a byte from master to slave and read a byte from slave - not used here +char spi_writeRead( unsigned char data ) +{ +SPDR = data; // Load byte --> starts transmission +while( !(SPSR & BIT(SPIF)) ); // Wait for transmission complete +data = SPDR; // New received data (eventually, MISO) in SPDR +return data; // Return received byte +} +// Select device on pinnumer PORTB +void spi_slaveSelect(unsigned char chipNumber) +{ +PORTB &= ~BIT(chipNumber); +} +// Deselect device on pinnumer PORTB +void spi_slaveDeSelect(unsigned char chipNumber) +{ +PORTB |= BIT(chipNumber); +} + +void spi_writeCommand(unsigned char adress, unsigned char data) +{ +spi_slaveSelect(0); +spi_write(adress); +spi_write(data); +spi_slaveDeSelect(0); +} + +// Initialize the driver chip (type MAX 7219) +void displayDriverInit() +{ +spi_slaveSelect(0); // Select display chip (MAX7219) + spi_write(0x09); // Register 09: Decode Mode + spi_write(0xFF); // -> 1's = BCD mode for all digits + spi_slaveDeSelect(0); // Deselect display chip + spi_slaveSelect(0); // Select dispaly chip + spi_write(0x0A); // Register 0A: Intensity + spi_write(0x04); // ->the hex value here selects the intensity (in range [1..F]) + spi_slaveDeSelect(0); // Deselect display chip + spi_slaveSelect(0); // Select display chip + spi_write(0x0B); // Register 0B: Scan-limit + spi_write(0x03); // -> 1 = Display digits 0..1 the hex value here selects how many segments get initialized + spi_slaveDeSelect(0); // Deselect display chip + spi_slaveSelect(0); // Select display chip + spi_write(0x0C); // Register 0B: Shutdown register + spi_write(0x01); // -> 1 = Normal operation + spi_slaveDeSelect(0); // Deselect display chip +} +// Set display on ('normal operation') +void displayOn() +{ + spi_slaveSelect(0); // Select display chip + spi_write(0x0C); // Register 0B: Shutdown register + spi_write(0x01); // -> 1 = Normal operation + spi_slaveDeSelect(0); // Deselect display chip +} +// Set display off ('shut down') +void displayOff() +{ + spi_slaveSelect(0); // Select display chip + spi_write(0x0C); // Register 0B: Shutdown register + spi_write(0x00); // -> 1 = Normal operation + spi_slaveDeSelect(0); // Deselect display chip +} +int main() +{ +DDRB=0x01; // Set PB0 pin as output for display select +spi_masterInit(); // Initialize spi module +displayDriverInit(); // Initialize display chip +// clear display (all zero's) +for (unsigned char i =1; i<=4; i++) +{ +// spi_slaveSelect(0); // Select display chip + //spi_write(i); // digit adress: (digit place) + //spi_write(0); // digit value: 0 + //spi_slaveDeSelect(0); // Deselect display chip +spi_writeCommand(i,i); +} +wait(1000); +// write 4-digit data +for (unsigned char i =1; i<=4; i++) + { +//spi_slaveSelect(0); // Select display chip +//spi_write(i); // digit adress: (digit place) +//spi_write(i); // digit value: i (= digit place) +//spi_slaveDeSelect(0); // Deselect display chip +spi_writeCommand(i,i); +wait(1000); + } +wait(1000); + return (1); +} \ No newline at end of file diff --git a/Microcontrollers/opdracht C/opdracht C.componentinfo.xml b/Microcontrollers/opdracht C/opdracht C.componentinfo.xml new file mode 100644 index 0000000..843f701 --- /dev/null +++ b/Microcontrollers/opdracht C/opdracht C.componentinfo.xml @@ -0,0 +1,86 @@ + + + + + + + Device + Startup + + + Atmel + 1.6.0 + C:/Program Files (x86)\Atmel\Studio\7.0\Packs + + + + + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\include\ + + include + C + + + include/ + + + + + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\include\avr\iom128.h + + header + C + JdJ7J9I/SJh965SEyyyVYw== + + include/avr/iom128.h + + + + + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\templates\main.c + template + source + C Exe + dYQaOvX+0xpWshrMQ/Jkjg== + + templates/main.c + Main file (.c) + + + + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\templates\main.cpp + template + source + C Exe + mkKaE95TOoATsuBGv6jmxg== + + templates/main.cpp + Main file (.cpp) + + + + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128 + + libraryPrefix + GCC + + + gcc/dev/atmega128 + + + + + ATmega_DFP + C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.6.364/Atmel.ATmega_DFP.pdsc + 1.6.364 + true + ATmega128 + + + + Resolved + Fixed + true + + + \ No newline at end of file diff --git a/Microcontrollers/opdracht C/opdracht C.cproj b/Microcontrollers/opdracht C/opdracht C.cproj new file mode 100644 index 0000000..9ecadb9 --- /dev/null +++ b/Microcontrollers/opdracht C/opdracht C.cproj @@ -0,0 +1,130 @@ + + + + 2.0 + 7.0 + com.Atmel.AVRGCC8.C + {2df6f5f3-181f-430e-b49a-3d9794f91482} + ATmega128 + none + Executable + C + $(MSBuildProjectName) + .elf + $(MSBuildProjectDirectory)\$(Configuration) + opdracht C + opdracht C + opdracht C + Native + true + false + true + true + + + true + + 2 + 0 + 0 + + + + + + + + + + + + + + + + + + -mmcu=atmega128 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128" + True + True + True + True + True + False + True + True + + + NDEBUG + + + + + %24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\ + + + Optimize for size (-Os) + True + True + True + + + libm + + + + + %24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\ + + + + + + + + + -mmcu=atmega128 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128" + True + True + True + True + True + False + True + True + + + DEBUG + + + + + %24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\ + + + Optimize debugging experience (-Og) + True + True + Default (-g2) + True + + + libm + + + + + %24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\ + + + Default (-Wa,-g) + + + + + + compile + + + + \ No newline at end of file diff --git a/Microcontrollers/testlcd/Debug/Makefile b/Microcontrollers/testlcd/Debug/Makefile index 8249bb6..c3b7b04 100644 --- a/Microcontrollers/testlcd/Debug/Makefile +++ b/Microcontrollers/testlcd/Debug/Makefile @@ -37,7 +37,6 @@ SUBDIRS := # Add inputs and outputs from these tool invocations to the build variables C_SRCS += \ -../lcd_control.c \ ../main.c @@ -48,19 +47,15 @@ ASM_SRCS += OBJS += \ -lcd_control.o \ main.o OBJS_AS_ARGS += \ -lcd_control.o \ main.o C_DEPS += \ -lcd_control.d \ main.d C_DEPS_AS_ARGS += \ -lcd_control.d \ main.d OUTPUT_FILE_PATH +=testlcd.elf @@ -77,13 +72,6 @@ LINKER_SCRIPT_DEP+= # AVR32/GNU C Compiler -./lcd_control.o: .././lcd_control.c - @echo Building file: $< - @echo Invoking: AVR/GNU C Compiler : 5.4.0 - $(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.6.364\include" -Og -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.6.364\gcc\dev\atmega128" -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" - @echo Finished building: $< - - ./main.o: .././main.c @echo Building file: $< @echo Invoking: AVR/GNU C Compiler : 5.4.0 diff --git a/Microcontrollers/testlcd/Debug/makedep.mk b/Microcontrollers/testlcd/Debug/makedep.mk index c9e4784..6a14fde 100644 --- a/Microcontrollers/testlcd/Debug/makedep.mk +++ b/Microcontrollers/testlcd/Debug/makedep.mk @@ -2,7 +2,5 @@ # Automatically-generated file. Do not edit or delete the file ################################################################################ -lcd_control.c - main.c diff --git a/Microcontrollers/testlcd/Debug/testlcd.lss b/Microcontrollers/testlcd/Debug/testlcd.lss index 0a359c6..6c164d6 100644 --- a/Microcontrollers/testlcd/Debug/testlcd.lss +++ b/Microcontrollers/testlcd/Debug/testlcd.lss @@ -21,11 +21,11 @@ Idx Name Size VMA LMA File off Algn CONTENTS, READONLY, DEBUGGING 8 .debug_frame 000000b8 00000000 00000000 00001b6c 2**2 CONTENTS, READONLY, DEBUGGING - 9 .debug_str 00000479 00000000 00000000 00001c24 2**0 + 9 .debug_str 000004a0 00000000 00000000 00001c24 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_loc 00000299 00000000 00000000 0000209d 2**0 + 10 .debug_loc 00000299 00000000 00000000 000020c4 2**0 CONTENTS, READONLY, DEBUGGING - 11 .debug_ranges 00000048 00000000 00000000 00002336 2**0 + 11 .debug_ranges 00000048 00000000 00000000 0000235d 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: