From a3dcc424d1c0b147c0f5524fb37ebe19e6311c40 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sun, 5 Aug 2018 16:33:41 +0200 Subject: [PATCH] added timer interrupt and a function whic returns if a button(defines: butt1, butt2, butt3) has been clicked --- .vs/AtTiny_alarm_clock/v14/.atsuo | Bin 27648 -> 35840 bytes Debug/AtTiny_alarm_clock.elf | Bin 12832 -> 13672 bytes Debug/AtTiny_alarm_clock.hex | 52 ++-- Debug/AtTiny_alarm_clock.lss | 420 +++++++++++++++++++----------- Debug/AtTiny_alarm_clock.map | 69 ++--- Debug/AtTiny_alarm_clock.srec | 52 ++-- Debug/main.d | 3 + Debug/main.o | Bin 7300 -> 9376 bytes main.c | 64 +++-- 9 files changed, 426 insertions(+), 234 deletions(-) diff --git a/.vs/AtTiny_alarm_clock/v14/.atsuo b/.vs/AtTiny_alarm_clock/v14/.atsuo index 0a07bc923bf3b09a602c8a252be07aa7bb3ec8ed..8512f01be15173b1b1c16e4f40503cdb1a3ebc3f 100644 GIT binary patch delta 1313 zcmb`HPe>GT6vyZH+ZlIPXExXW?CS2CtC+0e3ii)`Ya=O1?nu)?FL~&qSs;vHT{7wt zNYFfp$WvY-FU8I|5bO|9snnsf&^dzXuprgI~Bq;)ZVbOM7nyi4Kwn9Kpa&Ks{W_%6;0!nm&VgRg2l~MP7z8;m z1kM9-x`ER^ewR{MiphK^;M;br)H1UZ zy2iu@vTuj1M1D`Zf0cX5Kr7Y3PIS(}AyzU^dZM4cUyafF^?E1Uu=$T(4fXF%XX8%1 z@hkIr&okP&a3y+k=-$I;uOlxe7wPH8-7Ql>o5Tv4bw;_yoSo7&uaE!8w~*Flg&pa2PHqjV%ApZ|iNmmZmkTHLQvVGaY7Cp=SF&&5xPxkDb)1*4AVkr^ibV6% zbEtJ0ZJO;gFfs4cPP}IkCP@r>W@al)CM`VgVD W$yVx|`9#yr*F3s-cy*SqcJSZk1++H+ delta 1186 zcmb`HL2nX46vvr`-2%>Pv9y3xr7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1IB L&&q1Nl-&LYAR8Y8 delta 1988 zcmZ8iU2KzO6h7x|zpnpl*KS>PY+Z{R8|_B!To64rMr)Scc zls-msq&_R#ZMjhPSeri56gUyfr89Cwwh#R^K9G`Ql+qKF*0&PBla^a4B@<+tJe*XX zedDP$DLFvrJJ z;kKMLsj)%scC{tlC!kw-6eeEEDuaqXh^6C|P;80eF*tfa`V}_Yi^E$AumKVFT}GH9 zE{EnABJNYv1c386tZNYC;!R=~#zAoqF1KjMSk6wg%t1~nI;)ahpqh?^1YZL1JPorq z-&M?@=&)9hZyM8PF#SJ58G~{PGb(VDoH?j}AkJmkBzZ_Ox4SGGByY@XgOb-v)=cU| z;H&&cweCr(1%Y)ttd(7=CvU;BO<6uxq>6%N6qYL0eLd<1)Zif@%A$y>9*q+Fy)YFj zRGwFnl|A|F36(1Z9tTuBIM`$gGVc!{WIx0d1sa8-#MB1cF% zxq=s4j`ld&hi%ZvWL5TFpRiyX01a9mIyxTmI`{8p_Hq<)t^>Q7gkA5kVr&M--u@L)Y)a#Eh_xe<~ zfqLrowK=d#4;owK6zCzCnIG6 zN-weo@3T~LO-1p${QtIHs`GOek=Y$^L*N7d7@Zd3DShk2pA($vr0a!GTWSRv&0=5FrJoNg{>n|im@7n0x4AImSj z>|L<4r8#fLRb#q^3Z-}!c&6YF(aqU1$t`tBH*VhjY>0XSxY!$>7YYKa>xb6Ji_NS9 z#z8Rhc#!4s621rgZs5{<%YfD6P>g^6VSkd=J#3(tfeWvWdNF9{|NMJ_@pr$0;{fxJ zJqAk!%BV+(LWUdhH)kh-OB?zQ*f_NYKU3R!Rb>3pA6QNB{r; diff --git a/Debug/AtTiny_alarm_clock.hex b/Debug/AtTiny_alarm_clock.hex index fe26490..c56528b 100644 --- a/Debug/AtTiny_alarm_clock.hex +++ b/Debug/AtTiny_alarm_clock.hex @@ -1,9 +1,9 @@ -:1000000014C02CC02BC02AC029C028C027C026C0BD +:1000000014C02CC02BC02AC029C0A7C027C026C03E :1000100025C024C023C022C021C020C01FC01EC0D4 :100020001DC01CC01BC01AC019C011241FBECFEDBB -:10003000CDBF10E0A0E6B0E0EEE3F2E002C0059034 +:10003000CDBF10E0A0E6B0E0E6EFF2E002C0059030 :100040000D92A237B107D9F720E0A2E7B0E001C0D6 -:100050001D92A837B207E1F7AED0EFC0D1CFCF9352 +:100050001D92A837B207E1F7F4D04BC1D1CFCF93AF :10006000C2E362D0C150E9F7CF910895CF93C62F74 :10007000843038F4823048F4882371F0813049F0BC :100080000CC0843051F4939808C04F73833009F446 @@ -19,21 +19,33 @@ :1001200082E0DEDF9CDF0895CF93DF931F92CDB78F :10013000DD2784E4898389819FEF980F9983882341 :1001400041F08981898189819FEF980F998381117D -:10015000F8CF0F90DF91CF910895EF92FF920F9318 -:100160001F93CF937C01892B29F081E0E816F104DD -:1001700031F00AC06894EE24E1F8F12C05C00F2E8E -:10018000F3E0EF2EF12CF02DFA0160816F3569F06C -:100190008A010F5F1F4FC0E04C2F8E2D67DFF801E3 -:1001A00061918F01CF5F6F35B9F7CF911F910F919B -:1001B000FF90EF90089511BAC2E7D0E080917400EB -:1001C000882319F0813051F0FBCF109275008DDF3C -:1001D00081E086DF81E080937400F0CF81E080933E -:1001E000750040E650E060E070E080E090E0B5DF50 -:1001F00090B380917700937021E0933009F020E074 -:10020000982F91702917A1F090B39370933069F4EF -:1002100081608093770080917200909173000196C5 -:10022000909373008093720003C08E7F8093770059 -:0E0230008881805D80936000C1CFF894FFCF7D -:10023E002048616C6C6F5F5F5F5F5F5F5F5F5F5FEA -:02024E005F004F +:10015000F8CF0F90DF91CF9108951F920F920FB6B5 +:100160000F9211248F939F9386EE99EF9DBD8CBDC6 +:100170009F918F910F900FBE0F901F901895EF9247 +:10018000FF920F931F93CF937C01892B29F081E07D +: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 :00000001FF diff --git a/Debug/AtTiny_alarm_clock.lss b/Debug/AtTiny_alarm_clock.lss index 0012e6f..2fcbdc7 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 0000023e 00000000 00000000 00000094 2**1 + 0 .text 000002f6 00000000 00000000 00000094 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .data 00000012 00800060 0000023e 000002d2 2**0 + 1 .data 00000012 00800060 000002f6 0000038a 2**0 CONTENTS, ALLOC, LOAD, DATA - 2 .bss 00000006 00800072 00800072 000002e4 2**0 + 2 .bss 00000006 00800072 00800072 0000039c 2**0 ALLOC - 3 .comment 00000030 00000000 00000000 000002e4 2**0 + 3 .comment 00000030 00000000 00000000 0000039c 2**0 CONTENTS, READONLY - 4 .note.gnu.avr.deviceinfo 00000040 00000000 00000000 00000314 2**2 + 4 .note.gnu.avr.deviceinfo 00000040 00000000 00000000 000003cc 2**2 CONTENTS, READONLY - 5 .debug_aranges 00000090 00000000 00000000 00000354 2**0 + 5 .debug_aranges 000000a0 00000000 00000000 0000040c 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_info 00000a9b 00000000 00000000 000003e4 2**0 + 6 .debug_info 00000b59 00000000 00000000 000004ac 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_abbrev 000006f0 00000000 00000000 00000e7f 2**0 + 7 .debug_abbrev 00000738 00000000 00000000 00001005 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_line 0000059a 00000000 00000000 0000156f 2**0 + 8 .debug_line 0000061f 00000000 00000000 0000173d 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_frame 00000120 00000000 00000000 00001b0c 2**2 + 9 .debug_frame 00000154 00000000 00000000 00001d5c 2**2 CONTENTS, READONLY, DEBUGGING - 10 .debug_str 00000446 00000000 00000000 00001c2c 2**0 + 10 .debug_str 00000470 00000000 00000000 00001eb0 2**0 CONTENTS, READONLY, DEBUGGING - 11 .debug_loc 000003bb 00000000 00000000 00002072 2**0 + 11 .debug_loc 00000428 00000000 00000000 00002320 2**0 CONTENTS, READONLY, DEBUGGING - 12 .debug_ranges 00000078 00000000 00000000 0000242d 2**0 + 12 .debug_ranges 00000088 00000000 00000000 00002748 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -38,7 +38,7 @@ Disassembly of section .text: 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> + a: a7 c0 rjmp .+334 ; 0x15a <__vector_5> c: 27 c0 rjmp .+78 ; 0x5c <__bad_interrupt> e: 26 c0 rjmp .+76 ; 0x5c <__bad_interrupt> 10: 25 c0 rjmp .+74 ; 0x5c <__bad_interrupt> @@ -65,7 +65,7 @@ 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: ee e3 ldi r30, 0x3E ; 62 + 38: e6 ef ldi r30, 0xF6 ; 246 3a: f2 e0 ldi r31, 0x02 ; 2 3c: 02 c0 rjmp .+4 ; 0x42 <__SREG__+0x3> 3e: 05 90 lpm r0, Z+ @@ -87,8 +87,8 @@ Disassembly of section .text: 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> + 58: f4 d0 rcall .+488 ; 0x242
+ 5a: 4b c1 rjmp .+662 ; 0x2f2 <_exit> 0000005c <__bad_interrupt>: 5c: d1 cf rjmp .-94 ; 0x0 <__vectors> @@ -327,188 +327,314 @@ void wait_100us(void){ 156: cf 91 pop r28 158: 08 95 ret -0000015a : +0000015a <__vector_5>: +int counter = 0; + +uint8_t flags; + +ISR (TIMER1_OVF_vect) // Timer1 ISR +{ + 15a: 1f 92 push r1 + 15c: 0f 92 push r0 + 15e: 0f b6 in r0, 0x3f ; 63 + 160: 0f 92 push r0 + 162: 11 24 eor r1, r1 + 164: 8f 93 push r24 + 166: 9f 93 push r25 + //counter++; + TCNT1 = 63974; + 168: 86 ee ldi r24, 0xE6 ; 230 + 16a: 99 ef ldi r25, 0xF9 ; 249 + 16c: 9d bd out 0x2d, r25 ; 45 + 16e: 8c bd out 0x2c, r24 ; 44 +} + 170: 9f 91 pop r25 + 172: 8f 91 pop r24 + 174: 0f 90 pop r0 + 176: 0f be out 0x3f, r0 ; 63 + 178: 0f 90 pop r0 + 17a: 1f 90 pop r1 + 17c: 18 95 reti + +0000017e : } } } 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 + 17e: ef 92 push r14 + 180: ff 92 push r15 + 182: 0f 93 push r16 + 184: 1f 93 push r17 + 186: cf 93 push r28 + 188: 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 + 18a: 89 2b or r24, r25 + 18c: 29 f0 breq .+10 ; 0x198 + 18e: 81 e0 ldi r24, 0x01 ; 1 + 190: e8 16 cp r14, r24 + 192: f1 04 cpc r15, r1 + 194: 31 f0 breq .+12 ; 0x1a2 + 196: 0a c0 rjmp .+20 ; 0x1ac 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 + 198: 68 94 set + 19a: ee 24 eor r14, r14 + 19c: e1 f8 bld r14, 1 + 19e: f1 2c mov r15, r1 + 1a0: 05 c0 rjmp .+10 ; 0x1ac 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 + 1a2: 0f 2e mov r0, r31 + 1a4: f3 e0 ldi r31, 0x03 ; 3 + 1a6: ef 2e mov r14, r31 + 1a8: f1 2c mov r15, r1 + 1aa: f0 2d mov r31, r0 + 1ac: 04 2f mov r16, r20 + 1ae: 15 2f mov r17, r21 + 1b0: c0 e0 ldi r28, 0x00 ; 0 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 + for(int i=0;i<=15;i++){ + if(text[i] != 0x5F){ + 1b2: f8 01 movw r30, r16 + 1b4: 61 91 ld r22, Z+ + 1b6: 8f 01 movw r16, r30 + 1b8: 6f 35 cpi r22, 0x5F ; 95 + 1ba: 19 f0 breq .+6 ; 0x1c2 + lcd_write(row, text[i], 0+i); + 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 + break; 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++; + for(int i=0;i<=15;i++){ + 1c4: c0 31 cpi r28, 0x10 ; 16 + 1c6: a9 f7 brne .-22 ; 0x1b2 + if(text[i] != 0x5F){ + lcd_write(row, text[i], 0+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 + 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 -000001b6
: +000001d4 : -uint8_t flags; +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 + //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 + //button is high -> pressed + flags |= (1< + return(1); + 228: 81 e0 ldi r24, 0x01 ; 1 + 22a: 90 e0 ldi r25, 0x00 ; 0 + 22c: 08 95 ret + } + else{ + //button is low -> released + flags &= ~(1< + return(0); + 236: 80 e0 ldi r24, 0x00 ; 0 + 238: 90 e0 ldi r25, 0x00 ; 0 + 23a: 08 95 ret + } + } + return(0); + 23c: 80 e0 ldi r24, 0x00 ; 0 + 23e: 90 e0 ldi r25, 0x00 ; 0 +} + 240: 08 95 ret + +00000242
: + TCNT1 = 63974; +} int main(void) { DDRD = 0x00; - 1b6: 11 ba out 0x11, r1 ; 17 - flags &= ~(1< + 25c: 80 91 74 00 lds r24, 0x0074 ; 0x800074 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 + 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 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 + 26e: 3d df rcall .-390 ; 0xea lcd_instruct(lcd_DISPLAY_CLEAR); - 1d0: 81 e0 ldi r24, 0x01 ; 1 - 1d2: 86 df rcall .-244 ; 0xe0 + 270: 81 e0 ldi r24, 0x01 ; 1 + 272: 36 df rcall .-404 ; 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 + 274: 81 e0 ldi r24, 0x01 ; 1 + 276: 80 93 74 00 sts 0x0074, r24 ; 0x800074 break; - 1da: f0 cf rjmp .-32 ; 0x1bc - 1dc: 81 e0 ldi r24, 0x01 ; 1 - 1de: 80 93 75 00 sts 0x0075, r24 ; 0x800075 + 27a: f0 cf rjmp .-32 ; 0x25c + 27c: 81 e0 ldi r24, 0x01 ; 1 + 27e: 80 93 75 00 sts 0x0075, r24 ; 0x800075 case CLOCK_IDLE: //IDLE MODE //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 + 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(((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< - } + + 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 } + 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 + 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 + } + 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 + 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< + 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> break; - 238: c1 cf rjmp .-126 ; 0x1bc + 2f0: b5 cf rjmp .-150 ; 0x25c -0000023a <_exit>: - 23a: f8 94 cli +000002f2 <_exit>: + 2f2: f8 94 cli -0000023c <__stop_program>: - 23c: ff cf rjmp .-2 ; 0x23c <__stop_program> +000002f4 <__stop_program>: + 2f4: ff cf rjmp .-2 ; 0x2f4 <__stop_program> diff --git a/Debug/AtTiny_alarm_clock.map b/Debug/AtTiny_alarm_clock.map index 74c3fd6..538eddd 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 0x23e +.text 0x00000000 0x2f6 *(.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 @@ -272,7 +272,6 @@ END GROUP 0x0000005c __vector_17 0x0000005c __vector_19 0x0000005c __vector_7 - 0x0000005c __vector_5 0x0000005c __vector_4 0x0000005c __vector_9 0x0000005c __vector_2 @@ -299,16 +298,22 @@ END GROUP .text.wait_100us 0x00000128 0x32 lcd_wait.o 0x00000128 wait_100us + .text.__vector_5 + 0x0000015a 0x24 main.o + 0x0000015a __vector_5 .text.lcd_write_text - 0x0000015a 0x5c main.o - 0x0000015a lcd_write_text - .text.main 0x000001b6 0x84 main.o - 0x000001b6 main - 0x0000023a . = ALIGN (0x2) + 0x0000017e 0x56 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) *(.fini9) - .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 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) *(.fini8) *(.fini8) @@ -327,11 +332,11 @@ END GROUP *(.fini1) *(.fini1) *(.fini0) - .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 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) - 0x0000023e _etext = . + 0x000002f6 _etext = . -.data 0x00800060 0x12 load address 0x0000023e +.data 0x00800060 0x12 load address 0x000002f6 0x00800060 PROVIDE (__data_start, .) *(.data) *(.data*) @@ -363,8 +368,8 @@ END GROUP 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)) + 0x000002f6 __data_load_start = LOADADDR (.data) + 0x00000308 __data_load_end = (__data_load_start + SIZEOF (.data)) .noinit 0x00800078 0x0 [!provide] PROVIDE (__noinit_start, .) @@ -437,60 +442,60 @@ END GROUP .debug_sfnames *(.debug_sfnames) -.debug_aranges 0x00000000 0x90 +.debug_aranges 0x00000000 0xa0 *(.debug_aranges) .debug_aranges 0x00000000 0x48 lcd4.o .debug_aranges 0x00000048 0x20 lcd_wait.o .debug_aranges - 0x00000068 0x28 main.o + 0x00000068 0x38 main.o .debug_pubnames *(.debug_pubnames) -.debug_info 0x00000000 0xa9b +.debug_info 0x00000000 0xb59 *(.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 0x285 main.o + .debug_info 0x00000816 0x343 main.o -.debug_abbrev 0x00000000 0x6f0 +.debug_abbrev 0x00000000 0x738 *(.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 0x165 main.o + .debug_abbrev 0x0000058b 0x1ad main.o -.debug_line 0x00000000 0x59a +.debug_line 0x00000000 0x61f *(.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 0x140 main.o + .debug_line 0x0000045a 0x1c5 main.o -.debug_frame 0x00000000 0x120 +.debug_frame 0x00000000 0x154 *(.debug_frame) .debug_frame 0x00000000 0x9c lcd4.o .debug_frame 0x0000009c 0x34 lcd_wait.o - .debug_frame 0x000000d0 0x50 main.o + .debug_frame 0x000000d0 0x84 main.o -.debug_str 0x00000000 0x446 +.debug_str 0x00000000 0x470 *(.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 0xfb main.o - 0x2a9 (size before relaxing) + .debug_str 0x0000034b 0x125 main.o + 0x2d3 (size before relaxing) -.debug_loc 0x00000000 0x3bb +.debug_loc 0x00000000 0x428 *(.debug_loc) .debug_loc 0x00000000 0x244 lcd4.o .debug_loc 0x00000244 0x48 lcd_wait.o - .debug_loc 0x0000028c 0x12f main.o + .debug_loc 0x0000028c 0x19c main.o .debug_macinfo *(.debug_macinfo) @@ -510,11 +515,11 @@ END GROUP .debug_pubtypes *(.debug_pubtypes) -.debug_ranges 0x00000000 0x78 +.debug_ranges 0x00000000 0x88 *(.debug_ranges) .debug_ranges 0x00000000 0x38 lcd4.o .debug_ranges 0x00000038 0x10 lcd_wait.o - .debug_ranges 0x00000048 0x30 main.o + .debug_ranges 0x00000048 0x40 main.o .debug_macro *(.debug_macro) diff --git a/Debug/AtTiny_alarm_clock.srec b/Debug/AtTiny_alarm_clock.srec index 52486b7..5211b36 100644 --- a/Debug/AtTiny_alarm_clock.srec +++ b/Debug/AtTiny_alarm_clock.srec @@ -1,10 +1,10 @@ S01A0000417454696E795F616C61726D5F636C6F636B2E73726563DA -S113000014C02CC02BC02AC029C028C027C026C0B9 +S113000014C02CC02BC02AC029C0A7C027C026C03A S113001025C024C023C022C021C020C01FC01EC0D0 S11300201DC01CC01BC01AC019C011241FBECFEDB7 -S1130030CDBF10E0A0E6B0E0EEE3F2E002C0059030 +S1130030CDBF10E0A0E6B0E0E6EFF2E002C005902C S11300400D92A237B107D9F720E0A2E7B0E001C0D2 -S11300501D92A837B207E1F7AED0EFC0D1CFCF934E +S11300501D92A837B207E1F7F4D04BC1D1CFCF93AB S1130060C2E362D0C150E9F7CF910895CF93C62F70 S1130070843038F4823048F4882371F0813049F0B8 S11300800CC0843051F4939808C04F73833009F442 @@ -20,21 +20,33 @@ S1130110E7DF87B3807F87BB8CE0E2DF86E0E0DF48 S113012082E0DEDF9CDF0895CF93DF931F92CDB78B S1130130DD2784E4898389819FEF980F998388233D S113014041F08981898189819FEF980F9983811179 -S1130150F8CF0F90DF91CF910895EF92FF920F9314 -S11301601F93CF937C01892B29F081E0E816F104D9 -S113017031F00AC06894EE24E1F8F12C05C00F2E8A -S1130180F3E0EF2EF12CF02DFA0160816F3569F068 -S11301908A010F5F1F4FC0E04C2F8E2D67DFF801DF -S11301A061918F01CF5F6F35B9F7CF911F910F9197 -S11301B0FF90EF90089511BAC2E7D0E080917400E7 -S11301C0882319F0813051F0FBCF109275008DDF38 -S11301D081E086DF81E080937400F0CF81E080933A -S11301E0750040E650E060E070E080E090E0B5DF4C -S11301F090B380917700937021E0933009F020E070 -S1130200982F91702917A1F090B39370933069F4EB -S113021081608093770080917200909173000196C1 -S1130220909373008093720003C08E7F8093770055 -S11102308881805D80936000C1CFF894FFCF79 -S113023E2048616C6C6F5F5F5F5F5F5F5F5F5F5FE6 -S105024E5F004B +S1130150F8CF0F90DF91CF9108951F920F920FB6B1 +S11301600F9211248F939F9386EE99EF9DBD8CBDC2 +S11301709F918F910F900FBE0F901F901895EF9243 +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 S9030000FC diff --git a/Debug/main.d b/Debug/main.d index 9b43f08..ea8e404 100644 --- a/Debug/main.d +++ b/Debug/main.d @@ -10,6 +10,7 @@ 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\avr\interrupt.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 @@ -36,6 +37,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\avr\interrupt.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: diff --git a/Debug/main.o b/Debug/main.o index a50e91a1f3bdc85cc192fcd483d01db7228e3aa3..215ffe35865ffd02acad61c5d4b6deaccd0c9559 100644 GIT binary patch literal 9376 zcmb`MYiwM{b;oD+F5lGhsfVox*OKDMF}WmV$);t=A|)y^UA-z%RvNIrSuU64M$27h zcWFzmYf(nxhvG;SX*qW4#7PslMXD+WoTf-(J4}n9A6!=|{2?vSAgcyN)1-)`*l1n! zq5l7K&+HB<6*bTfaPR!)%$YN1&OGkDyC-(-`MB0v*`(DWRW2!YtWBwxP`Sw{Y*4qU zHL7j4VYcBr4YN(_&&<6t_tdXmy7J{WpL_F_vuDmW%rv~!Fw-`(;@p+l>$44WZF3jr z9@o#_sjr?a{(RZBu)eD1$DjYz`pX|&Ygh9PvGM5@7*!WX z)HsXaTsm3gMT=@a$a{+iik~V@7HLym3hs;rThHLqFU+tnpFe3M&9S5gXfG@3K~{vS zSP=?W1X)n34ocOgWLVRRxA8pg#&&QI`UwTSnS0pWD^!(fpqu{bLpCtYD$Ttr@J~0f zvuZO^y~nPK4Dl(M2SgMv$&a@v&Qr~atYav*wmb312P+f~+L*@9KPR(iERhDmY<=x5*iTWkojY_Sc zkqsE9v9=j-l&$o*mIk$MgRX|k(K$WFZW<~_=5%sSSC|C`Be&3!ZsA;uFp#v~AX(~2 zZe=)siY{03)@YaFszSHY%P&H-z}AW#i>;gXqO-bu=6T(2q0237Qo2chB+^pnMOH=* zS2pQ`x)Dn*v|iQK-47vVW|{ILTk7ts8^F|rMUJgg5!PO$4pP=>)KzYP;wnscRam?7 z>X_PIADH-PeUon1y_H|wfpu0B(>IaRQf-Cus)H`Mk?K$s4_K_PgUeh+OExV~i#+?J zM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uyt1#CI*92`Sd-0HYp7s0qF5zWJ@A2_L;d-R^`}kpDo?%Z5BT?TKUW4=nADg{{ zb{Ws4=#i*j2y@?`_VHW7w0}pKZM`o{d%G{lpNPH%DgRi;K9c#DCGt(+xjtSf%riBF zN6VFiN1Gih9#s*Endg_?3yY|qrPMK`6zVy@L1FsiJWoOfY<7~R?;W%O(~pYg4-6GzeMk#A zFCDaGKI5Y1UK8bQCYnp8V^M0O#fz2qt?Mf>pHnoC+Rr@WA&MK6r!^mw(|0eQ(tKe` zD+zup;ft?7tD+vq`ucLodu9~F)r@>B7t0JJZJ=JYOQ`szX}zMa3Xu-+!)=DIe*8@Y zf64fwaybk!J!apr4$m{cu#B=4583_=?7!LZoaBD{Uv}o60Xwc;3jJ~Jt=M+CCWCmk zNx_`3Qaxa<9qRdT-`$Ldb*#TJuvsTaDc0YOV86dX`0GL;{jsj~cN^H>k2$d6p0i^8 z#i1bE{?bma0mjtYrIGXd;~uhQG_-u=3)(&DtHb*A_f21b*565#`TP4*oUQc;mi^_p z+5SEYwsnB&1=u8g3X4Cvz^YzumWMm3j$wY?sHoZTB@_9iZBRNmxM; zv94c5-tX_xIZADUj{Z2_*54n%whmDB!(Sso#FqUQdB4A3!rwmV=#SSa>+hdnTL-9~ zfWK`%g~fNJ&NdoBR^a~8f_qb=Q(1uSf zUQDgL1UvqISYbaXJmdZSP2+ss2|eTEcY*CM#}ZRtl$T-0v)_tEroOQ8KLBVK3f{YU X#?xOl9vta2{B_~t^>gT~SbzTkP3~Yu diff --git a/main.c b/main.c index f8a47c6..88f41a2 100644 --- a/main.c +++ b/main.c @@ -6,10 +6,13 @@ */ #include +#include #include #include "lcd4.h" #define butt1 0 +#define butt2 1 +#define butt3 2 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; @@ -22,10 +25,22 @@ int counter = 0; uint8_t flags; +ISR (TIMER1_OVF_vect) // Timer1 ISR +{ + //counter++; + TCNT1 = 63974; +} + int main(void) { DDRD = 0x00; + TCNT1 = 63974; // for 1 sec at 16 MHz + + TCCR1A = 0x00; + TCCR1B = (1<0)){ + //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){ + //button is high -> pressed + flags |= (1< released + flags &= ~(1<