diff --git a/.vs/AtTiny_alarm_clock/v14/.atsuo b/.vs/AtTiny_alarm_clock/v14/.atsuo index 8512f01..813b4ec 100644 Binary files a/.vs/AtTiny_alarm_clock/v14/.atsuo and b/.vs/AtTiny_alarm_clock/v14/.atsuo differ diff --git a/Debug/AtTiny_alarm_clock.elf b/Debug/AtTiny_alarm_clock.elf index 89592e1..c964914 100644 Binary files a/Debug/AtTiny_alarm_clock.elf and b/Debug/AtTiny_alarm_clock.elf differ diff --git a/Debug/AtTiny_alarm_clock.hex b/Debug/AtTiny_alarm_clock.hex index c56528b..016e5b3 100644 --- a/Debug/AtTiny_alarm_clock.hex +++ b/Debug/AtTiny_alarm_clock.hex @@ -1,9 +1,9 @@ :1000000014C02CC02BC02AC029C0A7C027C026C03E :1000100025C024C023C022C021C020C01FC01EC0D4 :100020001DC01CC01BC01AC019C011241FBECFEDBB -:10003000CDBF10E0A0E6B0E0E6EFF2E002C0059030 -:100040000D92A237B107D9F720E0A2E7B0E001C0D6 -:100050001D92A837B207E1F7F4D04BC1D1CFCF93AF +:10003000CDBF10E0A0E6B0E0E6EEF3E002C0059030 +:100040000D92A43BB107D9F720E0A4EBB0E001C0CA +:100050001D92AC3BB207E1F7F5D0C3C1D1CFCF932E :10006000C2E362D0C150E9F7CF910895CF93C62F74 :10007000843038F4823048F4882371F0813049F0BC :100080000CC0843051F4939808C04F73833009F446 @@ -26,26 +26,45 @@ :10019000E816F10431F00AC06894EE24E1F8F12C7D :1001A00005C00F2EF3E0EF2EF12CF02D042F152FAC :1001B000C0E0F80161918F016F3519F04C2F8E2D41 -:1001C00055DFCF5FC031A9F7CF911F910F91FF90FD -:1001D000EF90089520B3BC016F5F7F4F409177008F -:1001E000E1E0F0E0DF0102C0AA0FBB1F8A95E2F751 -:1001F000CD01237030E051E02617370709F050E0B9 -:10020000242F30E028233923E1E0121613060CF0E6 -:10021000E0E05E1799F020B3237030E062177307B7 -:1002200031F4842B8093770081E090E008958095ED -:1002300048234093770080E090E0089580E090E0CC -:10024000089511BA86EE99EF9DBD8CBD1FBC85E067 -:100250008EBD80E889BF7894C2E7D0E080917400B9 -:10026000882319F0813051F0FBCF109275003DDFEB -:1002700081E036DF81E080937400F0CF81E08093ED -:10028000750040E650E060E070E080E090E077DFED -:1002900080E090E09FDF892B51F080917200909177 -:1002A0007300019690937300809372001DC081E0EB -:1002B00090E090DF892B51F0809172009091730053 -:1002C000029690937300809372000EC082E090E0DB -:1002D00081DF892B49F08091720090917300039621 -:1002E00090937300809372008881805D809360009A -:0602F000B5CFF894FFCF2A -:1002F6002048616C6C6F5F5F5F5F5F5F5F5F5F5F32 -:020306005F0096 +:1001C00055DF4DDFCF5FC031A1F7CF911F910F9168 +:1001D000FF90EF90089520B3BC016F5F7F4F409177 +:1001E000BB00E1E0F0E0DF0102C0AA0FBB1F8A956F +:1001F000E2F7CD01237030E051E02617370709F010 +:1002000050E0242F30E028233923E1E012161306B2 +:100210000CF0E0E05E1799F020B3237030E0621735 +:10022000730731F4842B8093BB0081E090E0089544 +:10023000809548234093BB0080E090E0089580E0E3 +:1002400090E00895CF93DF93CDB7DD27C054CDBFA5 +:1002500011BA86EE99EF9DBD8CBD1FBC85E08EBDA9 +:1002600080E889BF78940F2EF2E6EF2EF0E0FF2EA3 +:10027000F02D06EB10E06894DD24D1F89091B900E0 +:100280008091B800981799F08093B90021E030E090 +:100290003093B5002093B400309361002093600048 +:1002A0008130F1F078F0823009F46DC0E7CF109220 +:1002B000B5001092B400913069F020F0923009F44A +:1002C00062C0DCCF12DFCBDE81E00ADF81E0809309 +:1002D000B800D4CF8091600090916100892B41F1EA +:1002E000BEDE80E1E3E7F0E0DE01D19601900D9201 +:1002F0008A95E1F7AE014F5C5F4F60E070E080E00F +:1003000090E03DDFACDE80E1E3E8F0E0DE019196D5 +:1003100001900D928A95E1F7AE014F5D5F4F60E06D +:1003200070E081E090E02BDF10926100109260009D +:1003300080E090E050DF892B19F0D092B8001DC00A +:1003400081E090E048DF892B51F08091B6009091D8 +:10035000B70002969093B7008093B6000EC082E07B +:1003600090E039DF892B49F08091B6009091B70079 +:1003700003969093B7008093B600F8018081805D6A +:10038000F70180837BCF8091600090916100892B81 +:1003900009F474CF80E1E3E9F0E0DE0151960190C9 +:1003A0000D928A95E1F7AE014F5E5F4F60E070E01D +:1003B00080E090E0E4DE80E1E3EAF0E0DE01119627 +:1003C00001900D928A95E1F7AE014F5F5F4F60E0BB +:1003D00070E081E090E0D3DE109261001092600046 +:0603E0004DCFF894FFCFA1 +:1003E60001002048616C6C6F5F5F5F5F5F5F5F5FFE +:1003F6005F5F5F5F5F5F5F5F5F74696D655F5F5FD4 +:100406005F5F5F20202020202074696D65202020FA +:1004160020202020205B616C61726D2074696D65FF +:100426005D20202020202020616C61726D203E20FE +:040436002020200062 :00000001FF diff --git a/Debug/AtTiny_alarm_clock.lss b/Debug/AtTiny_alarm_clock.lss index 2fcbdc7..a2216fd 100644 --- a/Debug/AtTiny_alarm_clock.lss +++ b/Debug/AtTiny_alarm_clock.lss @@ -3,31 +3,31 @@ AtTiny_alarm_clock.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000002f6 00000000 00000000 00000094 2**1 + 0 .text 000003e6 00000000 00000000 00000094 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .data 00000012 00800060 000002f6 0000038a 2**0 + 1 .data 00000054 00800060 000003e6 0000047a 2**0 CONTENTS, ALLOC, LOAD, DATA - 2 .bss 00000006 00800072 00800072 0000039c 2**0 + 2 .bss 00000008 008000b4 008000b4 000004ce 2**0 ALLOC - 3 .comment 00000030 00000000 00000000 0000039c 2**0 + 3 .comment 00000030 00000000 00000000 000004ce 2**0 CONTENTS, READONLY - 4 .note.gnu.avr.deviceinfo 00000040 00000000 00000000 000003cc 2**2 + 4 .note.gnu.avr.deviceinfo 00000040 00000000 00000000 00000500 2**2 CONTENTS, READONLY - 5 .debug_aranges 000000a0 00000000 00000000 0000040c 2**0 + 5 .debug_aranges 000000a0 00000000 00000000 00000540 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_info 00000b59 00000000 00000000 000004ac 2**0 + 6 .debug_info 00000c54 00000000 00000000 000005e0 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_abbrev 00000738 00000000 00000000 00001005 2**0 + 7 .debug_abbrev 0000073a 00000000 00000000 00001234 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_line 0000061f 00000000 00000000 0000173d 2**0 + 8 .debug_line 00000689 00000000 00000000 0000196e 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_frame 00000154 00000000 00000000 00001d5c 2**2 + 9 .debug_frame 00000164 00000000 00000000 00001ff8 2**2 CONTENTS, READONLY, DEBUGGING - 10 .debug_str 00000470 00000000 00000000 00001eb0 2**0 + 10 .debug_str 00000493 00000000 00000000 0000215c 2**0 CONTENTS, READONLY, DEBUGGING - 11 .debug_loc 00000428 00000000 00000000 00002320 2**0 + 11 .debug_loc 00000470 00000000 00000000 000025ef 2**0 CONTENTS, READONLY, DEBUGGING - 12 .debug_ranges 00000088 00000000 00000000 00002748 2**0 + 12 .debug_ranges 00000088 00000000 00000000 00002a5f 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -65,18 +65,18 @@ Disassembly of section .text: 32: 10 e0 ldi r17, 0x00 ; 0 34: a0 e6 ldi r26, 0x60 ; 96 36: b0 e0 ldi r27, 0x00 ; 0 - 38: e6 ef ldi r30, 0xF6 ; 246 - 3a: f2 e0 ldi r31, 0x02 ; 2 + 38: e6 ee ldi r30, 0xE6 ; 230 + 3a: f3 e0 ldi r31, 0x03 ; 3 3c: 02 c0 rjmp .+4 ; 0x42 <__SREG__+0x3> 3e: 05 90 lpm r0, Z+ 40: 0d 92 st X+, r0 - 42: a2 37 cpi r26, 0x72 ; 114 + 42: a4 3b cpi r26, 0xB4 ; 180 44: b1 07 cpc r27, r17 46: d9 f7 brne .-10 ; 0x3e <__SP_L__+0x1> 00000048 <__do_clear_bss>: 48: 20 e0 ldi r18, 0x00 ; 0 - 4a: a2 e7 ldi r26, 0x72 ; 114 + 4a: a4 eb ldi r26, 0xB4 ; 180 4c: b0 e0 ldi r27, 0x00 ; 0 4e: 01 c0 rjmp .+2 ; 0x52 <.do_clear_bss_start> @@ -84,11 +84,11 @@ Disassembly of section .text: 50: 1d 92 st X+, r1 00000052 <.do_clear_bss_start>: - 52: a8 37 cpi r26, 0x78 ; 120 + 52: ac 3b cpi r26, 0xBC ; 188 54: b2 07 cpc r27, r18 56: e1 f7 brne .-8 ; 0x50 <.do_clear_bss_loop> - 58: f4 d0 rcall .+488 ; 0x242
- 5a: 4b c1 rjmp .+662 ; 0x2f2 <_exit> + 58: f5 d0 rcall .+490 ; 0x244
+ 5a: c3 c1 rjmp .+902 ; 0x3e2 <_exit> 0000005c <__bad_interrupt>: 5c: d1 cf rjmp .-94 ; 0x0 <__vectors> @@ -328,9 +328,9 @@ void wait_100us(void){ 158: 08 95 ret 0000015a <__vector_5>: -int counter = 0; -uint8_t flags; +int clock_state_changed = 0; +int update_display = 1; ISR (TIMER1_OVF_vect) // Timer1 ISR { @@ -361,7 +361,7 @@ ISR (TIMER1_OVF_vect) // Timer1 ISR } } -void lcd_write_text(int row, int col, uint8_t text[16]) +void lcd_write_text(int row, int col, uint8_t text[]) { 17e: ef 92 push r14 180: ff 92 push r15 @@ -408,233 +408,383 @@ void lcd_write_text(int row, int col, uint8_t text[16]) 1bc: 4c 2f mov r20, r28 1be: 8e 2d mov r24, r14 1c0: 55 df rcall .-342 ; 0x6c - 1c2: cf 5f subi r28, 0xFF ; 255 + } + lcd_5ms(); + 1c2: 4d df rcall .-358 ; 0x5e + 1c4: cf 5f subi r28, 0xFF ; 255 break; case 1: row = line2; break; } for(int i=0;i<=15;i++){ - 1c4: c0 31 cpi r28, 0x10 ; 16 - 1c6: a9 f7 brne .-22 ; 0x1b2 + 1c6: c0 31 cpi r28, 0x10 ; 16 + 1c8: a1 f7 brne .-24 ; 0x1b2 if(text[i] != 0x5F){ lcd_write(row, text[i], 0+i); } + lcd_5ms(); } } - 1c8: cf 91 pop r28 - 1ca: 1f 91 pop r17 - 1cc: 0f 91 pop r16 - 1ce: ff 90 pop r15 - 1d0: ef 90 pop r14 - 1d2: 08 95 ret + 1ca: cf 91 pop r28 + 1cc: 1f 91 pop r17 + 1ce: 0f 91 pop r16 + 1d0: ff 90 pop r15 + 1d2: ef 90 pop r14 + 1d4: 08 95 ret -000001d4 : +000001d6 : int button_clicked(int button) { if(((PIND & 0x03) == button+1) != ((flags & (1<0)){ - 1d4: 20 b3 in r18, 0x10 ; 16 - 1d6: bc 01 movw r22, r24 - 1d8: 6f 5f subi r22, 0xFF ; 255 - 1da: 7f 4f sbci r23, 0xFF ; 255 - 1dc: 40 91 77 00 lds r20, 0x0077 ; 0x800077 - 1e0: e1 e0 ldi r30, 0x01 ; 1 - 1e2: f0 e0 ldi r31, 0x00 ; 0 - 1e4: df 01 movw r26, r30 - 1e6: 02 c0 rjmp .+4 ; 0x1ec - 1e8: aa 0f add r26, r26 - 1ea: bb 1f adc r27, r27 - 1ec: 8a 95 dec r24 - 1ee: e2 f7 brpl .-8 ; 0x1e8 - 1f0: cd 01 movw r24, r26 - 1f2: 23 70 andi r18, 0x03 ; 3 - 1f4: 30 e0 ldi r19, 0x00 ; 0 - 1f6: 51 e0 ldi r21, 0x01 ; 1 - 1f8: 26 17 cp r18, r22 - 1fa: 37 07 cpc r19, r23 - 1fc: 09 f0 breq .+2 ; 0x200 - 1fe: 50 e0 ldi r21, 0x00 ; 0 - 200: 24 2f mov r18, r20 - 202: 30 e0 ldi r19, 0x00 ; 0 - 204: 28 23 and r18, r24 - 206: 39 23 and r19, r25 - 208: e1 e0 ldi r30, 0x01 ; 1 - 20a: 12 16 cp r1, r18 - 20c: 13 06 cpc r1, r19 - 20e: 0c f0 brlt .+2 ; 0x212 - 210: e0 e0 ldi r30, 0x00 ; 0 - 212: 5e 17 cp r21, r30 - 214: 99 f0 breq .+38 ; 0x23c + 1d6: 20 b3 in r18, 0x10 ; 16 + 1d8: bc 01 movw r22, r24 + 1da: 6f 5f subi r22, 0xFF ; 255 + 1dc: 7f 4f sbci r23, 0xFF ; 255 + 1de: 40 91 bb 00 lds r20, 0x00BB ; 0x8000bb + 1e2: e1 e0 ldi r30, 0x01 ; 1 + 1e4: f0 e0 ldi r31, 0x00 ; 0 + 1e6: df 01 movw r26, r30 + 1e8: 02 c0 rjmp .+4 ; 0x1ee + 1ea: aa 0f add r26, r26 + 1ec: bb 1f adc r27, r27 + 1ee: 8a 95 dec r24 + 1f0: e2 f7 brpl .-8 ; 0x1ea + 1f2: cd 01 movw r24, r26 + 1f4: 23 70 andi r18, 0x03 ; 3 + 1f6: 30 e0 ldi r19, 0x00 ; 0 + 1f8: 51 e0 ldi r21, 0x01 ; 1 + 1fa: 26 17 cp r18, r22 + 1fc: 37 07 cpc r19, r23 + 1fe: 09 f0 breq .+2 ; 0x202 + 200: 50 e0 ldi r21, 0x00 ; 0 + 202: 24 2f mov r18, r20 + 204: 30 e0 ldi r19, 0x00 ; 0 + 206: 28 23 and r18, r24 + 208: 39 23 and r19, r25 + 20a: e1 e0 ldi r30, 0x01 ; 1 + 20c: 12 16 cp r1, r18 + 20e: 13 06 cpc r1, r19 + 210: 0c f0 brlt .+2 ; 0x214 + 212: e0 e0 ldi r30, 0x00 ; 0 + 214: 5e 17 cp r21, r30 + 216: 99 f0 breq .+38 ; 0x23e //if the pin is not equal to the stored state -> was pressed or released //check is the button has been pressed or released if((PIND & 0x03) == button+1){ - 216: 20 b3 in r18, 0x10 ; 16 - 218: 23 70 andi r18, 0x03 ; 3 - 21a: 30 e0 ldi r19, 0x00 ; 0 - 21c: 62 17 cp r22, r18 - 21e: 73 07 cpc r23, r19 - 220: 31 f4 brne .+12 ; 0x22e + 218: 20 b3 in r18, 0x10 ; 16 + 21a: 23 70 andi r18, 0x03 ; 3 + 21c: 30 e0 ldi r19, 0x00 ; 0 + 21e: 62 17 cp r22, r18 + 220: 73 07 cpc r23, r19 + 222: 31 f4 brne .+12 ; 0x230 //button is high -> pressed - flags |= (1< + flags |= (1< return(1); - 228: 81 e0 ldi r24, 0x01 ; 1 - 22a: 90 e0 ldi r25, 0x00 ; 0 - 22c: 08 95 ret + 22a: 81 e0 ldi r24, 0x01 ; 1 + 22c: 90 e0 ldi r25, 0x00 ; 0 + 22e: 08 95 ret } else{ //button is low -> released - flags &= ~(1< + flags &= ~(1< return(0); - 236: 80 e0 ldi r24, 0x00 ; 0 - 238: 90 e0 ldi r25, 0x00 ; 0 - 23a: 08 95 ret + 238: 80 e0 ldi r24, 0x00 ; 0 + 23a: 90 e0 ldi r25, 0x00 ; 0 + 23c: 08 95 ret } } return(0); - 23c: 80 e0 ldi r24, 0x00 ; 0 - 23e: 90 e0 ldi r25, 0x00 ; 0 + 23e: 80 e0 ldi r24, 0x00 ; 0 + 240: 90 e0 ldi r25, 0x00 ; 0 } - 240: 08 95 ret + 242: 08 95 ret -00000242
: +00000244
: + //counter++; TCNT1 = 63974; } int main(void) { + 244: cf 93 push r28 + 246: df 93 push r29 + 248: cd b7 in r28, 0x3d ; 61 + 24a: dd 27 eor r29, r29 + 24c: c0 54 subi r28, 0x40 ; 64 + 24e: cd bf out 0x3d, r28 ; 61 DDRD = 0x00; - 242: 11 ba out 0x11, r1 ; 17 + 250: 11 ba out 0x11, r1 ; 17 TCNT1 = 63974; // for 1 sec at 16 MHz - 244: 86 ee ldi r24, 0xE6 ; 230 - 246: 99 ef ldi r25, 0xF9 ; 249 - 248: 9d bd out 0x2d, r25 ; 45 - 24a: 8c bd out 0x2c, r24 ; 44 + 252: 86 ee ldi r24, 0xE6 ; 230 + 254: 99 ef ldi r25, 0xF9 ; 249 + 256: 9d bd out 0x2d, r25 ; 45 + 258: 8c bd out 0x2c, r24 ; 44 TCCR1A = 0x00; - 24c: 1f bc out 0x2f, r1 ; 47 + 25a: 1f bc out 0x2f, r1 ; 47 TCCR1B = (1< + if(clock_state != clock_new_state){ + 27c: 90 91 b9 00 lds r25, 0x00B9 ; 0x8000b9 + 280: 80 91 b8 00 lds r24, 0x00B8 ; 0x8000b8 + 284: 98 17 cp r25, r24 + 286: 99 f0 breq .+38 ; 0x2ae + clock_state = clock_new_state; + 288: 80 93 b9 00 sts 0x00B9, r24 ; 0x8000b9 + clock_state_changed = 1; + 28c: 21 e0 ldi r18, 0x01 ; 1 + 28e: 30 e0 ldi r19, 0x00 ; 0 + 290: 30 93 b5 00 sts 0x00B5, r19 ; 0x8000b5 <__data_end+0x1> + 294: 20 93 b4 00 sts 0x00B4, r18 ; 0x8000b4 <__data_end> + update_display = 1; + 298: 30 93 61 00 sts 0x0061, r19 ; 0x800061 <__data_start+0x1> + 29c: 20 93 60 00 sts 0x0060, r18 ; 0x800060 <__data_start> + else { + clock_state_changed = 0; + } + + switch(clock_state){ - 260: 88 23 and r24, r24 - 262: 19 f0 breq .+6 ; 0x26a - 264: 81 30 cpi r24, 0x01 ; 1 - 266: 51 f0 breq .+20 ; 0x27c - 268: fb cf rjmp .-10 ; 0x260 - 26a: 10 92 75 00 sts 0x0075, r1 ; 0x800075 + 2a0: 81 30 cpi r24, 0x01 ; 1 + 2a2: f1 f0 breq .+60 ; 0x2e0 + 2a4: 78 f0 brcs .+30 ; 0x2c4 + 2a6: 82 30 cpi r24, 0x02 ; 2 + 2a8: 09 f4 brne .+2 ; 0x2ac + 2aa: 6d c0 rjmp .+218 ; 0x386 + 2ac: e7 cf rjmp .-50 ; 0x27c + clock_state = clock_new_state; + clock_state_changed = 1; + update_display = 1; + } + else { + clock_state_changed = 0; + 2ae: 10 92 b5 00 sts 0x00B5, r1 ; 0x8000b5 <__data_end+0x1> + 2b2: 10 92 b4 00 sts 0x00B4, r1 ; 0x8000b4 <__data_end> + } + + + switch(clock_state){ + 2b6: 91 30 cpi r25, 0x01 ; 1 + 2b8: 69 f0 breq .+26 ; 0x2d4 + 2ba: 20 f0 brcs .+8 ; 0x2c4 + 2bc: 92 30 cpi r25, 0x02 ; 2 + 2be: 09 f4 brne .+2 ; 0x2c2 + 2c0: 62 c0 rjmp .+196 ; 0x386 + 2c2: dc cf rjmp .-72 ; 0x27c case CLOCK_INIT: //do some init stuff... - lcd_init(); //I know, it's just c but I don't care - 26e: 3d df rcall .-390 ; 0xea + lcd_init(); + 2c4: 12 df rcall .-476 ; 0xea + lcd_5ms(); + 2c6: cb de rcall .-618 ; 0x5e lcd_instruct(lcd_DISPLAY_CLEAR); - 270: 81 e0 ldi r24, 0x01 ; 1 - 272: 36 df rcall .-404 ; 0xe0 + 2c8: 81 e0 ldi r24, 0x01 ; 1 + 2ca: 0a df rcall .-492 ; 0xe0 //INIT done -> change to IDLE clock_new_state = CLOCK_IDLE; - 274: 81 e0 ldi r24, 0x01 ; 1 - 276: 80 93 74 00 sts 0x0074, r24 ; 0x800074 - + 2cc: 81 e0 ldi r24, 0x01 ; 1 + 2ce: 80 93 b8 00 sts 0x00B8, r24 ; 0x8000b8 + break; - 27a: f0 cf rjmp .-32 ; 0x25c - 27c: 81 e0 ldi r24, 0x01 ; 1 - 27e: 80 93 75 00 sts 0x0075, r24 ; 0x800075 + 2d2: d4 cf rjmp .-88 ; 0x27c case CLOCK_IDLE: //IDLE MODE //print the IDLE Screen - - lcd_write_text(0,0,t1); - 282: 40 e6 ldi r20, 0x60 ; 96 - 284: 50 e0 ldi r21, 0x00 ; 0 - 286: 60 e0 ldi r22, 0x00 ; 0 - 288: 70 e0 ldi r23, 0x00 ; 0 - 28a: 80 e0 ldi r24, 0x00 ; 0 - 28c: 90 e0 ldi r25, 0x00 ; 0 - 28e: 77 df rcall .-274 ; 0x17e - + + if(update_display){ + 2d4: 80 91 60 00 lds r24, 0x0060 ; 0x800060 <__data_start> + 2d8: 90 91 61 00 lds r25, 0x0061 ; 0x800061 <__data_start+0x1> + 2dc: 89 2b or r24, r25 + 2de: 41 f1 breq .+80 ; 0x330 + lcd_5ms(); + 2e0: be de rcall .-644 ; 0x5e + lcd_write_text(0,0,(uint8_t []){'_','_','_','_','_','_','t','i','m','e','_','_','_','_','_','_'}); + 2e2: 80 e1 ldi r24, 0x10 ; 16 + 2e4: e3 e7 ldi r30, 0x73 ; 115 + 2e6: f0 e0 ldi r31, 0x00 ; 0 + 2e8: de 01 movw r26, r28 + 2ea: d1 96 adiw r26, 0x31 ; 49 + 2ec: 01 90 ld r0, Z+ + 2ee: 0d 92 st X+, r0 + 2f0: 8a 95 dec r24 + 2f2: e1 f7 brne .-8 ; 0x2ec + 2f4: ae 01 movw r20, r28 + 2f6: 4f 5c subi r20, 0xCF ; 207 + 2f8: 5f 4f sbci r21, 0xFF ; 255 + 2fa: 60 e0 ldi r22, 0x00 ; 0 + 2fc: 70 e0 ldi r23, 0x00 ; 0 + 2fe: 80 e0 ldi r24, 0x00 ; 0 + 300: 90 e0 ldi r25, 0x00 ; 0 + 302: 3d df rcall .-390 ; 0x17e + lcd_5ms(); + 304: ac de rcall .-680 ; 0x5e + lcd_write_text(1,0,(uint8_t []){' ',' ',' ',' ',' ',' ','t','i','m','e',' ',' ',' ',' ',' ',' '}); + 306: 80 e1 ldi r24, 0x10 ; 16 + 308: e3 e8 ldi r30, 0x83 ; 131 + 30a: f0 e0 ldi r31, 0x00 ; 0 + 30c: de 01 movw r26, r28 + 30e: 91 96 adiw r26, 0x21 ; 33 + 310: 01 90 ld r0, Z+ + 312: 0d 92 st X+, r0 + 314: 8a 95 dec r24 + 316: e1 f7 brne .-8 ; 0x310 + 318: ae 01 movw r20, r28 + 31a: 4f 5d subi r20, 0xDF ; 223 + 31c: 5f 4f sbci r21, 0xFF ; 255 + 31e: 60 e0 ldi r22, 0x00 ; 0 + 320: 70 e0 ldi r23, 0x00 ; 0 + 322: 81 e0 ldi r24, 0x01 ; 1 + 324: 90 e0 ldi r25, 0x00 ; 0 + 326: 2b df rcall .-426 ; 0x17e + update_display = 0; + 328: 10 92 61 00 sts 0x0061, r1 ; 0x800061 <__data_start+0x1> + 32c: 10 92 60 00 sts 0x0060, r1 ; 0x800060 <__data_start> + } if(button_clicked(butt1)){ - 290: 80 e0 ldi r24, 0x00 ; 0 - 292: 90 e0 ldi r25, 0x00 ; 0 - 294: 9f df rcall .-194 ; 0x1d4 - 296: 89 2b or r24, r25 - 298: 51 f0 breq .+20 ; 0x2ae - counter++; - 29a: 80 91 72 00 lds r24, 0x0072 ; 0x800072 <__data_end> - 29e: 90 91 73 00 lds r25, 0x0073 ; 0x800073 <__data_end+0x1> - 2a2: 01 96 adiw r24, 0x01 ; 1 - 2a4: 90 93 73 00 sts 0x0073, r25 ; 0x800073 <__data_end+0x1> - 2a8: 80 93 72 00 sts 0x0072, r24 ; 0x800072 <__data_end> - 2ac: 1d c0 rjmp .+58 ; 0x2e8 + 330: 80 e0 ldi r24, 0x00 ; 0 + 332: 90 e0 ldi r25, 0x00 ; 0 + 334: 50 df rcall .-352 ; 0x1d6 + 336: 89 2b or r24, r25 + 338: 19 f0 breq .+6 ; 0x340 + clock_new_state = CLOCK_ALARM; + 33a: d0 92 b8 00 sts 0x00B8, r13 ; 0x8000b8 + 33e: 1d c0 rjmp .+58 ; 0x37a } else if(button_clicked(butt2)){ - 2ae: 81 e0 ldi r24, 0x01 ; 1 - 2b0: 90 e0 ldi r25, 0x00 ; 0 - 2b2: 90 df rcall .-224 ; 0x1d4 - 2b4: 89 2b or r24, r25 - 2b6: 51 f0 breq .+20 ; 0x2cc + 340: 81 e0 ldi r24, 0x01 ; 1 + 342: 90 e0 ldi r25, 0x00 ; 0 + 344: 48 df rcall .-368 ; 0x1d6 + 346: 89 2b or r24, r25 + 348: 51 f0 breq .+20 ; 0x35e counter += 2; - 2b8: 80 91 72 00 lds r24, 0x0072 ; 0x800072 <__data_end> - 2bc: 90 91 73 00 lds r25, 0x0073 ; 0x800073 <__data_end+0x1> - 2c0: 02 96 adiw r24, 0x02 ; 2 - 2c2: 90 93 73 00 sts 0x0073, r25 ; 0x800073 <__data_end+0x1> - 2c6: 80 93 72 00 sts 0x0072, r24 ; 0x800072 <__data_end> - 2ca: 0e c0 rjmp .+28 ; 0x2e8 + 34a: 80 91 b6 00 lds r24, 0x00B6 ; 0x8000b6 + 34e: 90 91 b7 00 lds r25, 0x00B7 ; 0x8000b7 + 352: 02 96 adiw r24, 0x02 ; 2 + 354: 90 93 b7 00 sts 0x00B7, r25 ; 0x8000b7 + 358: 80 93 b6 00 sts 0x00B6, r24 ; 0x8000b6 + 35c: 0e c0 rjmp .+28 ; 0x37a } else if(button_clicked(butt3)){ - 2cc: 82 e0 ldi r24, 0x02 ; 2 - 2ce: 90 e0 ldi r25, 0x00 ; 0 - 2d0: 81 df rcall .-254 ; 0x1d4 - 2d2: 89 2b or r24, r25 - 2d4: 49 f0 breq .+18 ; 0x2e8 + 35e: 82 e0 ldi r24, 0x02 ; 2 + 360: 90 e0 ldi r25, 0x00 ; 0 + 362: 39 df rcall .-398 ; 0x1d6 + 364: 89 2b or r24, r25 + 366: 49 f0 breq .+18 ; 0x37a counter += 3; - 2d6: 80 91 72 00 lds r24, 0x0072 ; 0x800072 <__data_end> - 2da: 90 91 73 00 lds r25, 0x0073 ; 0x800073 <__data_end+0x1> - 2de: 03 96 adiw r24, 0x03 ; 3 - 2e0: 90 93 73 00 sts 0x0073, r25 ; 0x800073 <__data_end+0x1> - 2e4: 80 93 72 00 sts 0x0072, r24 ; 0x800072 <__data_end> -// flags &= ~(1< + 36c: 90 91 b7 00 lds r25, 0x00B7 ; 0x8000b7 + 370: 03 96 adiw r24, 0x03 ; 3 + 372: 90 93 b7 00 sts 0x00B7, r25 ; 0x8000b7 + 376: 80 93 b6 00 sts 0x00B6, r24 ; 0x8000b6 + } t1[0] = counter + 48; - 2e8: 88 81 ld r24, Y - 2ea: 80 5d subi r24, 0xD0 ; 208 - 2ec: 80 93 60 00 sts 0x0060, r24 ; 0x800060 <__data_start> + 37a: f8 01 movw r30, r16 + 37c: 80 81 ld r24, Z + 37e: 80 5d subi r24, 0xD0 ; 208 + 380: f7 01 movw r30, r14 + 382: 80 83 st Z, r24 break; - 2f0: b5 cf rjmp .-150 ; 0x25c + 384: 7b cf rjmp .-266 ; 0x27c + + case CLOCK_ALARM: + //ALARM setup Mode + //print the ALARM screen + if(update_display){ + 386: 80 91 60 00 lds r24, 0x0060 ; 0x800060 <__data_start> + 38a: 90 91 61 00 lds r25, 0x0061 ; 0x800061 <__data_start+0x1> + 38e: 89 2b or r24, r25 + 390: 09 f4 brne .+2 ; 0x394 + 392: 74 cf rjmp .-280 ; 0x27c + lcd_write_text(0,0,(uint8_t []){' ',' ','[','a','l','a','r','m',' ','t','i','m','e',']',' ',' '}); + 394: 80 e1 ldi r24, 0x10 ; 16 + 396: e3 e9 ldi r30, 0x93 ; 147 + 398: f0 e0 ldi r31, 0x00 ; 0 + 39a: de 01 movw r26, r28 + 39c: 51 96 adiw r26, 0x11 ; 17 + 39e: 01 90 ld r0, Z+ + 3a0: 0d 92 st X+, r0 + 3a2: 8a 95 dec r24 + 3a4: e1 f7 brne .-8 ; 0x39e + 3a6: ae 01 movw r20, r28 + 3a8: 4f 5e subi r20, 0xEF ; 239 + 3aa: 5f 4f sbci r21, 0xFF ; 255 + 3ac: 60 e0 ldi r22, 0x00 ; 0 + 3ae: 70 e0 ldi r23, 0x00 ; 0 + 3b0: 80 e0 ldi r24, 0x00 ; 0 + 3b2: 90 e0 ldi r25, 0x00 ; 0 + 3b4: e4 de rcall .-568 ; 0x17e + lcd_write_text(1,0,(uint8_t []){' ',' ',' ',' ',' ','a','l','a','r','m',' ','>',' ',' ',' ',' '}); + 3b6: 80 e1 ldi r24, 0x10 ; 16 + 3b8: e3 ea ldi r30, 0xA3 ; 163 + 3ba: f0 e0 ldi r31, 0x00 ; 0 + 3bc: de 01 movw r26, r28 + 3be: 11 96 adiw r26, 0x01 ; 1 + 3c0: 01 90 ld r0, Z+ + 3c2: 0d 92 st X+, r0 + 3c4: 8a 95 dec r24 + 3c6: e1 f7 brne .-8 ; 0x3c0 + 3c8: ae 01 movw r20, r28 + 3ca: 4f 5f subi r20, 0xFF ; 255 + 3cc: 5f 4f sbci r21, 0xFF ; 255 + 3ce: 60 e0 ldi r22, 0x00 ; 0 + 3d0: 70 e0 ldi r23, 0x00 ; 0 + 3d2: 81 e0 ldi r24, 0x01 ; 1 + 3d4: 90 e0 ldi r25, 0x00 ; 0 + 3d6: d3 de rcall .-602 ; 0x17e + update_display = 0; + 3d8: 10 92 61 00 sts 0x0061, r1 ; 0x800061 <__data_start+0x1> + 3dc: 10 92 60 00 sts 0x0060, r1 ; 0x800060 <__data_start> + 3e0: 4d cf rjmp .-358 ; 0x27c -000002f2 <_exit>: - 2f2: f8 94 cli +000003e2 <_exit>: + 3e2: f8 94 cli -000002f4 <__stop_program>: - 2f4: ff cf rjmp .-2 ; 0x2f4 <__stop_program> +000003e4 <__stop_program>: + 3e4: ff cf rjmp .-2 ; 0x3e4 <__stop_program> diff --git a/Debug/AtTiny_alarm_clock.map b/Debug/AtTiny_alarm_clock.map index 538eddd..19767b1 100644 --- a/Debug/AtTiny_alarm_clock.map +++ b/Debug/AtTiny_alarm_clock.map @@ -203,7 +203,7 @@ END GROUP .rela.plt *(.rela.plt) -.text 0x00000000 0x2f6 +.text 0x00000000 0x3e6 *(.vectors) .vectors 0x00000000 0x2a C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATtiny_DFP/1.3.172/gcc/dev/attiny2313a/avr25/tiny-stack/crtattiny2313a.o 0x00000000 __vector_default @@ -302,18 +302,18 @@ END GROUP 0x0000015a 0x24 main.o 0x0000015a __vector_5 .text.lcd_write_text - 0x0000017e 0x56 main.o + 0x0000017e 0x58 main.o 0x0000017e lcd_write_text .text.button_clicked - 0x000001d4 0x6e main.o - 0x000001d4 button_clicked - .text.main 0x00000242 0xb0 main.o - 0x00000242 main - 0x000002f2 . = ALIGN (0x2) + 0x000001d6 0x6e main.o + 0x000001d6 button_clicked + .text.main 0x00000244 0x19e main.o + 0x00000244 main + 0x000003e2 . = ALIGN (0x2) *(.fini9) - .fini9 0x000002f2 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr25/tiny-stack\libgcc.a(_exit.o) - 0x000002f2 _exit - 0x000002f2 exit + .fini9 0x000003e2 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr25/tiny-stack\libgcc.a(_exit.o) + 0x000003e2 _exit + 0x000003e2 exit *(.fini9) *(.fini8) *(.fini8) @@ -332,50 +332,57 @@ END GROUP *(.fini1) *(.fini1) *(.fini0) - .fini0 0x000002f2 0x4 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr25/tiny-stack\libgcc.a(_exit.o) + .fini0 0x000003e2 0x4 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr25/tiny-stack\libgcc.a(_exit.o) *(.fini0) - 0x000002f6 _etext = . + 0x000003e6 _etext = . -.data 0x00800060 0x12 load address 0x000002f6 +.data 0x00800060 0x54 load address 0x000003e6 0x00800060 PROVIDE (__data_start, .) *(.data) *(.data*) - .data.t1 0x00800060 0x11 main.o - 0x00800060 t1 + .data.update_display + 0x00800060 0x2 main.o + 0x00800060 update_display + .data.t1 0x00800062 0x11 main.o + 0x00800062 t1 *(.gnu.linkonce.d*) *(.rodata) + .rodata 0x00800073 0x40 main.o *(.rodata*) *(.gnu.linkonce.r*) - 0x00800072 . = ALIGN (0x2) - *fill* 0x00800071 0x1 - 0x00800072 _edata = . - 0x00800072 PROVIDE (__data_end, .) + 0x008000b4 . = ALIGN (0x2) + *fill* 0x008000b3 0x1 + 0x008000b4 _edata = . + 0x008000b4 PROVIDE (__data_end, .) -.bss 0x00800072 0x6 - 0x00800072 PROVIDE (__bss_start, .) +.bss 0x008000b4 0x8 + 0x008000b4 PROVIDE (__bss_start, .) *(.bss) *(.bss*) - .bss.counter 0x00800072 0x2 main.o - 0x00800072 counter + .bss.clock_state_changed + 0x008000b4 0x2 main.o + 0x008000b4 clock_state_changed + .bss.counter 0x008000b6 0x2 main.o + 0x008000b6 counter .bss.clock_new_state - 0x00800074 0x1 main.o - 0x00800074 clock_new_state + 0x008000b8 0x1 main.o + 0x008000b8 clock_new_state .bss.clock_state - 0x00800075 0x1 main.o - 0x00800075 clock_state + 0x008000b9 0x1 main.o + 0x008000b9 clock_state *(COMMON) - COMMON 0x00800076 0x2 main.o - 0x00800076 clock_old_state - 0x00800077 flags - 0x00800078 PROVIDE (__bss_end, .) - 0x000002f6 __data_load_start = LOADADDR (.data) - 0x00000308 __data_load_end = (__data_load_start + SIZEOF (.data)) + COMMON 0x008000ba 0x2 main.o + 0x008000ba clock_old_state + 0x008000bb flags + 0x008000bc PROVIDE (__bss_end, .) + 0x000003e6 __data_load_start = LOADADDR (.data) + 0x0000043a __data_load_end = (__data_load_start + SIZEOF (.data)) -.noinit 0x00800078 0x0 +.noinit 0x008000bc 0x0 [!provide] PROVIDE (__noinit_start, .) *(.noinit*) [!provide] PROVIDE (__noinit_end, .) - 0x00800078 _end = . + 0x008000bc _end = . [!provide] PROVIDE (__heap_start, .) .eeprom 0x00810000 0x0 @@ -454,48 +461,48 @@ END GROUP .debug_pubnames *(.debug_pubnames) -.debug_info 0x00000000 0xb59 +.debug_info 0x00000000 0xc54 *(.debug_info .gnu.linkonce.wi.*) .debug_info 0x00000000 0x456 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATtiny_DFP/1.3.172/gcc/dev/attiny2313a/avr25/tiny-stack/crtattiny2313a.o .debug_info 0x00000456 0x31d lcd4.o .debug_info 0x00000773 0xa3 lcd_wait.o - .debug_info 0x00000816 0x343 main.o + .debug_info 0x00000816 0x43e main.o -.debug_abbrev 0x00000000 0x738 +.debug_abbrev 0x00000000 0x73a *(.debug_abbrev) .debug_abbrev 0x00000000 0x41b C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATtiny_DFP/1.3.172/gcc/dev/attiny2313a/avr25/tiny-stack/crtattiny2313a.o .debug_abbrev 0x0000041b 0xfe lcd4.o .debug_abbrev 0x00000519 0x72 lcd_wait.o - .debug_abbrev 0x0000058b 0x1ad main.o + .debug_abbrev 0x0000058b 0x1af main.o -.debug_line 0x00000000 0x61f +.debug_line 0x00000000 0x689 *(.debug_line .debug_line.* .debug_line_end) .debug_line 0x00000000 0x10c C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATtiny_DFP/1.3.172/gcc/dev/attiny2313a/avr25/tiny-stack/crtattiny2313a.o .debug_line 0x0000010c 0x291 lcd4.o .debug_line 0x0000039d 0xbd lcd_wait.o - .debug_line 0x0000045a 0x1c5 main.o + .debug_line 0x0000045a 0x22f main.o -.debug_frame 0x00000000 0x154 +.debug_frame 0x00000000 0x164 *(.debug_frame) .debug_frame 0x00000000 0x9c lcd4.o .debug_frame 0x0000009c 0x34 lcd_wait.o - .debug_frame 0x000000d0 0x84 main.o + .debug_frame 0x000000d0 0x94 main.o -.debug_str 0x00000000 0x470 +.debug_str 0x00000000 0x493 *(.debug_str) .debug_str 0x00000000 0x17b C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATtiny_DFP/1.3.172/gcc/dev/attiny2313a/avr25/tiny-stack/crtattiny2313a.o .debug_str 0x0000017b 0x1c0 lcd4.o 0x1fd (size before relaxing) .debug_str 0x0000033b 0x10 lcd_wait.o 0x166 (size before relaxing) - .debug_str 0x0000034b 0x125 main.o - 0x2d3 (size before relaxing) + .debug_str 0x0000034b 0x148 main.o + 0x2fe (size before relaxing) -.debug_loc 0x00000000 0x428 +.debug_loc 0x00000000 0x470 *(.debug_loc) .debug_loc 0x00000000 0x244 lcd4.o .debug_loc 0x00000244 0x48 lcd_wait.o - .debug_loc 0x0000028c 0x19c main.o + .debug_loc 0x0000028c 0x1e4 main.o .debug_macinfo *(.debug_macinfo) diff --git a/Debug/AtTiny_alarm_clock.srec b/Debug/AtTiny_alarm_clock.srec index 5211b36..fc47c9a 100644 --- a/Debug/AtTiny_alarm_clock.srec +++ b/Debug/AtTiny_alarm_clock.srec @@ -2,9 +2,9 @@ S01A0000417454696E795F616C61726D5F636C6F636B2E73726563DA S113000014C02CC02BC02AC029C0A7C027C026C03A S113001025C024C023C022C021C020C01FC01EC0D0 S11300201DC01CC01BC01AC019C011241FBECFEDB7 -S1130030CDBF10E0A0E6B0E0E6EFF2E002C005902C -S11300400D92A237B107D9F720E0A2E7B0E001C0D2 -S11300501D92A837B207E1F7F4D04BC1D1CFCF93AB +S1130030CDBF10E0A0E6B0E0E6EEF3E002C005902C +S11300400D92A43BB107D9F720E0A4EBB0E001C0C6 +S11300501D92AC3BB207E1F7F5D0C3C1D1CFCF932A S1130060C2E362D0C150E9F7CF910895CF93C62F70 S1130070843038F4823048F4882371F0813049F0B8 S11300800CC0843051F4939808C04F73833009F442 @@ -27,26 +27,45 @@ S1130180FF920F931F93CF937C01892B29F081E079 S1130190E816F10431F00AC06894EE24E1F8F12C79 S11301A005C00F2EF3E0EF2EF12CF02D042F152FA8 S11301B0C0E0F80161918F016F3519F04C2F8E2D3D -S11301C055DFCF5FC031A9F7CF911F910F91FF90F9 -S11301D0EF90089520B3BC016F5F7F4F409177008B -S11301E0E1E0F0E0DF0102C0AA0FBB1F8A95E2F74D -S11301F0CD01237030E051E02617370709F050E0B5 -S1130200242F30E028233923E1E0121613060CF0E2 -S1130210E0E05E1799F020B3237030E062177307B3 -S113022031F4842B8093770081E090E008958095E9 -S113023048234093770080E090E0089580E090E0C8 -S1130240089511BA86EE99EF9DBD8CBD1FBC85E063 -S11302508EBD80E889BF7894C2E7D0E080917400B5 -S1130260882319F0813051F0FBCF109275003DDFE7 -S113027081E036DF81E080937400F0CF81E08093E9 -S1130280750040E650E060E070E080E090E077DFE9 -S113029080E090E09FDF892B51F080917200909173 -S11302A07300019690937300809372001DC081E0E7 -S11302B090E090DF892B51F080917200909173004F -S11302C0029690937300809372000EC082E090E0D7 -S11302D081DF892B49F0809172009091730003961D -S11302E090937300809372008881805D8093600096 -S10902F0B5CFF894FFCF26 -S11302F62048616C6C6F5F5F5F5F5F5F5F5F5F5F2E -S10503065F0092 +S11301C055DF4DDFCF5FC031A1F7CF911F910F9164 +S11301D0FF90EF90089520B3BC016F5F7F4F409173 +S11301E0BB00E1E0F0E0DF0102C0AA0FBB1F8A956B +S11301F0E2F7CD01237030E051E02617370709F00C +S113020050E0242F30E028233923E1E012161306AE +S11302100CF0E0E05E1799F020B3237030E0621731 +S1130220730731F4842B8093BB0081E090E0089540 +S1130230809548234093BB0080E090E0089580E0DF +S113024090E00895CF93DF93CDB7DD27C054CDBFA1 +S113025011BA86EE99EF9DBD8CBD1FBC85E08EBDA5 +S113026080E889BF78940F2EF2E6EF2EF0E0FF2E9F +S1130270F02D06EB10E06894DD24D1F89091B900DC +S11302808091B800981799F08093B90021E030E08C +S11302903093B5002093B400309361002093600044 +S11302A08130F1F078F0823009F46DC0E7CF10921C +S11302B0B5001092B400913069F020F0923009F446 +S11302C062C0DCCF12DFCBDE81E00ADF81E0809305 +S11302D0B800D4CF8091600090916100892B41F1E6 +S11302E0BEDE80E1E3E7F0E0DE01D19601900D92FD +S11302F08A95E1F7AE014F5C5F4F60E070E080E00B +S113030090E03DDFACDE80E1E3E8F0E0DE019196D1 +S113031001900D928A95E1F7AE014F5D5F4F60E069 +S113032070E081E090E02BDF109261001092600099 +S113033080E090E050DF892B19F0D092B8001DC006 +S113034081E090E048DF892B51F08091B6009091D4 +S1130350B70002969093B7008093B6000EC082E077 +S113036090E039DF892B49F08091B6009091B70075 +S113037003969093B7008093B600F8018081805D66 +S1130380F70180837BCF8091600090916100892B7D +S113039009F474CF80E1E3E9F0E0DE0151960190C5 +S11303A00D928A95E1F7AE014F5E5F4F60E070E019 +S11303B080E090E0E4DE80E1E3EAF0E0DE01119623 +S11303C001900D928A95E1F7AE014F5F5F4F60E0B7 +S11303D070E081E090E0D3DE109261001092600042 +S10903E04DCFF894FFCF9D +S11303E601002048616C6C6F5F5F5F5F5F5F5F5FFA +S11303F65F5F5F5F5F5F5F5F5F74696D655F5F5FD0 +S11304065F5F5F20202020202074696D65202020F6 +S113041620202020205B616C61726D2074696D65FB +S11304265D20202020202020616C61726D203E20FA +S1070436202020005E S9030000FC diff --git a/Debug/main.o b/Debug/main.o index 215ffe3..b370dae 100644 Binary files a/Debug/main.o and b/Debug/main.o differ diff --git a/main.c b/main.c index 88f41a2..cff6adf 100644 --- a/main.c +++ b/main.c @@ -25,6 +25,9 @@ int counter = 0; uint8_t flags; +int clock_state_changed = 0; +int update_display = 1; + ISR (TIMER1_OVF_vect) // Timer1 ISR { //counter++; @@ -41,32 +44,46 @@ int main(void) TCCR1B = (1< change to IDLE clock_new_state = CLOCK_IDLE; - + break; case CLOCK_IDLE: //IDLE MODE //print the IDLE Screen - - lcd_write_text(0,0,t1); - + + if(update_display){ + lcd_5ms(); + lcd_write_text(0,0,(uint8_t []){'_','_','_','_','_','_','t','i','m','e','_','_','_','_','_','_'}); + lcd_5ms(); + lcd_write_text(1,0,(uint8_t []){' ',' ',' ',' ',' ',' ','t','i','m','e',' ',' ',' ',' ',' ',' '}); + update_display = 0; + } if(button_clicked(butt1)){ - counter++; + clock_new_state = CLOCK_ALARM; } else if(button_clicked(butt2)){ counter += 2; @@ -79,11 +96,21 @@ int main(void) t1[0] = counter + 48; break; + + case CLOCK_ALARM: + //ALARM setup Mode + //print the ALARM screen + if(update_display){ + lcd_write_text(0,0,(uint8_t []){' ',' ','[','a','l','a','r','m',' ','t','i','m','e',']',' ',' '}); + lcd_write_text(1,0,(uint8_t []){' ',' ',' ',' ',' ','a','l','a','r','m',' ','>',' ',' ',' ',' '}); + update_display = 0; + } + break; } } } -void lcd_write_text(int row, int col, uint8_t text[16]) +void lcd_write_text(int row, int col, uint8_t text[]) { switch(row){ case 0: @@ -97,6 +124,7 @@ void lcd_write_text(int row, int col, uint8_t text[16]) if(text[i] != 0x5F){ lcd_write(row, text[i], 0+i); } + lcd_5ms(); } } @@ -107,12 +135,12 @@ int button_clicked(int button) //check is the button has been pressed or released if((PIND & 0x03) == button+1){ //button is high -> pressed - flags |= (1< released - flags &= ~(1<