diff --git a/Microcontrollers/.vs/Microcontrollers/v14/.atsuo b/Microcontrollers/.vs/Microcontrollers/v14/.atsuo index da6127f..f218ffd 100644 Binary files a/Microcontrollers/.vs/Microcontrollers/v14/.atsuo and b/Microcontrollers/.vs/Microcontrollers/v14/.atsuo differ diff --git a/Microcontrollers/LCDMatrix/Debug/LCDMatrix.elf b/Microcontrollers/LCDMatrix/Debug/LCDMatrix.elf index a85c586..6e3779c 100644 Binary files a/Microcontrollers/LCDMatrix/Debug/LCDMatrix.elf and b/Microcontrollers/LCDMatrix/Debug/LCDMatrix.elf differ diff --git a/Microcontrollers/LCDMatrix/Debug/LCDMatrix.hex b/Microcontrollers/LCDMatrix/Debug/LCDMatrix.hex index fe7141c..eed7df6 100644 --- a/Microcontrollers/LCDMatrix/Debug/LCDMatrix.hex +++ b/Microcontrollers/LCDMatrix/Debug/LCDMatrix.hex @@ -7,17 +7,19 @@ :100060001DC000001BC0000019C0000017C0000028 :1000700015C0000013C0000011C000000FC0000038 :100080000DC000000BC0000009C0000011241FBEFD -:10009000CFEFD0E1DEBFCDBF2DD05CC0B1CF10928D +:10009000CFEFD0E1DEBFCDBF41D06EC0B1CF109267 :1000A000710080E280937000089584EA8093740068 :1000B000809174008823E4F7089584E980937400A4 :1000C00008958093730084E8809374008091740095 -:1000D0008823E4F7089520E030E008C0E9EFF0E07D +:1000D0008823E4F7089520E030E008C0E3ECF9E07D :1000E0003197F1F700C000002F5F3F4F2817390705 -:1000F000ACF30895D4DFD9DF80EEE3DF81E2E1DF06 -:10010000DCDFD3DF80EEDDDF80EADBDFD6DFCDDFD3 -:1001100080EED7DF83EED5DFD0DFC7DF80EED1DF23 -:1001200081E8CFDFCADFC1DF80EECBDF80E0C9DF4F -:1001300080E0C7DFC2DF84EF91E0CDDFB6DF80EE85 -:10014000C0DF80E0BEDF81E0BCDFB7DF84EF91E09D -:08015000C2DFE9CFF894FFCFF4 +:1000F000ACF30895CF93DF93D8DF80EEE2DF80E0AA +:10010000E0DFC0E0D0E003C080E0DBDF2196C0315B +:10011000D105D4F3D2DFDF91CF910895C0DFC5DFE1 +:1001200080EECFDF81E2CDDFC8DFBFDF80EEC9DF49 +:1001300080EAC7DFC2DFB9DF80EEC3DF83EEC1DF55 +:10014000BCDFB3DF80EEBDDF81E8BBDFB6DFD2DF2F +:10015000C0E0D0E00CC0A9DF80EEB3DF8C2FB1DFB0 +:100160008FEFAFDFAADF88EC90E0B5DF2296C031D9 +:0C017000D1058CF3BFDFECCFF894FFCF7B :00000001FF diff --git a/Microcontrollers/LCDMatrix/Debug/LCDMatrix.lss b/Microcontrollers/LCDMatrix/Debug/LCDMatrix.lss index 25e07ba..d3b4689 100644 --- a/Microcontrollers/LCDMatrix/Debug/LCDMatrix.lss +++ b/Microcontrollers/LCDMatrix/Debug/LCDMatrix.lss @@ -3,29 +3,29 @@ LCDMatrix.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .data 00000000 00800100 00800100 000001ac 2**0 + 0 .data 00000000 00800100 00800100 000001d0 2**0 CONTENTS, ALLOC, LOAD, DATA - 1 .text 00000158 00000000 00000000 00000054 2**1 + 1 .text 0000017c 00000000 00000000 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 2 .comment 00000030 00000000 00000000 000001ac 2**0 + 2 .comment 00000030 00000000 00000000 000001d0 2**0 CONTENTS, READONLY - 3 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 000001dc 2**2 + 3 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00000200 2**2 CONTENTS, READONLY - 4 .debug_aranges 00000048 00000000 00000000 00000218 2**0 + 4 .debug_aranges 00000050 00000000 00000000 0000023c 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_info 00000af1 00000000 00000000 00000260 2**0 + 5 .debug_info 00000b36 00000000 00000000 0000028c 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_abbrev 00000862 00000000 00000000 00000d51 2**0 + 6 .debug_abbrev 00000885 00000000 00000000 00000dc2 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_line 0000040a 00000000 00000000 000015b3 2**0 + 7 .debug_line 00000451 00000000 00000000 00001647 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_frame 00000074 00000000 00000000 000019c0 2**2 + 8 .debug_frame 00000090 00000000 00000000 00001a98 2**2 CONTENTS, READONLY, DEBUGGING - 9 .debug_str 00000441 00000000 00000000 00001a34 2**0 + 9 .debug_str 0000044e 00000000 00000000 00001b28 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_loc 00000097 00000000 00000000 00001e75 2**0 + 10 .debug_loc 0000010e 00000000 00000000 00001f76 2**0 CONTENTS, READONLY, DEBUGGING - 11 .debug_ranges 00000038 00000000 00000000 00001f0c 2**0 + 11 .debug_ranges 00000040 00000000 00000000 00002084 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -109,8 +109,8 @@ 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: 2d d0 rcall .+90 ; 0xf4
- 9a: 5c c0 rjmp .+184 ; 0x154 <_exit> + 98: 41 d0 rcall .+130 ; 0x11c
+ 9a: 6e c0 rjmp .+220 ; 0x178 <_exit> 0000009c <__bad_interrupt>: 9c: b1 cf rjmp .-158 ; 0x0 <__vectors> @@ -189,8 +189,8 @@ Version : DMK, Initial code #endif __builtin_avr_delay_cycles(__ticks_dc); - dc: e9 ef ldi r30, 0xF9 ; 249 - de: f0 e0 ldi r31, 0x00 ; 0 + dc: e3 ec ldi r30, 0xC3 ; 195 + de: f9 e0 ldi r31, 0x09 ; 9 e0: 31 97 sbiw r30, 0x01 ; 1 e2: f1 f7 brne .-4 ; 0xe0 e4: 00 c0 rjmp .+0 ; 0xe6 @@ -206,101 +206,143 @@ Version : DMK, Initial code } f2: 08 95 ret -000000f4
: -notes: Looping forever, trashing the HT16K33 -Version : DMK, Initial code -*******************************************************************/ +000000f4 : + +void matrix_clear() +{ + f4: cf 93 push r28 + f6: df 93 push r29 + twi_start(); + f8: d8 df rcall .-80 ; 0xaa + twi_tx(0xE0); + fa: 80 ee ldi r24, 0xE0 ; 224 + fc: e2 df rcall .-60 ; 0xc2 + twi_tx(0x00); + fe: 80 e0 ldi r24, 0x00 ; 0 + 100: e0 df rcall .-64 ; 0xc2 + 102: c0 e0 ldi r28, 0x00 ; 0 + for (int i = 0; i < 16; i++) + 104: d0 e0 ldi r29, 0x00 ; 0 + 106: 03 c0 rjmp .+6 ; 0x10e + { + + twi_tx(0x00); + 108: 80 e0 ldi r24, 0x00 ; 0 + 10a: db df rcall .-74 ; 0xc2 + 10c: 21 96 adiw r28, 0x01 ; 1 +void matrix_clear() +{ + twi_start(); + twi_tx(0xE0); + twi_tx(0x00); + for (int i = 0; i < 16; i++) + 10e: c0 31 cpi r28, 0x10 ; 16 + 110: d1 05 cpc r29, r1 + 112: d4 f3 brlt .-12 ; 0x108 + { + + twi_tx(0x00); + } + twi_stop(); + 114: d2 df rcall .-92 ; 0xba + 116: df 91 pop r29 +} + 118: cf 91 pop r28 + 11a: 08 95 ret + +0000011c
: + 11c: c0 df rcall .-128 ; 0x9e { twi_init(); // Init TWI interface - f4: d4 df rcall .-88 ; 0x9e // Init HT16K22. Page 32 datasheet twi_start(); - f6: d9 df rcall .-78 ; 0xaa + 11e: c5 df rcall .-118 ; 0xaa twi_tx(0xE0); // Display I2C addres + R/W bit - f8: 80 ee ldi r24, 0xE0 ; 224 - fa: e3 df rcall .-58 ; 0xc2 + 120: 80 ee ldi r24, 0xE0 ; 224 + 122: cf df rcall .-98 ; 0xc2 twi_tx(0x21); // Internal osc on (page 10 HT16K33) - fc: 81 e2 ldi r24, 0x21 ; 33 - fe: e1 df rcall .-62 ; 0xc2 + 124: 81 e2 ldi r24, 0x21 ; 33 + 126: cd df rcall .-102 ; 0xc2 twi_stop(); - 100: dc df rcall .-72 ; 0xba + 128: c8 df rcall .-112 ; 0xba twi_start(); - 102: d3 df rcall .-90 ; 0xaa + 12a: bf df rcall .-130 ; 0xaa twi_tx(0xE0); // Display I2C address + R/W bit - 104: 80 ee ldi r24, 0xE0 ; 224 - 106: dd df rcall .-70 ; 0xc2 + 12c: 80 ee ldi r24, 0xE0 ; 224 + 12e: c9 df rcall .-110 ; 0xc2 twi_tx(0xA0); // HT16K33 pins all output - 108: 80 ea ldi r24, 0xA0 ; 160 + 130: 80 ea ldi r24, 0xA0 ; 160 twi_stop(); - 10a: db df rcall .-74 ; 0xc2 + 132: c7 df rcall .-114 ; 0xc2 twi_start(); - 10c: d6 df rcall .-84 ; 0xba + 134: c2 df rcall .-124 ; 0xba twi_tx(0xE0); // Display I2C address + R/W bit - 10e: cd df rcall .-102 ; 0xaa + 136: b9 df rcall .-142 ; 0xaa twi_tx(0xE3); // Display Dimming 4/16 duty cycle - 110: 80 ee ldi r24, 0xE0 ; 224 - 112: d7 df rcall .-82 ; 0xc2 + 138: 80 ee ldi r24, 0xE0 ; 224 + 13a: c3 df rcall .-122 ; 0xc2 twi_stop(); - 114: 83 ee ldi r24, 0xE3 ; 227 + 13c: 83 ee ldi r24, 0xE3 ; 227 twi_start(); - 116: d5 df rcall .-86 ; 0xc2 + 13e: c1 df rcall .-126 ; 0xc2 twi_tx(0xE0); // Display I2C address + R/W bit - 118: d0 df rcall .-96 ; 0xba - 11a: c7 df rcall .-114 ; 0xaa + 140: bc df rcall .-136 ; 0xba + 142: b3 df rcall .-154 ; 0xaa twi_tx(0x81); // Display OFF - Blink On - 11c: 80 ee ldi r24, 0xE0 ; 224 - 11e: d1 df rcall .-94 ; 0xc2 + 144: 80 ee ldi r24, 0xE0 ; 224 + 146: bd df rcall .-134 ; 0xc2 twi_stop(); - 120: 81 e8 ldi r24, 0x81 ; 129 + 148: 81 e8 ldi r24, 0x81 ; 129 + 14a: bb df rcall .-138 ; 0xc2 + matrix_clear(); + 14c: b6 df rcall .-148 ; 0xba + 14e: d2 df rcall .-92 ; 0xf4 while (1) { - twi_start(); - 122: cf df rcall .-98 ; 0xc2 - twi_tx(0xE0); // Display I2C addres + R/W bit - 124: ca df rcall .-108 ; 0xba - 126: c1 df rcall .-126 ; 0xaa - twi_tx(0x00); // Address - 128: 80 ee ldi r24, 0xE0 ; 224 - 12a: cb df rcall .-106 ; 0xc2 - 12c: 80 e0 ldi r24, 0x00 ; 0 - twi_tx(0x00); // data - 12e: c9 df rcall .-110 ; 0xc2 - 130: 80 e0 ldi r24, 0x00 ; 0 - 132: c7 df rcall .-114 ; 0xc2 - twi_stop(); - 134: c2 df rcall .-124 ; 0xba - 136: 84 ef ldi r24, 0xF4 ; 244 + for (int i = 0; i < 16; i += 2) + 150: c0 e0 ldi r28, 0x00 ; 0 + 152: d0 e0 ldi r29, 0x00 ; 0 + { + twi_start(); + 154: 0c c0 rjmp .+24 ; 0x16e + 156: a9 df rcall .-174 ; 0xaa + twi_tx(0xE0); + 158: 80 ee ldi r24, 0xE0 ; 224 + 15a: b3 df rcall .-154 ; 0xc2 + 15c: 8c 2f mov r24, r28 + twi_tx((char)i); + 15e: b1 df rcall .-158 ; 0xc2 + 160: 8f ef ldi r24, 0xFF ; 255 + 162: af df rcall .-162 ; 0xc2 + twi_tx(0xFF); + 164: aa df rcall .-172 ; 0xba + 166: 88 ec ldi r24, 0xC8 ; 200 + 168: 90 e0 ldi r25, 0x00 ; 0 + twi_stop(); + 16a: b5 df rcall .-150 ; 0xd6 + 16c: 22 96 adiw r28, 0x02 ; 2 + + wait(200); + 16e: c0 31 cpi r28, 0x10 ; 16 + 170: d1 05 cpc r29, r1 + 172: 8c f3 brlt .-30 ; 0x156 + 174: bf df rcall .-130 ; 0xf4 + twi_stop(); - wait(500); - 138: 91 e0 ldi r25, 0x01 ; 1 - 13a: cd df rcall .-102 ; 0xd6 - 13c: b6 df rcall .-148 ; 0xaa - 13e: 80 ee ldi r24, 0xE0 ; 224 + matrix_clear(); + while (1) + { + for (int i = 0; i < 16; i += 2) + 176: ec cf rjmp .-40 ; 0x150 - twi_start(); - 140: c0 df rcall .-128 ; 0xc2 - 142: 80 e0 ldi r24, 0x00 ; 0 - twi_tx(0xE0); // Display I2C addres + R/W bit - 144: be df rcall .-132 ; 0xc2 - 146: 81 e0 ldi r24, 0x01 ; 1 - 148: bc df rcall .-136 ; 0xc2 - twi_tx(0x00); // Address - 14a: b7 df rcall .-146 ; 0xba - 14c: 84 ef ldi r24, 0xF4 ; 244 - 14e: 91 e0 ldi r25, 0x01 ; 1 - twi_tx(0x01); // data - 150: c2 df rcall .-124 ; 0xd6 - 152: e9 cf rjmp .-46 ; 0x126 +00000178 <_exit>: + 178: f8 94 cli -00000154 <_exit>: - 154: f8 94 cli - -00000156 <__stop_program>: - twi_stop(); - 156: ff cf rjmp .-2 ; 0x156 <__stop_program> +0000017a <__stop_program>: + 17a: ff cf rjmp .-2 ; 0x17a <__stop_program> diff --git a/Microcontrollers/LCDMatrix/Debug/LCDMatrix.map b/Microcontrollers/LCDMatrix/Debug/LCDMatrix.map index 73b41bc..4941aff 100644 --- a/Microcontrollers/LCDMatrix/Debug/LCDMatrix.map +++ b/Microcontrollers/LCDMatrix/Debug/LCDMatrix.map @@ -153,7 +153,7 @@ END GROUP .rela.plt *(.rela.plt) -.text 0x00000000 0x158 +.text 0x00000000 0x17c *(.vectors) .vectors 0x00000000 0x8c C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.6.364/gcc/dev/atmega128/avr51/crtatmega128.o 0x00000000 __vector_default @@ -258,13 +258,16 @@ END GROUP 0x000000c2 twi_tx .text.wait 0x000000d6 0x1e main.o 0x000000d6 wait - .text.main 0x000000f4 0x60 main.o - 0x000000f4 main - 0x00000154 . = ALIGN (0x2) + .text.matrix_clear + 0x000000f4 0x28 main.o + 0x000000f4 matrix_clear + .text.main 0x0000011c 0x5c main.o + 0x0000011c main + 0x00000178 . = ALIGN (0x2) *(.fini9) - .fini9 0x00000154 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr51\libgcc.a(_exit.o) - 0x00000154 _exit - 0x00000154 exit + .fini9 0x00000178 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr51\libgcc.a(_exit.o) + 0x00000178 _exit + 0x00000178 exit *(.fini9) *(.fini8) *(.fini8) @@ -283,11 +286,11 @@ END GROUP *(.fini1) *(.fini1) *(.fini0) - .fini0 0x00000154 0x4 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr51\libgcc.a(_exit.o) + .fini0 0x00000178 0x4 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr51\libgcc.a(_exit.o) *(.fini0) - 0x00000158 _etext = . + 0x0000017c _etext = . -.data 0x00800100 0x0 load address 0x00000158 +.data 0x00800100 0x0 load address 0x0000017c [!provide] PROVIDE (__data_start, .) *(.data) *(.data*) @@ -305,8 +308,8 @@ END GROUP *(.bss*) *(COMMON) [!provide] PROVIDE (__bss_end, .) - 0x00000158 __data_load_start = LOADADDR (.data) - 0x00000158 __data_load_end = (__data_load_start + SIZEOF (.data)) + 0x0000017c __data_load_start = LOADADDR (.data) + 0x0000017c __data_load_end = (__data_load_start + SIZEOF (.data)) .noinit 0x00800100 0x0 [!provide] PROVIDE (__noinit_start, .) @@ -377,42 +380,42 @@ END GROUP .debug_sfnames *(.debug_sfnames) -.debug_aranges 0x00000000 0x48 +.debug_aranges 0x00000000 0x50 *(.debug_aranges) .debug_aranges - 0x00000000 0x48 main.o + 0x00000000 0x50 main.o .debug_pubnames *(.debug_pubnames) -.debug_info 0x00000000 0xaf1 +.debug_info 0x00000000 0xb36 *(.debug_info .gnu.linkonce.wi.*) .debug_info 0x00000000 0x780 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.6.364/gcc/dev/atmega128/avr51/crtatmega128.o - .debug_info 0x00000780 0x371 main.o + .debug_info 0x00000780 0x3b6 main.o -.debug_abbrev 0x00000000 0x862 +.debug_abbrev 0x00000000 0x885 *(.debug_abbrev) .debug_abbrev 0x00000000 0x718 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.6.364/gcc/dev/atmega128/avr51/crtatmega128.o - .debug_abbrev 0x00000718 0x14a main.o + .debug_abbrev 0x00000718 0x16d main.o -.debug_line 0x00000000 0x40a +.debug_line 0x00000000 0x451 *(.debug_line .debug_line.* .debug_line_end) .debug_line 0x00000000 0x16a C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.6.364/gcc/dev/atmega128/avr51/crtatmega128.o - .debug_line 0x0000016a 0x2a0 main.o + .debug_line 0x0000016a 0x2e7 main.o -.debug_frame 0x00000000 0x74 +.debug_frame 0x00000000 0x90 *(.debug_frame) - .debug_frame 0x00000000 0x74 main.o + .debug_frame 0x00000000 0x90 main.o -.debug_str 0x00000000 0x441 +.debug_str 0x00000000 0x44e *(.debug_str) .debug_str 0x00000000 0x27d C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.6.364/gcc/dev/atmega128/avr51/crtatmega128.o - .debug_str 0x0000027d 0x1c4 main.o - 0x1f8 (size before relaxing) + .debug_str 0x0000027d 0x1d1 main.o + 0x205 (size before relaxing) -.debug_loc 0x00000000 0x97 +.debug_loc 0x00000000 0x10e *(.debug_loc) - .debug_loc 0x00000000 0x97 main.o + .debug_loc 0x00000000 0x10e main.o .debug_macinfo *(.debug_macinfo) @@ -432,9 +435,9 @@ END GROUP .debug_pubtypes *(.debug_pubtypes) -.debug_ranges 0x00000000 0x38 +.debug_ranges 0x00000000 0x40 *(.debug_ranges) - .debug_ranges 0x00000000 0x38 main.o + .debug_ranges 0x00000000 0x40 main.o .debug_macro *(.debug_macro) diff --git a/Microcontrollers/LCDMatrix/Debug/LCDMatrix.srec b/Microcontrollers/LCDMatrix/Debug/LCDMatrix.srec index a081bbe..1fd758c 100644 --- a/Microcontrollers/LCDMatrix/Debug/LCDMatrix.srec +++ b/Microcontrollers/LCDMatrix/Debug/LCDMatrix.srec @@ -8,17 +8,19 @@ S113005025C0000023C0000021C000001FC0000014 S11300601DC000001BC0000019C0000017C0000024 S113007015C0000013C0000011C000000FC0000034 S11300800DC000000BC0000009C0000011241FBEF9 -S1130090CFEFD0E1DEBFCDBF2DD05CC0B1CF109289 +S1130090CFEFD0E1DEBFCDBF41D06EC0B1CF109263 S11300A0710080E280937000089584EA8093740064 S11300B0809174008823E4F7089584E980937400A0 S11300C008958093730084E8809374008091740091 -S11300D08823E4F7089520E030E008C0E9EFF0E079 +S11300D08823E4F7089520E030E008C0E3ECF9E079 S11300E03197F1F700C000002F5F3F4F2817390701 -S11300F0ACF30895D4DFD9DF80EEE3DF81E2E1DF02 -S1130100DCDFD3DF80EEDDDF80EADBDFD6DFCDDFCF -S113011080EED7DF83EED5DFD0DFC7DF80EED1DF1F -S113012081E8CFDFCADFC1DF80EECBDF80E0C9DF4B -S113013080E0C7DFC2DF84EF91E0CDDFB6DF80EE81 -S1130140C0DF80E0BEDF81E0BCDFB7DF84EF91E099 -S10B0150C2DFE9CFF894FFCFF0 +S11300F0ACF30895CF93DF93D8DF80EEE2DF80E0A6 +S1130100E0DFC0E0D0E003C080E0DBDF2196C03157 +S1130110D105D4F3D2DFDF91CF910895C0DFC5DFDD +S113012080EECFDF81E2CDDFC8DFBFDF80EEC9DF45 +S113013080EAC7DFC2DFB9DF80EEC3DF83EEC1DF51 +S1130140BCDFB3DF80EEBDDF81E8BBDFB6DFD2DF2B +S1130150C0E0D0E00CC0A9DF80EEB3DF8C2FB1DFAC +S11301608FEFAFDFAADF88EC90E0B5DF2296C031D5 +S10F0170D1058CF3BFDFECCFF894FFCF77 S9030000FC diff --git a/Microcontrollers/LCDMatrix/Debug/main.o b/Microcontrollers/LCDMatrix/Debug/main.o index a6d661e..ec9a969 100644 Binary files a/Microcontrollers/LCDMatrix/Debug/main.o and b/Microcontrollers/LCDMatrix/Debug/main.o differ diff --git a/Microcontrollers/LCDMatrix/main.c b/Microcontrollers/LCDMatrix/main.c index b455520..e57d297 100644 --- a/Microcontrollers/LCDMatrix/main.c +++ b/Microcontrollers/LCDMatrix/main.c @@ -14,6 +14,7 @@ ** Author: dkroeske@gmail.com ** -------------------------------------------------------------------------*/ +#define F_CPU 10e6 #include #include @@ -92,6 +93,21 @@ Version : DMK, Initial code } } +void matrix_clear() +{ + twi_start(); + twi_tx(0xE0); + twi_tx(0x00); + for (int i = 0; i < 16; i++) + { + + twi_tx(0x00); + } + twi_stop(); +} + +void turn_on_set_led() + /******************************************************************/ int main( void ) /* @@ -126,23 +142,21 @@ Version : DMK, Initial code twi_tx(0x81); // Display OFF - Blink On twi_stop(); + matrix_clear(); while (1) { - twi_start(); - twi_tx(0xE0); // Display I2C addres + R/W bit - twi_tx(0x00); // Address - twi_tx(0x00); // data - twi_stop(); - - wait(500); - - twi_start(); - twi_tx(0xE0); // Display I2C addres + R/W bit - twi_tx(0x00); // Address - twi_tx(0x01); // data - twi_stop(); - - wait(500); + for (int i = 0; i < 16; i += 2) + { + twi_start(); + twi_tx(0xE0); + twi_tx((char)i); + twi_tx(0xFF); + twi_stop(); + + wait(200); + } + matrix_clear(); + } return 1;