diff --git a/Microcontrollers/Microcontrollers.atsln b/Microcontrollers/Microcontrollers.atsln index efcb76a..afd50c6 100644 --- a/Microcontrollers/Microcontrollers.atsln +++ b/Microcontrollers/Microcontrollers.atsln @@ -31,6 +31,8 @@ Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 3.3", "opdracht 3. EndProject Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 4.1", "opdracht 4.1\opdracht 4.1.cproj", "{2432E6BF-DA1E-4668-99BB-59FEA1F5B8A2}" 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 @@ -81,6 +83,22 @@ 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 + {0FA0C637-5AC0-44F3-999B-49C114B97183}.Debug|AVR.ActiveCfg = Debug|AVR + {0FA0C637-5AC0-44F3-999B-49C114B97183}.Debug|AVR.Build.0 = Debug|AVR + {0FA0C637-5AC0-44F3-999B-49C114B97183}.Release|AVR.ActiveCfg = Release|AVR + {0FA0C637-5AC0-44F3-999B-49C114B97183}.Release|AVR.Build.0 = Release|AVR + {985D5C75-F61E-49F1-A532-66A1E6141552}.Debug|AVR.ActiveCfg = Debug|AVR + {985D5C75-F61E-49F1-A532-66A1E6141552}.Debug|AVR.Build.0 = Debug|AVR + {985D5C75-F61E-49F1-A532-66A1E6141552}.Release|AVR.ActiveCfg = Release|AVR + {985D5C75-F61E-49F1-A532-66A1E6141552}.Release|AVR.Build.0 = Release|AVR + {2432E6BF-DA1E-4668-99BB-59FEA1F5B8A2}.Debug|AVR.ActiveCfg = Debug|AVR + {2432E6BF-DA1E-4668-99BB-59FEA1F5B8A2}.Debug|AVR.Build.0 = Debug|AVR + {2432E6BF-DA1E-4668-99BB-59FEA1F5B8A2}.Release|AVR.ActiveCfg = Release|AVR + {2432E6BF-DA1E-4668-99BB-59FEA1F5B8A2}.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.5/Debug/opdracht 2.5.lss b/Microcontrollers/opdracht 2.5/Debug/opdracht 2.5.lss index 2e2a1e5..6937c07 100644 --- a/Microcontrollers/opdracht 2.5/Debug/opdracht 2.5.lss +++ b/Microcontrollers/opdracht 2.5/Debug/opdracht 2.5.lss @@ -110,7 +110,7 @@ Disassembly of section .text: Disassembly of section .text: 0000021c <__bad_interrupt>: - 21c: 0c 94 00 00 jmp 0 ; 0x0 <__vectors> + 21c: 0c 94 00 00 jmp 0 ; 0x0 <__TEXT_REGION_ORIGIN__> Disassembly of section .text.sbi_porta: diff --git a/Microcontrollers/opdracht 2.5/opdracht 2.5.cproj b/Microcontrollers/opdracht 2.5/opdracht 2.5.cproj index 163526b..d764a8b 100644 --- a/Microcontrollers/opdracht 2.5/opdracht 2.5.cproj +++ b/Microcontrollers/opdracht 2.5/opdracht 2.5.cproj @@ -40,6 +40,22 @@ + com.atmel.avrdbg.tool.atmelice + J42700011271 + 0x1E9702 + + + + 2000000 + + JTAG + + com.atmel.avrdbg.tool.atmelice + J42700011271 + Atmel-ICE + + JTAG + 2000000 diff --git a/Microcontrollers/opdracht C/Debug/opdracht C.lss b/Microcontrollers/opdracht C/Debug/opdracht C.lss index b37642d..e0d2d55 100644 --- a/Microcontrollers/opdracht C/Debug/opdracht C.lss +++ b/Microcontrollers/opdracht C/Debug/opdracht C.lss @@ -13,11 +13,11 @@ Idx Name Size VMA LMA File off Algn CONTENTS, READONLY 4 .debug_aranges 00000070 00000000 00000000 00000270 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_info 00000cd9 00000000 00000000 000002e0 2**0 + 5 .debug_info 00000cd8 00000000 00000000 000002e0 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_abbrev 000008c5 00000000 00000000 00000fb9 2**0 + 6 .debug_abbrev 000008c5 00000000 00000000 00000fb8 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_line 000004b8 00000000 00000000 0000187e 2**0 + 7 .debug_line 000004b8 00000000 00000000 0000187d 2**0 CONTENTS, READONLY, DEBUGGING 8 .debug_frame 000000d8 00000000 00000000 00001d38 2**2 CONTENTS, READONLY, DEBUGGING @@ -222,7 +222,7 @@ void displayOff() 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 + 14e: 87 e0 ldi r24, 0x07 ; 7 150: c0 df rcall .-128 ; 0xd2 152: 80 e0 ldi r24, 0x00 ; 0 154: ce df rcall .-100 ; 0xf2 @@ -250,30 +250,25 @@ 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++) + +for (unsigned char i =1; i<=8; i++) 174: 04 c0 rjmp .+8 ; 0x17e - 176: 6c 2f mov r22, r28 + 176: 60 e0 ldi r22, 0x00 ; 0 { -// 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); +spi_writeCommand(i,0); 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 + +for (unsigned char i =1; i<=8; i++) + 17e: c9 30 cpi r28, 0x09 ; 9 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); +{ +spi_writeCommand(i,0); } wait(1000); 182: 88 ee ldi r24, 0xE8 ; 232 @@ -281,13 +276,9 @@ wait(1000); 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++) +for (unsigned char i =1; i<=8; 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 @@ -296,17 +287,16 @@ 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); +{ +spi_writeCommand(i,0); } wait(1000); // write 4-digit data -for (unsigned char i =1; i<=4; i++) +for (unsigned char i =1; i<=8; i++) 198: cf 5f subi r28, 0xFF ; 255 - 19a: c5 30 cpi r28, 0x05 ; 5 + 19a: c9 30 cpi r28, 0x09 ; 9 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); } diff --git a/Microcontrollers/opdracht C/Debug/opdracht C.srec b/Microcontrollers/opdracht C/Debug/opdracht C.srec index 7bcfe90..efa448c 100644 --- a/Microcontrollers/opdracht C/Debug/opdracht C.srec +++ b/Microcontrollers/opdracht C/Debug/opdracht C.srec @@ -19,11 +19,11 @@ S1130100E2F7292B28BB0895CF93DF93D82FC62F6E S113011080E0E3DF8D2FDDDF8C2FDBDF80E0E9DFA4 S1130120DF91CF91089580E0D8DF89E0D2DF8FEFAF S1130130D0DF80E0DEDF80E0D0DF8AE0CADF84E069 -S1130140C8DF80E0D6DF80E0C8DF8BE0C2DF83E079 +S1130140C8DF80E0D6DF80E0C8DF8BE0C2DF87E075 S1130150C0DF80E0CEDF80E0C0DF8CE0BADF81E08A S1130160B8DF80E0C6CF0895CF9381E087BBA6DFD8 -S1130170DADFC1E004C06C2F8C2FC6DFCF5FC5303F +S1130170DADFC1E004C060E08C2FC6DFCF5FC93096 S1130180D0F388EE93E08BDFC1E007C06C2F8C2F97 -S1130190BBDF88EE93E083DFCF5FC530B8F388EE32 +S1130190BBDF88EE93E083DFCF5FC930B8F388EE2E S11301A093E07DDF81E090E0CF910895F894FFCF54 S9030000FC diff --git a/Microcontrollers/opdracht C/main.c b/Microcontrollers/opdracht C/main.c index b4069cb..e9c0364 100644 --- a/Microcontrollers/opdracht C/main.c +++ b/Microcontrollers/opdracht C/main.c @@ -12,7 +12,7 @@ * NOTES : Turn ON switch 15, PB1/PB2/PB3 to MISO/MOSI/SCK */ #define F_CPU 10e6 -#include +#include [-] #include #define BIT(x) ( 1< 1 = Display digits 0..1 the hex value here selects how many segments get initialized + spi_write(0x07); // -> 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 @@ -112,22 +112,15 @@ 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++) + +for (unsigned char i =1; i<=8; 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); +spi_writeCommand(i,0); } wait(1000); // write 4-digit data -for (unsigned char i =1; i<=4; i++) +for (unsigned char i =1; i<=8; 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); } diff --git a/Microcontrollers/opdracht C/opdracht C.cproj b/Microcontrollers/opdracht C/opdracht C.cproj index 9ecadb9..621a4f1 100644 --- a/Microcontrollers/opdracht C/opdracht C.cproj +++ b/Microcontrollers/opdracht C/opdracht C.cproj @@ -20,105 +20,121 @@ false true true - + 0x20000000 true - + exception_table 2 0 0 - - - - - - - - - + + + + + + + + + + com.atmel.avrdbg.tool.atmelice + J42700011271 + 0x1E9702 + + + + 2000000 + + JTAG + + com.atmel.avrdbg.tool.atmelice + J42700011271 + Atmel-ICE + + JTAG + 2000000 - -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) +