diff --git a/.vs/AtTiny_alarm_clock/v14/.atsuo b/.vs/AtTiny_alarm_clock/v14/.atsuo index e9a8840..0a07bc9 100644 Binary files a/.vs/AtTiny_alarm_clock/v14/.atsuo and b/.vs/AtTiny_alarm_clock/v14/.atsuo differ diff --git a/AtTiny_alarm_clock.cproj b/AtTiny_alarm_clock.cproj index 36a6b40..522f974 100644 --- a/AtTiny_alarm_clock.cproj +++ b/AtTiny_alarm_clock.cproj @@ -40,6 +40,22 @@ + com.atmel.avrdbg.tool.jtagicemkii + 070000004698 + 0x1E910A + + + + 125000 + + ISP + + com.atmel.avrdbg.tool.jtagicemkii + 070000004698 + JTAGICE mkII + + ISP + 125000 diff --git a/Debug/AtTiny_alarm_clock.elf b/Debug/AtTiny_alarm_clock.elf index fda6dce..6ab2d39 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 e5da285..fe26490 100644 --- a/Debug/AtTiny_alarm_clock.hex +++ b/Debug/AtTiny_alarm_clock.hex @@ -1,22 +1,39 @@ -:1000000014C019C018C017C016C015C014C013C042 -:1000100012C011C010C00FC00EC00DC00CC00BC06C -:100020000AC009C008C007C006C011241FBECFED1A -:10003000CDBF80D089C0E4CFCF93C2E362D0C1509E -:10004000E9F7CF910895CF93C62F843038F48230EA -:1000500048F4882371F0813049F00CC0843051F4A9 -:10006000939808C04F73833009F4405C842F8068F4 -:1000700024D0939A929A929A98B39F708C2F807FF3 -:10008000982B98BB98B39F70892B88BB92989298B5 -:1000900038D087B3803F79F4929A929A88B3C29508 -:1000A000C07F8F708C2B88BB88B38F70C82BC8BB68 -:1000B0009298929826D0CF91089540E0682F84E0DE -:1000C000C2DF08958FEF87BB8B9A8A9A88BB939A79 -:1000D000929AB2DFB1DFB0DF80E3EFDFADDF80E324 -:1000E000ECDF0FD080E3E9DF88E2E7DF87B3807FD2 -:1000F00087BB8CE0E2DF86E0E0DF82E0DEDF9CDFD2 -:100100000895CF93DF931F92CDB7DD2784E48983D1 -:1001100089819FEF980F9983882341F08981898194 -:1001200089819FEF980F99838111F8CF0F90DF910C -:10013000CF9108958FEF87BB8AEA88BBC3DF40E089 -:0C01400061E480E080DFFFCFF894FFCF87 +:1000000014C02CC02BC02AC029C028C027C026C0BD +:1000100025C024C023C022C021C020C01FC01EC0D4 +:100020001DC01CC01BC01AC019C011241FBECFEDBB +:10003000CDBF10E0A0E6B0E0EEE3F2E002C0059034 +:100040000D92A237B107D9F720E0A2E7B0E001C0D6 +:100050001D92A837B207E1F7AED0EFC0D1CFCF9352 +:10006000C2E362D0C150E9F7CF910895CF93C62F74 +:10007000843038F4823048F4882371F0813049F0BC +:100080000CC0843051F4939808C04F73833009F446 +:10009000405C842F806824D0939A929A929A98B365 +:1000A0009F708C2F807F982B98BB98B39F70892B63 +:1000B00088BB9298929838D087B3803F79F4929A0F +:1000C000929A88B3C295C07F8F708C2B88BB88B3FF +:1000D0008F70C82BC8BB9298929826D0CF91089564 +:1000E00040E0682F84E0C2DF08958FEF87BB8B9AD2 +:1000F0008A9A88BB939A929AB2DFB1DFB0DF80E32D +:10010000EFDFADDF80E3ECDF0FD080E3E9DF88E2F3 +:10011000E7DF87B3807F87BB8CE0E2DF86E0E0DF4C +:1001200082E0DEDF9CDF0895CF93DF931F92CDB78F +:10013000DD2784E4898389819FEF980F9983882341 +:1001400041F08981898189819FEF980F998381117D +:10015000F8CF0F90DF91CF910895EF92FF920F9318 +:100160001F93CF937C01892B29F081E0E816F104DD +:1001700031F00AC06894EE24E1F8F12C05C00F2E8E +:10018000F3E0EF2EF12CF02DFA0160816F3569F06C +:100190008A010F5F1F4FC0E04C2F8E2D67DFF801E3 +:1001A00061918F01CF5F6F35B9F7CF911F910F919B +:1001B000FF90EF90089511BAC2E7D0E080917400EB +:1001C000882319F0813051F0FBCF109275008DDF3C +:1001D00081E086DF81E080937400F0CF81E080933E +:1001E000750040E650E060E070E080E090E0B5DF50 +:1001F00090B380917700937021E0933009F020E074 +:10020000982F91702917A1F090B39370933069F4EF +:1002100081608093770080917200909173000196C5 +:10022000909373008093720003C08E7F8093770059 +:0E0230008881805D80936000C1CFF894FFCF7D +:10023E002048616C6C6F5F5F5F5F5F5F5F5F5F5FEA +:02024E005F004F :00000001FF diff --git a/Debug/AtTiny_alarm_clock.lss b/Debug/AtTiny_alarm_clock.lss index af6adef..0012e6f 100644 --- a/Debug/AtTiny_alarm_clock.lss +++ b/Debug/AtTiny_alarm_clock.lss @@ -3,324 +3,512 @@ AtTiny_alarm_clock.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 0000014c 00000000 00000000 00000054 2**1 + 0 .text 0000023e 00000000 00000000 00000094 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .data 00000000 00800060 00800060 000001a0 2**0 + 1 .data 00000012 00800060 0000023e 000002d2 2**0 CONTENTS, ALLOC, LOAD, DATA - 2 .comment 00000030 00000000 00000000 000001a0 2**0 + 2 .bss 00000006 00800072 00800072 000002e4 2**0 + ALLOC + 3 .comment 00000030 00000000 00000000 000002e4 2**0 CONTENTS, READONLY - 3 .note.gnu.avr.deviceinfo 00000040 00000000 00000000 000001d0 2**2 + 4 .note.gnu.avr.deviceinfo 00000040 00000000 00000000 00000314 2**2 CONTENTS, READONLY - 4 .debug_aranges 00000088 00000000 00000000 00000210 2**0 + 5 .debug_aranges 00000090 00000000 00000000 00000354 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_info 00000915 00000000 00000000 00000298 2**0 + 6 .debug_info 00000a9b 00000000 00000000 000003e4 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_abbrev 00000631 00000000 00000000 00000bad 2**0 + 7 .debug_abbrev 000006f0 00000000 00000000 00000e7f 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_line 00000517 00000000 00000000 000011de 2**0 + 8 .debug_line 0000059a 00000000 00000000 0000156f 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_frame 000000f4 00000000 00000000 000016f8 2**2 + 9 .debug_frame 00000120 00000000 00000000 00001b0c 2**2 CONTENTS, READONLY, DEBUGGING - 9 .debug_str 0000035c 00000000 00000000 000017ec 2**0 + 10 .debug_str 00000446 00000000 00000000 00001c2c 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_loc 0000028c 00000000 00000000 00001b48 2**0 + 11 .debug_loc 000003bb 00000000 00000000 00002072 2**0 CONTENTS, READONLY, DEBUGGING - 11 .debug_ranges 00000058 00000000 00000000 00001dd4 2**0 + 12 .debug_ranges 00000078 00000000 00000000 0000242d 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: 00000000 <__vectors>: 0: 14 c0 rjmp .+40 ; 0x2a <__ctors_end> - 2: 19 c0 rjmp .+50 ; 0x36 <__bad_interrupt> - 4: 18 c0 rjmp .+48 ; 0x36 <__bad_interrupt> - 6: 17 c0 rjmp .+46 ; 0x36 <__bad_interrupt> - 8: 16 c0 rjmp .+44 ; 0x36 <__bad_interrupt> - a: 15 c0 rjmp .+42 ; 0x36 <__bad_interrupt> - c: 14 c0 rjmp .+40 ; 0x36 <__bad_interrupt> - e: 13 c0 rjmp .+38 ; 0x36 <__bad_interrupt> - 10: 12 c0 rjmp .+36 ; 0x36 <__bad_interrupt> - 12: 11 c0 rjmp .+34 ; 0x36 <__bad_interrupt> - 14: 10 c0 rjmp .+32 ; 0x36 <__bad_interrupt> - 16: 0f c0 rjmp .+30 ; 0x36 <__bad_interrupt> - 18: 0e c0 rjmp .+28 ; 0x36 <__bad_interrupt> - 1a: 0d c0 rjmp .+26 ; 0x36 <__bad_interrupt> - 1c: 0c c0 rjmp .+24 ; 0x36 <__bad_interrupt> - 1e: 0b c0 rjmp .+22 ; 0x36 <__bad_interrupt> - 20: 0a c0 rjmp .+20 ; 0x36 <__bad_interrupt> - 22: 09 c0 rjmp .+18 ; 0x36 <__bad_interrupt> - 24: 08 c0 rjmp .+16 ; 0x36 <__bad_interrupt> - 26: 07 c0 rjmp .+14 ; 0x36 <__bad_interrupt> - 28: 06 c0 rjmp .+12 ; 0x36 <__bad_interrupt> + 2: 2c c0 rjmp .+88 ; 0x5c <__bad_interrupt> + 4: 2b c0 rjmp .+86 ; 0x5c <__bad_interrupt> + 6: 2a c0 rjmp .+84 ; 0x5c <__bad_interrupt> + 8: 29 c0 rjmp .+82 ; 0x5c <__bad_interrupt> + a: 28 c0 rjmp .+80 ; 0x5c <__bad_interrupt> + c: 27 c0 rjmp .+78 ; 0x5c <__bad_interrupt> + e: 26 c0 rjmp .+76 ; 0x5c <__bad_interrupt> + 10: 25 c0 rjmp .+74 ; 0x5c <__bad_interrupt> + 12: 24 c0 rjmp .+72 ; 0x5c <__bad_interrupt> + 14: 23 c0 rjmp .+70 ; 0x5c <__bad_interrupt> + 16: 22 c0 rjmp .+68 ; 0x5c <__bad_interrupt> + 18: 21 c0 rjmp .+66 ; 0x5c <__bad_interrupt> + 1a: 20 c0 rjmp .+64 ; 0x5c <__bad_interrupt> + 1c: 1f c0 rjmp .+62 ; 0x5c <__bad_interrupt> + 1e: 1e c0 rjmp .+60 ; 0x5c <__bad_interrupt> + 20: 1d c0 rjmp .+58 ; 0x5c <__bad_interrupt> + 22: 1c c0 rjmp .+56 ; 0x5c <__bad_interrupt> + 24: 1b c0 rjmp .+54 ; 0x5c <__bad_interrupt> + 26: 1a c0 rjmp .+52 ; 0x5c <__bad_interrupt> + 28: 19 c0 rjmp .+50 ; 0x5c <__bad_interrupt> 0000002a <__ctors_end>: 2a: 11 24 eor r1, r1 2c: 1f be out 0x3f, r1 ; 63 2e: cf ed ldi r28, 0xDF ; 223 30: cd bf out 0x3d, r28 ; 61 - 32: 80 d0 rcall .+256 ; 0x134
- 34: 89 c0 rjmp .+274 ; 0x148 <_exit> -00000036 <__bad_interrupt>: - 36: e4 cf rjmp .-56 ; 0x0 <__vectors> +00000032 <__do_copy_data>: + 32: 10 e0 ldi r17, 0x00 ; 0 + 34: a0 e6 ldi r26, 0x60 ; 96 + 36: b0 e0 ldi r27, 0x00 ; 0 + 38: ee e3 ldi r30, 0x3E ; 62 + 3a: f2 e0 ldi r31, 0x02 ; 2 + 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 + 44: b1 07 cpc r27, r17 + 46: d9 f7 brne .-10 ; 0x3e <__SP_L__+0x1> -00000038 : +00000048 <__do_clear_bss>: + 48: 20 e0 ldi r18, 0x00 ; 0 + 4a: a2 e7 ldi r26, 0x72 ; 114 + 4c: b0 e0 ldi r27, 0x00 ; 0 + 4e: 01 c0 rjmp .+2 ; 0x52 <.do_clear_bss_start> + +00000050 <.do_clear_bss_loop>: + 50: 1d 92 st X+, r1 + +00000052 <.do_clear_bss_start>: + 52: a8 37 cpi r26, 0x78 ; 120 + 54: b2 07 cpc r27, r18 + 56: e1 f7 brne .-8 ; 0x50 <.do_clear_bss_loop> + 58: ae d0 rcall .+348 ; 0x1b6
+ 5a: ef c0 rjmp .+478 ; 0x23a <_exit> + +0000005c <__bad_interrupt>: + 5c: d1 cf rjmp .-94 ; 0x0 <__vectors> + +0000005e : void lcd_1s(void){ for(uint8_t i=200;i>0;i--){ lcd_5ms(); } } - 38: cf 93 push r28 - 3a: c2 e3 ldi r28, 0x32 ; 50 - 3c: 62 d0 rcall .+196 ; 0x102 - 3e: c1 50 subi r28, 0x01 ; 1 - 40: e9 f7 brne .-6 ; 0x3c - 42: cf 91 pop r28 - 44: 08 95 ret + 5e: cf 93 push r28 + 60: c2 e3 ldi r28, 0x32 ; 50 + 62: 62 d0 rcall .+196 ; 0x128 + 64: c1 50 subi r28, 0x01 ; 1 + 66: e9 f7 brne .-6 ; 0x62 + 68: cf 91 pop r28 + 6a: 08 95 ret -00000046 : +0000006c : void lcd_instruct(uint8_t zeichen){ lcd_write(instruct,zeichen,0); } void lcd_write(uint8_t lcd_whichwrite, uint8_t zeichen, uint8_t position){ - 46: cf 93 push r28 - 48: c6 2f mov r28, r22 + 6c: cf 93 push r28 + 6e: c6 2f mov r28, r22 switch (lcd_whichwrite){ - 4a: 84 30 cpi r24, 0x04 ; 4 - 4c: 38 f4 brcc .+14 ; 0x5c - 4e: 82 30 cpi r24, 0x02 ; 2 - 50: 48 f4 brcc .+18 ; 0x64 - 52: 88 23 and r24, r24 - 54: 71 f0 breq .+28 ; 0x72 - 56: 81 30 cpi r24, 0x01 ; 1 - 58: 49 f0 breq .+18 ; 0x6c - 5a: 0c c0 rjmp .+24 ; 0x74 - 5c: 84 30 cpi r24, 0x04 ; 4 - 5e: 51 f4 brne .+20 ; 0x74 + 70: 84 30 cpi r24, 0x04 ; 4 + 72: 38 f4 brcc .+14 ; 0x82 + 74: 82 30 cpi r24, 0x02 ; 2 + 76: 48 f4 brcc .+18 ; 0x8a + 78: 88 23 and r24, r24 + 7a: 71 f0 breq .+28 ; 0x98 + 7c: 81 30 cpi r24, 0x01 ; 1 + 7e: 49 f0 breq .+18 ; 0x92 + 80: 0c c0 rjmp .+24 ; 0x9a + 82: 84 30 cpi r24, 0x04 ; 4 + 84: 51 f4 brne .+20 ; 0x9a case instruct : unset_lcd_RS; - 60: 93 98 cbi 0x12, 3 ; 18 + 86: 93 98 cbi 0x12, 3 ; 18 break; - 62: 08 c0 rjmp .+16 ; 0x74 + 88: 08 c0 rjmp .+16 ; 0x9a case line2: case line1: position = position & 0x3f; - 64: 4f 73 andi r20, 0x3F ; 63 + 8a: 4f 73 andi r20, 0x3F ; 63 if (lcd_whichwrite == line2){ position=position + 0x40; }; - 66: 83 30 cpi r24, 0x03 ; 3 - 68: 09 f4 brne .+2 ; 0x6c - 6a: 40 5c subi r20, 0xC0 ; 192 + 8c: 83 30 cpi r24, 0x03 ; 3 + 8e: 09 f4 brne .+2 ; 0x92 + 90: 40 5c subi r20, 0xC0 ; 192 case therepos: lcd_instruct(lcd_mask_Write_Adress(position)); - 6c: 84 2f mov r24, r20 - 6e: 80 68 ori r24, 0x80 ; 128 - 70: 24 d0 rcall .+72 ; 0xba + 92: 84 2f mov r24, r20 + 94: 80 68 ori r24, 0x80 ; 128 + 96: 24 d0 rcall .+72 ; 0xe0 case here: set_lcd_RS; - 72: 93 9a sbi 0x12, 3 ; 18 + 98: 93 9a sbi 0x12, 3 ; 18 break; } set_lcd_E; - 74: 92 9a sbi 0x12, 2 ; 18 + 9a: 92 9a sbi 0x12, 2 ; 18 set_lcd_E; - 76: 92 9a sbi 0x12, 2 ; 18 + 9c: 92 9a sbi 0x12, 2 ; 18 lcd_dataport=lcd_dataport&~lcd_dataport_mask|zeichen&lcd_dataport_mask; - 78: 98 b3 in r25, 0x18 ; 24 - 7a: 9f 70 andi r25, 0x0F ; 15 - 7c: 8c 2f mov r24, r28 - 7e: 80 7f andi r24, 0xF0 ; 240 - 80: 98 2b or r25, r24 - 82: 98 bb out 0x18, r25 ; 24 + 9e: 98 b3 in r25, 0x18 ; 24 + a0: 9f 70 andi r25, 0x0F ; 15 + a2: 8c 2f mov r24, r28 + a4: 80 7f andi r24, 0xF0 ; 240 + a6: 98 2b or r25, r24 + a8: 98 bb out 0x18, r25 ; 24 lcd_dataport=lcd_dataport&~lcd_dataport_mask|zeichen&lcd_dataport_mask; - 84: 98 b3 in r25, 0x18 ; 24 - 86: 9f 70 andi r25, 0x0F ; 15 - 88: 89 2b or r24, r25 - 8a: 88 bb out 0x18, r24 ; 24 + aa: 98 b3 in r25, 0x18 ; 24 + ac: 9f 70 andi r25, 0x0F ; 15 + ae: 89 2b or r24, r25 + b0: 88 bb out 0x18, r24 ; 24 unset_lcd_E; - 8c: 92 98 cbi 0x12, 2 ; 18 + b2: 92 98 cbi 0x12, 2 ; 18 unset_lcd_E; - 8e: 92 98 cbi 0x12, 2 ; 18 + b4: 92 98 cbi 0x12, 2 ; 18 wait_100us(); - 90: 38 d0 rcall .+112 ; 0x102 + b6: 38 d0 rcall .+112 ; 0x128 if (lcd_dataport_DDR==0xf0){ - 92: 87 b3 in r24, 0x17 ; 23 - 94: 80 3f cpi r24, 0xF0 ; 240 - 96: 79 f4 brne .+30 ; 0xb6 + b8: 87 b3 in r24, 0x17 ; 23 + ba: 80 3f cpi r24, 0xF0 ; 240 + bc: 79 f4 brne .+30 ; 0xdc zeichen=zeichen << 4; set_lcd_E; - 98: 92 9a sbi 0x12, 2 ; 18 + be: 92 9a sbi 0x12, 2 ; 18 set_lcd_E; - 9a: 92 9a sbi 0x12, 2 ; 18 + c0: 92 9a sbi 0x12, 2 ; 18 lcd_dataport=lcd_dataport&~lcd_dataport_mask|zeichen&lcd_dataport_mask; - 9c: 88 b3 in r24, 0x18 ; 24 - 9e: c2 95 swap r28 - a0: c0 7f andi r28, 0xF0 ; 240 - a2: 8f 70 andi r24, 0x0F ; 15 - a4: 8c 2b or r24, r28 - a6: 88 bb out 0x18, r24 ; 24 + c2: 88 b3 in r24, 0x18 ; 24 + c4: c2 95 swap r28 + c6: c0 7f andi r28, 0xF0 ; 240 + c8: 8f 70 andi r24, 0x0F ; 15 + ca: 8c 2b or r24, r28 + cc: 88 bb out 0x18, r24 ; 24 lcd_dataport=lcd_dataport&~lcd_dataport_mask|zeichen&lcd_dataport_mask; - a8: 88 b3 in r24, 0x18 ; 24 - aa: 8f 70 andi r24, 0x0F ; 15 - ac: c8 2b or r28, r24 - ae: c8 bb out 0x18, r28 ; 24 + ce: 88 b3 in r24, 0x18 ; 24 + d0: 8f 70 andi r24, 0x0F ; 15 + d2: c8 2b or r28, r24 + d4: c8 bb out 0x18, r28 ; 24 unset_lcd_E; - b0: 92 98 cbi 0x12, 2 ; 18 + d6: 92 98 cbi 0x12, 2 ; 18 unset_lcd_E; - b2: 92 98 cbi 0x12, 2 ; 18 + d8: 92 98 cbi 0x12, 2 ; 18 wait_100us(); - b4: 26 d0 rcall .+76 ; 0x102 + da: 26 d0 rcall .+76 ; 0x128 } } - b6: cf 91 pop r28 - b8: 08 95 ret + dc: cf 91 pop r28 + de: 08 95 ret -000000ba : +000000e0 : lcd_5ms(); } } void lcd_instruct(uint8_t zeichen){ lcd_write(instruct,zeichen,0); - ba: 40 e0 ldi r20, 0x00 ; 0 - bc: 68 2f mov r22, r24 - be: 84 e0 ldi r24, 0x04 ; 4 - c0: c2 df rcall .-124 ; 0x46 - c2: 08 95 ret + e0: 40 e0 ldi r20, 0x00 ; 0 + e2: 68 2f mov r22, r24 + e4: 84 e0 ldi r24, 0x04 ; 4 + e6: c2 df rcall .-124 ; 0x6c + e8: 08 95 ret -000000c4 : +000000ea : void lcd_init(void){ /* setting up ports first */ lcd_dataport_DDR=0xff; - c4: 8f ef ldi r24, 0xFF ; 255 - c6: 87 bb out 0x17, r24 ; 23 + ea: 8f ef ldi r24, 0xFF ; 255 + ec: 87 bb out 0x17, r24 ; 23 set_lcd_RS_DDR; - c8: 8b 9a sbi 0x11, 3 ; 17 + ee: 8b 9a sbi 0x11, 3 ; 17 set_lcd_E_DDR; - ca: 8a 9a sbi 0x11, 2 ; 17 + f0: 8a 9a sbi 0x11, 2 ; 17 /* end setting up ports */ lcd_dataport=0xff; - cc: 88 bb out 0x18, r24 ; 24 + f2: 88 bb out 0x18, r24 ; 24 set_lcd_RS; - ce: 93 9a sbi 0x12, 3 ; 18 + f4: 93 9a sbi 0x12, 3 ; 18 set_lcd_E; - d0: 92 9a sbi 0x12, 2 ; 18 + f6: 92 9a sbi 0x12, 2 ; 18 lcd_5ms(); - d2: b2 df rcall .-156 ; 0x38 + f8: b2 df rcall .-156 ; 0x5e lcd_5ms(); - d4: b1 df rcall .-158 ; 0x38 + fa: b1 df rcall .-158 ; 0x5e lcd_5ms(); - d6: b0 df rcall .-160 ; 0x38 + fc: b0 df rcall .-160 ; 0x5e lcd_instruct(lcd_SET_FUNCTION_8BIT); - d8: 80 e3 ldi r24, 0x30 ; 48 - da: ef df rcall .-34 ; 0xba + fe: 80 e3 ldi r24, 0x30 ; 48 + 100: ef df rcall .-34 ; 0xe0 lcd_5ms(); - dc: ad df rcall .-166 ; 0x38 + 102: ad df rcall .-166 ; 0x5e lcd_instruct(lcd_SET_FUNCTION_8BIT); - de: 80 e3 ldi r24, 0x30 ; 48 - e0: ec df rcall .-40 ; 0xba + 104: 80 e3 ldi r24, 0x30 ; 48 + 106: ec df rcall .-40 ; 0xe0 wait_100us(); - e2: 0f d0 rcall .+30 ; 0x102 + 108: 0f d0 rcall .+30 ; 0x128 lcd_instruct(lcd_SET_FUNCTION_8BIT); - e4: 80 e3 ldi r24, 0x30 ; 48 - e6: e9 df rcall .-46 ; 0xba + 10a: 80 e3 ldi r24, 0x30 ; 48 + 10c: e9 df rcall .-46 ; 0xe0 if (lcd_dataport_mask==0xf0){ lcd_instruct(lcd_SET_FUNCTION_4BIT|lcd_SET_FUNCTION_2LINE|lcd_SET_FUNCTION_7X5); - e8: 88 e2 ldi r24, 0x28 ; 40 - ea: e7 df rcall .-50 ; 0xba + 10e: 88 e2 ldi r24, 0x28 ; 40 + 110: e7 df rcall .-50 ; 0xe0 }else{ lcd_instruct(lcd_SET_FUNCTION_8BIT|lcd_SET_FUNCTION_2LINE|lcd_SET_FUNCTION_7X5); } lcd_dataport_DDR&=lcd_dataport_mask; - ec: 87 b3 in r24, 0x17 ; 23 - ee: 80 7f andi r24, 0xF0 ; 240 - f0: 87 bb out 0x17, r24 ; 23 + 112: 87 b3 in r24, 0x17 ; 23 + 114: 80 7f andi r24, 0xF0 ; 240 + 116: 87 bb out 0x17, r24 ; 23 lcd_instruct(lcd_DISPLAY_OO_ON|lcd_DISPLAY_OO_CURSOR_OFF); - f2: 8c e0 ldi r24, 0x0C ; 12 - f4: e2 df rcall .-60 ; 0xba + 118: 8c e0 ldi r24, 0x0C ; 12 + 11a: e2 df rcall .-60 ; 0xe0 lcd_instruct(lcd_ENTRY_MODE_SET|lcd_ENTRY_MODE_SET_INCREASE | lcd_ENTRY_MS_DISPLAY_NOT_S); - f6: 86 e0 ldi r24, 0x06 ; 6 - f8: e0 df rcall .-64 ; 0xba + 11c: 86 e0 ldi r24, 0x06 ; 6 + 11e: e0 df rcall .-64 ; 0xe0 lcd_instruct(lcd_RETURN_HOME); - fa: 82 e0 ldi r24, 0x02 ; 2 - fc: de df rcall .-68 ; 0xba + 120: 82 e0 ldi r24, 0x02 ; 2 + 122: de df rcall .-68 ; 0xe0 lcd_5ms(); - fe: 9c df rcall .-200 ; 0x38 - 100: 08 95 ret + 124: 9c df rcall .-200 ; 0x5e + 126: 08 95 ret -00000102 : +00000128 : #include #include #include "lcd4.h" void wait_100us(void){ - 102: cf 93 push r28 - 104: df 93 push r29 - 106: 1f 92 push r1 - 108: cd b7 in r28, 0x3d ; 61 - 10a: dd 27 eor r29, r29 + 128: cf 93 push r28 + 12a: df 93 push r29 + 12c: 1f 92 push r1 + 12e: cd b7 in r28, 0x3d ; 61 + 130: dd 27 eor r29, r29 for (volatile uint8_t i=68;i--;i>0){ - 10c: 84 e4 ldi r24, 0x44 ; 68 - 10e: 89 83 std Y+1, r24 ; 0x01 - 110: 89 81 ldd r24, Y+1 ; 0x01 - 112: 9f ef ldi r25, 0xFF ; 255 - 114: 98 0f add r25, r24 - 116: 99 83 std Y+1, r25 ; 0x01 - 118: 88 23 and r24, r24 - 11a: 41 f0 breq .+16 ; 0x12c + 132: 84 e4 ldi r24, 0x44 ; 68 + 134: 89 83 std Y+1, r24 ; 0x01 + 136: 89 81 ldd r24, Y+1 ; 0x01 + 138: 9f ef ldi r25, 0xFF ; 255 + 13a: 98 0f add r25, r24 + 13c: 99 83 std Y+1, r25 ; 0x01 + 13e: 88 23 and r24, r24 + 140: 41 f0 breq .+16 ; 0x152 i; - 11c: 89 81 ldd r24, Y+1 ; 0x01 + 142: 89 81 ldd r24, Y+1 ; 0x01 #include #include #include "lcd4.h" void wait_100us(void){ for (volatile uint8_t i=68;i--;i>0){ - 11e: 89 81 ldd r24, Y+1 ; 0x01 - 120: 89 81 ldd r24, Y+1 ; 0x01 - 122: 9f ef ldi r25, 0xFF ; 255 - 124: 98 0f add r25, r24 - 126: 99 83 std Y+1, r25 ; 0x01 - 128: 81 11 cpse r24, r1 - 12a: f8 cf rjmp .-16 ; 0x11c + 144: 89 81 ldd r24, Y+1 ; 0x01 + 146: 89 81 ldd r24, Y+1 ; 0x01 + 148: 9f ef ldi r25, 0xFF ; 255 + 14a: 98 0f add r25, r24 + 14c: 99 83 std Y+1, r25 ; 0x01 + 14e: 81 11 cpse r24, r1 + 150: f8 cf rjmp .-16 ; 0x142 i; } } - 12c: 0f 90 pop r0 - 12e: df 91 pop r29 - 130: cf 91 pop r28 - 132: 08 95 ret + 152: 0f 90 pop r0 + 154: df 91 pop r29 + 156: cf 91 pop r28 + 158: 08 95 ret -00000134
: -#include "lcd4.h" +0000015a : + } + } +} +void lcd_write_text(int row, int col, uint8_t text[16]) +{ + 15a: ef 92 push r14 + 15c: ff 92 push r15 + 15e: 0f 93 push r16 + 160: 1f 93 push r17 + 162: cf 93 push r28 + 164: 7c 01 movw r14, r24 + switch(row){ + 166: 89 2b or r24, r25 + 168: 29 f0 breq .+10 ; 0x174 + 16a: 81 e0 ldi r24, 0x01 ; 1 + 16c: e8 16 cp r14, r24 + 16e: f1 04 cpc r15, r1 + 170: 31 f0 breq .+12 ; 0x17e + 172: 0a c0 rjmp .+20 ; 0x188 + case 0: + row = line1; + 174: 68 94 set + 176: ee 24 eor r14, r14 + 178: e1 f8 bld r14, 1 + 17a: f1 2c mov r15, r1 + 17c: 05 c0 rjmp .+10 ; 0x188 + break; + case 1: + row = line2; + 17e: 0f 2e mov r0, r31 + 180: f3 e0 ldi r31, 0x03 ; 3 + 182: ef 2e mov r14, r31 + 184: f1 2c mov r15, r1 + 186: f0 2d mov r31, r0 + break; + } + int i=0; + while(text[i] != 0x5F){ + 188: fa 01 movw r30, r20 + 18a: 60 81 ld r22, Z + 18c: 6f 35 cpi r22, 0x5F ; 95 + 18e: 69 f0 breq .+26 ; 0x1aa + 190: 8a 01 movw r16, r20 + 192: 0f 5f subi r16, 0xFF ; 255 + 194: 1f 4f sbci r17, 0xFF ; 255 + 196: c0 e0 ldi r28, 0x00 ; 0 + lcd_write(row, text[i], 0+i); + 198: 4c 2f mov r20, r28 + 19a: 8e 2d mov r24, r14 + 19c: 67 df rcall .-306 ; 0x6c + case 1: + row = line2; + break; + } + int i=0; + while(text[i] != 0x5F){ + 19e: f8 01 movw r30, r16 + 1a0: 61 91 ld r22, Z+ + 1a2: 8f 01 movw r16, r30 + 1a4: cf 5f subi r28, 0xFF ; 255 + 1a6: 6f 35 cpi r22, 0x5F ; 95 + 1a8: b9 f7 brne .-18 ; 0x198 + lcd_write(row, text[i], 0+i); + i++; + } +} + 1aa: cf 91 pop r28 + 1ac: 1f 91 pop r17 + 1ae: 0f 91 pop r16 + 1b0: ff 90 pop r15 + 1b2: ef 90 pop r14 + 1b4: 08 95 ret + +000001b6
: + +uint8_t flags; int main(void) { - DDRB = 0xff; - 134: 8f ef ldi r24, 0xFF ; 255 - 136: 87 bb out 0x17, r24 ; 23 - PORTB = 0xAA; - 138: 8a ea ldi r24, 0xAA ; 170 - 13a: 88 bb out 0x18, r24 ; 24 - lcd_init(); - 13c: c3 df rcall .-122 ; 0xc4 - lcd_write(here, 0x41, 0); - 13e: 40 e0 ldi r20, 0x00 ; 0 - 140: 61 e4 ldi r22, 0x41 ; 65 - 142: 80 e0 ldi r24, 0x00 ; 0 - 144: 80 df rcall .-256 ; 0x46 - 146: ff cf rjmp .-2 ; 0x146 + DDRD = 0x00; + 1b6: 11 ba out 0x11, r1 ; 17 + flags &= ~(1< + switch(clock_state){ + 1c0: 88 23 and r24, r24 + 1c2: 19 f0 breq .+6 ; 0x1ca + 1c4: 81 30 cpi r24, 0x01 ; 1 + 1c6: 51 f0 breq .+20 ; 0x1dc + 1c8: fb cf rjmp .-10 ; 0x1c0 + 1ca: 10 92 75 00 sts 0x0075, r1 ; 0x800075 + case CLOCK_INIT: + //do some init stuff... + lcd_init(); //I know, it's just c but I don't care + 1ce: 8d df rcall .-230 ; 0xea + lcd_instruct(lcd_DISPLAY_CLEAR); + 1d0: 81 e0 ldi r24, 0x01 ; 1 + 1d2: 86 df rcall .-244 ; 0xe0 + //INIT done -> change to IDLE + clock_new_state = CLOCK_IDLE; + 1d4: 81 e0 ldi r24, 0x01 ; 1 + 1d6: 80 93 74 00 sts 0x0074, r24 ; 0x800074 -00000148 <_exit>: - 148: f8 94 cli + break; + 1da: f0 cf rjmp .-32 ; 0x1bc + 1dc: 81 e0 ldi r24, 0x01 ; 1 + 1de: 80 93 75 00 sts 0x0075, r24 ; 0x800075 + case CLOCK_IDLE: + //IDLE MODE -0000014a <__stop_program>: - 14a: ff cf rjmp .-2 ; 0x14a <__stop_program> + //print the IDLE Screen + + lcd_write_text(0,0,t1); + 1e2: 40 e6 ldi r20, 0x60 ; 96 + 1e4: 50 e0 ldi r21, 0x00 ; 0 + 1e6: 60 e0 ldi r22, 0x00 ; 0 + 1e8: 70 e0 ldi r23, 0x00 ; 0 + 1ea: 80 e0 ldi r24, 0x00 ; 0 + 1ec: 90 e0 ldi r25, 0x00 ; 0 + 1ee: b5 df rcall .-150 ; 0x15a + + if(((PIND & 0x03) == 3) != (flags & 1< + 1f6: 93 70 andi r25, 0x03 ; 3 + 1f8: 21 e0 ldi r18, 0x01 ; 1 + 1fa: 93 30 cpi r25, 0x03 ; 3 + 1fc: 09 f0 breq .+2 ; 0x200 + 1fe: 20 e0 ldi r18, 0x00 ; 0 + 200: 98 2f mov r25, r24 + 202: 91 70 andi r25, 0x01 ; 1 + 204: 29 17 cp r18, r25 + 206: a1 f0 breq .+40 ; 0x230 + + if((PIND & 0x03) == 3){ + 208: 90 b3 in r25, 0x10 ; 16 + 20a: 93 70 andi r25, 0x03 ; 3 + 20c: 93 30 cpi r25, 0x03 ; 3 + 20e: 69 f4 brne .+26 ; 0x22a + flags |= 1< + counter++; + 216: 80 91 72 00 lds r24, 0x0072 ; 0x800072 <__data_end> + 21a: 90 91 73 00 lds r25, 0x0073 ; 0x800073 <__data_end+0x1> + 21e: 01 96 adiw r24, 0x01 ; 1 + 220: 90 93 73 00 sts 0x0073, r25 ; 0x800073 <__data_end+0x1> + 224: 80 93 72 00 sts 0x0072, r24 ; 0x800072 <__data_end> + 228: 03 c0 rjmp .+6 ; 0x230 + } + else{ + flags &= ~(1< + } + } + + + t1[0] = counter + 48; + 230: 88 81 ld r24, Y + 232: 80 5d subi r24, 0xD0 ; 208 + 234: 80 93 60 00 sts 0x0060, r24 ; 0x800060 <__data_start> + + break; + 238: c1 cf rjmp .-126 ; 0x1bc + +0000023a <_exit>: + 23a: f8 94 cli + +0000023c <__stop_program>: + 23c: ff cf rjmp .-2 ; 0x23c <__stop_program> diff --git a/Debug/AtTiny_alarm_clock.map b/Debug/AtTiny_alarm_clock.map index ff56a98..74c3fd6 100644 --- a/Debug/AtTiny_alarm_clock.map +++ b/Debug/AtTiny_alarm_clock.map @@ -2,6 +2,16 @@ Archive member included to satisfy reference by file (symbol) c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr25/tiny-stack\libgcc.a(_exit.o) C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATtiny_DFP/1.3.172/gcc/dev/attiny2313a/avr25/tiny-stack/crtattiny2313a.o (exit) +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(_copy_data.o) + main.o (__do_copy_data) +c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr25/tiny-stack\libgcc.a(_clear_bss.o) + main.o (__do_clear_bss) + +Allocating common symbols +Common symbol size file + +clock_old_state 0x1 main.o +flags 0x1 main.o Discarded input sections @@ -35,6 +45,38 @@ Discarded input sections 0x00000000 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) .text.libgcc.fixed 0x00000000 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) + .text 0x00000000 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(_copy_data.o) + .data 0x00000000 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(_copy_data.o) + .bss 0x00000000 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(_copy_data.o) + .text.libgcc.mul + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr25/tiny-stack\libgcc.a(_copy_data.o) + .text.libgcc.div + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr25/tiny-stack\libgcc.a(_copy_data.o) + .text.libgcc 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr25/tiny-stack\libgcc.a(_copy_data.o) + .text.libgcc.prologue + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr25/tiny-stack\libgcc.a(_copy_data.o) + .text.libgcc.builtins + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr25/tiny-stack\libgcc.a(_copy_data.o) + .text.libgcc.fmul + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr25/tiny-stack\libgcc.a(_copy_data.o) + .text.libgcc.fixed + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr25/tiny-stack\libgcc.a(_copy_data.o) + .text 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr25/tiny-stack\libgcc.a(_clear_bss.o) + .data 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr25/tiny-stack\libgcc.a(_clear_bss.o) + .bss 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr25/tiny-stack\libgcc.a(_clear_bss.o) + .text.libgcc.mul + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr25/tiny-stack\libgcc.a(_clear_bss.o) + .text.libgcc.div + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr25/tiny-stack\libgcc.a(_clear_bss.o) + .text.libgcc 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr25/tiny-stack\libgcc.a(_clear_bss.o) + .text.libgcc.prologue + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr25/tiny-stack\libgcc.a(_clear_bss.o) + .text.libgcc.builtins + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr25/tiny-stack\libgcc.a(_clear_bss.o) + .text.libgcc.fmul + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr25/tiny-stack\libgcc.a(_clear_bss.o) + .text.libgcc.fixed + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr25/tiny-stack\libgcc.a(_clear_bss.o) Memory Configuration @@ -161,7 +203,7 @@ END GROUP .rela.plt *(.rela.plt) -.text 0x00000000 0x14c +.text 0x00000000 0x23e *(.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 @@ -202,6 +244,10 @@ END GROUP *(.init3) *(.init3) *(.init4) + .init4 0x00000032 0x16 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(_copy_data.o) + 0x00000032 __do_copy_data + .init4 0x00000048 0x10 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(_clear_bss.o) + 0x00000048 __do_clear_bss *(.init4) *(.init5) *(.init5) @@ -212,54 +258,57 @@ END GROUP *(.init8) *(.init8) *(.init9) - .init9 0x00000032 0x4 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATtiny_DFP/1.3.172/gcc/dev/attiny2313a/avr25/tiny-stack/crtattiny2313a.o + .init9 0x00000058 0x4 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATtiny_DFP/1.3.172/gcc/dev/attiny2313a/avr25/tiny-stack/crtattiny2313a.o *(.init9) *(.text) - .text 0x00000036 0x2 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATtiny_DFP/1.3.172/gcc/dev/attiny2313a/avr25/tiny-stack/crtattiny2313a.o - 0x00000036 __vector_1 - 0x00000036 __vector_12 - 0x00000036 __bad_interrupt - 0x00000036 __vector_6 - 0x00000036 __vector_3 - 0x00000036 __vector_11 - 0x00000036 __vector_13 - 0x00000036 __vector_17 - 0x00000036 __vector_19 - 0x00000036 __vector_7 - 0x00000036 __vector_5 - 0x00000036 __vector_4 - 0x00000036 __vector_9 - 0x00000036 __vector_2 - 0x00000036 __vector_15 - 0x00000036 __vector_8 - 0x00000036 __vector_14 - 0x00000036 __vector_10 - 0x00000036 __vector_16 - 0x00000036 __vector_18 - 0x00000036 __vector_20 - 0x00000038 . = ALIGN (0x2) + .text 0x0000005c 0x2 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATtiny_DFP/1.3.172/gcc/dev/attiny2313a/avr25/tiny-stack/crtattiny2313a.o + 0x0000005c __vector_1 + 0x0000005c __vector_12 + 0x0000005c __bad_interrupt + 0x0000005c __vector_6 + 0x0000005c __vector_3 + 0x0000005c __vector_11 + 0x0000005c __vector_13 + 0x0000005c __vector_17 + 0x0000005c __vector_19 + 0x0000005c __vector_7 + 0x0000005c __vector_5 + 0x0000005c __vector_4 + 0x0000005c __vector_9 + 0x0000005c __vector_2 + 0x0000005c __vector_15 + 0x0000005c __vector_8 + 0x0000005c __vector_14 + 0x0000005c __vector_10 + 0x0000005c __vector_16 + 0x0000005c __vector_18 + 0x0000005c __vector_20 + 0x0000005e . = ALIGN (0x2) *(.text.*) - .text.lcd_5ms 0x00000038 0xe lcd4.o - 0x00000038 lcd_5ms + .text.lcd_5ms 0x0000005e 0xe lcd4.o + 0x0000005e lcd_5ms .text.lcd_write - 0x00000046 0x74 lcd4.o - 0x00000046 lcd_write + 0x0000006c 0x74 lcd4.o + 0x0000006c lcd_write .text.lcd_instruct - 0x000000ba 0xa lcd4.o - 0x000000ba lcd_instruct + 0x000000e0 0xa lcd4.o + 0x000000e0 lcd_instruct .text.lcd_init - 0x000000c4 0x3e lcd4.o - 0x000000c4 lcd_init + 0x000000ea 0x3e lcd4.o + 0x000000ea lcd_init .text.wait_100us - 0x00000102 0x32 lcd_wait.o - 0x00000102 wait_100us - .text.main 0x00000134 0x14 main.o - 0x00000134 main - 0x00000148 . = ALIGN (0x2) + 0x00000128 0x32 lcd_wait.o + 0x00000128 wait_100us + .text.lcd_write_text + 0x0000015a 0x5c main.o + 0x0000015a lcd_write_text + .text.main 0x000001b6 0x84 main.o + 0x000001b6 main + 0x0000023a . = ALIGN (0x2) *(.fini9) - .fini9 0x00000148 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) - 0x00000148 _exit - 0x00000148 exit + .fini9 0x0000023a 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) + 0x0000023a _exit + 0x0000023a exit *(.fini9) *(.fini8) *(.fini8) @@ -278,36 +327,50 @@ END GROUP *(.fini1) *(.fini1) *(.fini0) - .fini0 0x00000148 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 0x0000023a 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) - 0x0000014c _etext = . + 0x0000023e _etext = . -.data 0x00800060 0x0 load address 0x0000014c - [!provide] PROVIDE (__data_start, .) +.data 0x00800060 0x12 load address 0x0000023e + 0x00800060 PROVIDE (__data_start, .) *(.data) *(.data*) + .data.t1 0x00800060 0x11 main.o + 0x00800060 t1 *(.gnu.linkonce.d*) *(.rodata) *(.rodata*) *(.gnu.linkonce.r*) - 0x00800060 . = ALIGN (0x2) - 0x00800060 _edata = . - [!provide] PROVIDE (__data_end, .) + 0x00800072 . = ALIGN (0x2) + *fill* 0x00800071 0x1 + 0x00800072 _edata = . + 0x00800072 PROVIDE (__data_end, .) -.bss 0x00800060 0x0 - [!provide] PROVIDE (__bss_start, .) +.bss 0x00800072 0x6 + 0x00800072 PROVIDE (__bss_start, .) *(.bss) *(.bss*) + .bss.counter 0x00800072 0x2 main.o + 0x00800072 counter + .bss.clock_new_state + 0x00800074 0x1 main.o + 0x00800074 clock_new_state + .bss.clock_state + 0x00800075 0x1 main.o + 0x00800075 clock_state *(COMMON) - [!provide] PROVIDE (__bss_end, .) - 0x0000014c __data_load_start = LOADADDR (.data) - 0x0000014c __data_load_end = (__data_load_start + SIZEOF (.data)) + COMMON 0x00800076 0x2 main.o + 0x00800076 clock_old_state + 0x00800077 flags + 0x00800078 PROVIDE (__bss_end, .) + 0x0000023e __data_load_start = LOADADDR (.data) + 0x00000250 __data_load_end = (__data_load_start + SIZEOF (.data)) -.noinit 0x00800060 0x0 +.noinit 0x00800078 0x0 [!provide] PROVIDE (__noinit_start, .) *(.noinit*) [!provide] PROVIDE (__noinit_end, .) - 0x00800060 _end = . + 0x00800078 _end = . [!provide] PROVIDE (__heap_start, .) .eeprom 0x00810000 0x0 @@ -374,59 +437,60 @@ END GROUP .debug_sfnames *(.debug_sfnames) -.debug_aranges 0x00000000 0x88 +.debug_aranges 0x00000000 0x90 *(.debug_aranges) .debug_aranges 0x00000000 0x48 lcd4.o .debug_aranges 0x00000048 0x20 lcd_wait.o .debug_aranges - 0x00000068 0x20 main.o + 0x00000068 0x28 main.o .debug_pubnames *(.debug_pubnames) -.debug_info 0x00000000 0x915 +.debug_info 0x00000000 0xa9b *(.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 0xff main.o + .debug_info 0x00000816 0x285 main.o -.debug_abbrev 0x00000000 0x631 +.debug_abbrev 0x00000000 0x6f0 *(.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 0xa6 main.o + .debug_abbrev 0x0000058b 0x165 main.o -.debug_line 0x00000000 0x517 +.debug_line 0x00000000 0x59a *(.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 0xbd main.o + .debug_line 0x0000045a 0x140 main.o -.debug_frame 0x00000000 0xf4 +.debug_frame 0x00000000 0x120 *(.debug_frame) .debug_frame 0x00000000 0x9c lcd4.o .debug_frame 0x0000009c 0x34 lcd_wait.o - .debug_frame 0x000000d0 0x24 main.o + .debug_frame 0x000000d0 0x50 main.o -.debug_str 0x00000000 0x35c +.debug_str 0x00000000 0x446 *(.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 0x11 main.o - 0x1ad (size before relaxing) + .debug_str 0x0000034b 0xfb main.o + 0x2a9 (size before relaxing) -.debug_loc 0x00000000 0x28c +.debug_loc 0x00000000 0x3bb *(.debug_loc) .debug_loc 0x00000000 0x244 lcd4.o .debug_loc 0x00000244 0x48 lcd_wait.o + .debug_loc 0x0000028c 0x12f main.o .debug_macinfo *(.debug_macinfo) @@ -446,11 +510,11 @@ END GROUP .debug_pubtypes *(.debug_pubtypes) -.debug_ranges 0x00000000 0x58 +.debug_ranges 0x00000000 0x78 *(.debug_ranges) .debug_ranges 0x00000000 0x38 lcd4.o .debug_ranges 0x00000038 0x10 lcd_wait.o - .debug_ranges 0x00000048 0x10 main.o + .debug_ranges 0x00000048 0x30 main.o .debug_macro *(.debug_macro) diff --git a/Debug/AtTiny_alarm_clock.srec b/Debug/AtTiny_alarm_clock.srec index 237ac8e..52486b7 100644 --- a/Debug/AtTiny_alarm_clock.srec +++ b/Debug/AtTiny_alarm_clock.srec @@ -1,23 +1,40 @@ S01A0000417454696E795F616C61726D5F636C6F636B2E73726563DA -S113000014C019C018C017C016C015C014C013C03E -S113001012C011C010C00FC00EC00DC00CC00BC068 -S11300200AC009C008C007C006C011241FBECFED16 -S1130030CDBF80D089C0E4CFCF93C2E362D0C1509A -S1130040E9F7CF910895CF93C62F843038F48230E6 -S113005048F4882371F0813049F00CC0843051F4A5 -S1130060939808C04F73833009F4405C842F8068F0 -S113007024D0939A929A929A98B39F708C2F807FEF -S1130080982B98BB98B39F70892B88BB92989298B1 -S113009038D087B3803F79F4929A929A88B3C29504 -S11300A0C07F8F708C2B88BB88B38F70C82BC8BB64 -S11300B09298929826D0CF91089540E0682F84E0DA -S11300C0C2DF08958FEF87BB8B9A8A9A88BB939A75 -S11300D0929AB2DFB1DFB0DF80E3EFDFADDF80E320 -S11300E0ECDF0FD080E3E9DF88E2E7DF87B3807FCE -S11300F087BB8CE0E2DF86E0E0DF82E0DEDF9CDFCE -S11301000895CF93DF931F92CDB7DD2784E48983CD -S113011089819FEF980F9983882341F08981898190 -S113012089819FEF980F99838111F8CF0F90DF9108 -S1130130CF9108958FEF87BB8AEA88BBC3DF40E085 -S10F014061E480E080DFFFCFF894FFCF83 +S113000014C02CC02BC02AC029C028C027C026C0B9 +S113001025C024C023C022C021C020C01FC01EC0D0 +S11300201DC01CC01BC01AC019C011241FBECFEDB7 +S1130030CDBF10E0A0E6B0E0EEE3F2E002C0059030 +S11300400D92A237B107D9F720E0A2E7B0E001C0D2 +S11300501D92A837B207E1F7AED0EFC0D1CFCF934E +S1130060C2E362D0C150E9F7CF910895CF93C62F70 +S1130070843038F4823048F4882371F0813049F0B8 +S11300800CC0843051F4939808C04F73833009F442 +S1130090405C842F806824D0939A929A929A98B361 +S11300A09F708C2F807F982B98BB98B39F70892B5F +S11300B088BB9298929838D087B3803F79F4929A0B +S11300C0929A88B3C295C07F8F708C2B88BB88B3FB +S11300D08F70C82BC8BB9298929826D0CF91089560 +S11300E040E0682F84E0C2DF08958FEF87BB8B9ACE +S11300F08A9A88BB939A929AB2DFB1DFB0DF80E329 +S1130100EFDFADDF80E3ECDF0FD080E3E9DF88E2EF +S1130110E7DF87B3807F87BB8CE0E2DF86E0E0DF48 +S113012082E0DEDF9CDF0895CF93DF931F92CDB78B +S1130130DD2784E4898389819FEF980F998388233D +S113014041F08981898189819FEF980F9983811179 +S1130150F8CF0F90DF91CF910895EF92FF920F9314 +S11301601F93CF937C01892B29F081E0E816F104D9 +S113017031F00AC06894EE24E1F8F12C05C00F2E8A +S1130180F3E0EF2EF12CF02DFA0160816F3569F068 +S11301908A010F5F1F4FC0E04C2F8E2D67DFF801DF +S11301A061918F01CF5F6F35B9F7CF911F910F9197 +S11301B0FF90EF90089511BAC2E7D0E080917400E7 +S11301C0882319F0813051F0FBCF109275008DDF38 +S11301D081E086DF81E080937400F0CF81E080933A +S11301E0750040E650E060E070E080E090E0B5DF4C +S11301F090B380917700937021E0933009F020E070 +S1130200982F91702917A1F090B39370933069F4EB +S113021081608093770080917200909173000196C1 +S1130220909373008093720003C08E7F8093770055 +S11102308881805D80936000C1CFF894FFCF79 +S113023E2048616C6C6F5F5F5F5F5F5F5F5F5F5FE6 +S105024E5F004B S9030000FC diff --git a/Debug/main.d b/Debug/main.d index 00d29bf..9b43f08 100644 --- a/Debug/main.d +++ b/Debug/main.d @@ -10,6 +10,8 @@ main.d main.o: .././main.c \ c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \ c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \ c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdlib.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h \ .././lcd4.h c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h: @@ -34,4 +36,8 @@ c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\ c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h: +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdlib.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h: + .././lcd4.h: diff --git a/Debug/main.o b/Debug/main.o index 35c5b89..a50e91a 100644 Binary files a/Debug/main.o and b/Debug/main.o differ diff --git a/main.c b/main.c index 32456fd..f8a47c6 100644 --- a/main.c +++ b/main.c @@ -6,19 +6,82 @@ */ #include +#include #include "lcd4.h" +#define butt1 0 + +typedef enum {CLOCK_INIT = 0, CLOCK_IDLE, CLOCK_ALARM, CLOCK_STOPWATCH_RUNNING, CLOCK_STOPWATCH_STOPPED, CLOCK_STOPWATCH_NOT_SET, CLOCK_USER_INPUT, CLOCK_SET_TIME} clock_state_e; + +clock_state_e clock_old_state; +clock_state_e clock_state = CLOCK_INIT; +clock_state_e clock_new_state = CLOCK_INIT; + +uint8_t t1[] = {' ','H','a','l','l','o','_','_','_','_','_','_','_','_','_','_','_'}; +int counter = 0; + +uint8_t flags; int main(void) { - DDRB = 0xff; - PORTB = 0xAA; - lcd_init(); - lcd_write(here, 0x41, 0); + DDRD = 0x00; + + + /* Replace with your application code */ while (1) { - + clock_state = clock_new_state; + switch(clock_state){ + case CLOCK_INIT: + //do some init stuff... + lcd_init(); //I know, it's just c but I don't care + lcd_instruct(lcd_DISPLAY_CLEAR); + //INIT done -> 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(((PIND & 0x03) == 3) != (flags & 1<