640 lines
21 KiB
Text
640 lines
21 KiB
Text
|
|
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
|
|
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
|
1 .data 00000012 00800060 000002f6 0000038a 2**0
|
|
CONTENTS, ALLOC, LOAD, DATA
|
|
2 .bss 00000006 00800072 00800072 0000039c 2**0
|
|
ALLOC
|
|
3 .comment 00000030 00000000 00000000 0000039c 2**0
|
|
CONTENTS, READONLY
|
|
4 .note.gnu.avr.deviceinfo 00000040 00000000 00000000 000003cc 2**2
|
|
CONTENTS, READONLY
|
|
5 .debug_aranges 000000a0 00000000 00000000 0000040c 2**0
|
|
CONTENTS, READONLY, DEBUGGING
|
|
6 .debug_info 00000b59 00000000 00000000 000004ac 2**0
|
|
CONTENTS, READONLY, DEBUGGING
|
|
7 .debug_abbrev 00000738 00000000 00000000 00001005 2**0
|
|
CONTENTS, READONLY, DEBUGGING
|
|
8 .debug_line 0000061f 00000000 00000000 0000173d 2**0
|
|
CONTENTS, READONLY, DEBUGGING
|
|
9 .debug_frame 00000154 00000000 00000000 00001d5c 2**2
|
|
CONTENTS, READONLY, DEBUGGING
|
|
10 .debug_str 00000470 00000000 00000000 00001eb0 2**0
|
|
CONTENTS, READONLY, DEBUGGING
|
|
11 .debug_loc 00000428 00000000 00000000 00002320 2**0
|
|
CONTENTS, READONLY, DEBUGGING
|
|
12 .debug_ranges 00000088 00000000 00000000 00002748 2**0
|
|
CONTENTS, READONLY, DEBUGGING
|
|
|
|
Disassembly of section .text:
|
|
|
|
00000000 <__vectors>:
|
|
0: 14 c0 rjmp .+40 ; 0x2a <__ctors_end>
|
|
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: 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>
|
|
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
|
|
|
|
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: 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+
|
|
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>
|
|
|
|
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: f4 d0 rcall .+488 ; 0x242 <main>
|
|
5a: 4b c1 rjmp .+662 ; 0x2f2 <_exit>
|
|
|
|
0000005c <__bad_interrupt>:
|
|
5c: d1 cf rjmp .-94 ; 0x0 <__vectors>
|
|
|
|
0000005e <lcd_5ms>:
|
|
|
|
void lcd_1s(void){
|
|
for(uint8_t i=200;i>0;i--){
|
|
lcd_5ms();
|
|
}
|
|
}
|
|
5e: cf 93 push r28
|
|
60: c2 e3 ldi r28, 0x32 ; 50
|
|
62: 62 d0 rcall .+196 ; 0x128 <wait_100us>
|
|
64: c1 50 subi r28, 0x01 ; 1
|
|
66: e9 f7 brne .-6 ; 0x62 <lcd_5ms+0x4>
|
|
68: cf 91 pop r28
|
|
6a: 08 95 ret
|
|
|
|
0000006c <lcd_write>:
|
|
|
|
void lcd_instruct(uint8_t zeichen){
|
|
lcd_write(instruct,zeichen,0);
|
|
}
|
|
|
|
void lcd_write(uint8_t lcd_whichwrite, uint8_t zeichen, uint8_t position){
|
|
6c: cf 93 push r28
|
|
6e: c6 2f mov r28, r22
|
|
switch (lcd_whichwrite){
|
|
70: 84 30 cpi r24, 0x04 ; 4
|
|
72: 38 f4 brcc .+14 ; 0x82 <lcd_write+0x16>
|
|
74: 82 30 cpi r24, 0x02 ; 2
|
|
76: 48 f4 brcc .+18 ; 0x8a <lcd_write+0x1e>
|
|
78: 88 23 and r24, r24
|
|
7a: 71 f0 breq .+28 ; 0x98 <lcd_write+0x2c>
|
|
7c: 81 30 cpi r24, 0x01 ; 1
|
|
7e: 49 f0 breq .+18 ; 0x92 <lcd_write+0x26>
|
|
80: 0c c0 rjmp .+24 ; 0x9a <lcd_write+0x2e>
|
|
82: 84 30 cpi r24, 0x04 ; 4
|
|
84: 51 f4 brne .+20 ; 0x9a <lcd_write+0x2e>
|
|
case instruct :
|
|
unset_lcd_RS;
|
|
86: 93 98 cbi 0x12, 3 ; 18
|
|
break;
|
|
88: 08 c0 rjmp .+16 ; 0x9a <lcd_write+0x2e>
|
|
case line2:
|
|
case line1:
|
|
position = position & 0x3f;
|
|
8a: 4f 73 andi r20, 0x3F ; 63
|
|
if (lcd_whichwrite == line2){ position=position + 0x40; };
|
|
8c: 83 30 cpi r24, 0x03 ; 3
|
|
8e: 09 f4 brne .+2 ; 0x92 <lcd_write+0x26>
|
|
90: 40 5c subi r20, 0xC0 ; 192
|
|
case therepos:
|
|
lcd_instruct(lcd_mask_Write_Adress(position));
|
|
92: 84 2f mov r24, r20
|
|
94: 80 68 ori r24, 0x80 ; 128
|
|
96: 24 d0 rcall .+72 ; 0xe0 <lcd_instruct>
|
|
case here:
|
|
set_lcd_RS;
|
|
98: 93 9a sbi 0x12, 3 ; 18
|
|
break;
|
|
|
|
|
|
}
|
|
set_lcd_E;
|
|
9a: 92 9a sbi 0x12, 2 ; 18
|
|
set_lcd_E;
|
|
9c: 92 9a sbi 0x12, 2 ; 18
|
|
lcd_dataport=lcd_dataport&~lcd_dataport_mask|zeichen&lcd_dataport_mask;
|
|
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;
|
|
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;
|
|
b2: 92 98 cbi 0x12, 2 ; 18
|
|
unset_lcd_E;
|
|
b4: 92 98 cbi 0x12, 2 ; 18
|
|
wait_100us();
|
|
b6: 38 d0 rcall .+112 ; 0x128 <wait_100us>
|
|
if (lcd_dataport_DDR==0xf0){
|
|
b8: 87 b3 in r24, 0x17 ; 23
|
|
ba: 80 3f cpi r24, 0xF0 ; 240
|
|
bc: 79 f4 brne .+30 ; 0xdc <lcd_write+0x70>
|
|
zeichen=zeichen << 4;
|
|
set_lcd_E;
|
|
be: 92 9a sbi 0x12, 2 ; 18
|
|
set_lcd_E;
|
|
c0: 92 9a sbi 0x12, 2 ; 18
|
|
lcd_dataport=lcd_dataport&~lcd_dataport_mask|zeichen&lcd_dataport_mask;
|
|
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;
|
|
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;
|
|
d6: 92 98 cbi 0x12, 2 ; 18
|
|
unset_lcd_E;
|
|
d8: 92 98 cbi 0x12, 2 ; 18
|
|
wait_100us();
|
|
da: 26 d0 rcall .+76 ; 0x128 <wait_100us>
|
|
}
|
|
}
|
|
dc: cf 91 pop r28
|
|
de: 08 95 ret
|
|
|
|
000000e0 <lcd_instruct>:
|
|
lcd_5ms();
|
|
}
|
|
}
|
|
|
|
void lcd_instruct(uint8_t zeichen){
|
|
lcd_write(instruct,zeichen,0);
|
|
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 <lcd_write>
|
|
e8: 08 95 ret
|
|
|
|
000000ea <lcd_init>:
|
|
|
|
|
|
|
|
void lcd_init(void){
|
|
/* setting up ports first */
|
|
lcd_dataport_DDR=0xff;
|
|
ea: 8f ef ldi r24, 0xFF ; 255
|
|
ec: 87 bb out 0x17, r24 ; 23
|
|
set_lcd_RS_DDR;
|
|
ee: 8b 9a sbi 0x11, 3 ; 17
|
|
set_lcd_E_DDR;
|
|
f0: 8a 9a sbi 0x11, 2 ; 17
|
|
/* end setting up ports */
|
|
lcd_dataport=0xff;
|
|
f2: 88 bb out 0x18, r24 ; 24
|
|
set_lcd_RS;
|
|
f4: 93 9a sbi 0x12, 3 ; 18
|
|
set_lcd_E;
|
|
f6: 92 9a sbi 0x12, 2 ; 18
|
|
lcd_5ms();
|
|
f8: b2 df rcall .-156 ; 0x5e <lcd_5ms>
|
|
lcd_5ms();
|
|
fa: b1 df rcall .-158 ; 0x5e <lcd_5ms>
|
|
lcd_5ms();
|
|
fc: b0 df rcall .-160 ; 0x5e <lcd_5ms>
|
|
lcd_instruct(lcd_SET_FUNCTION_8BIT);
|
|
fe: 80 e3 ldi r24, 0x30 ; 48
|
|
100: ef df rcall .-34 ; 0xe0 <lcd_instruct>
|
|
lcd_5ms();
|
|
102: ad df rcall .-166 ; 0x5e <lcd_5ms>
|
|
lcd_instruct(lcd_SET_FUNCTION_8BIT);
|
|
104: 80 e3 ldi r24, 0x30 ; 48
|
|
106: ec df rcall .-40 ; 0xe0 <lcd_instruct>
|
|
wait_100us();
|
|
108: 0f d0 rcall .+30 ; 0x128 <wait_100us>
|
|
lcd_instruct(lcd_SET_FUNCTION_8BIT);
|
|
10a: 80 e3 ldi r24, 0x30 ; 48
|
|
10c: e9 df rcall .-46 ; 0xe0 <lcd_instruct>
|
|
if (lcd_dataport_mask==0xf0){
|
|
lcd_instruct(lcd_SET_FUNCTION_4BIT|lcd_SET_FUNCTION_2LINE|lcd_SET_FUNCTION_7X5);
|
|
10e: 88 e2 ldi r24, 0x28 ; 40
|
|
110: e7 df rcall .-50 ; 0xe0 <lcd_instruct>
|
|
}else{
|
|
lcd_instruct(lcd_SET_FUNCTION_8BIT|lcd_SET_FUNCTION_2LINE|lcd_SET_FUNCTION_7X5);
|
|
}
|
|
lcd_dataport_DDR&=lcd_dataport_mask;
|
|
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);
|
|
118: 8c e0 ldi r24, 0x0C ; 12
|
|
11a: e2 df rcall .-60 ; 0xe0 <lcd_instruct>
|
|
lcd_instruct(lcd_ENTRY_MODE_SET|lcd_ENTRY_MODE_SET_INCREASE | lcd_ENTRY_MS_DISPLAY_NOT_S);
|
|
11c: 86 e0 ldi r24, 0x06 ; 6
|
|
11e: e0 df rcall .-64 ; 0xe0 <lcd_instruct>
|
|
lcd_instruct(lcd_RETURN_HOME);
|
|
120: 82 e0 ldi r24, 0x02 ; 2
|
|
122: de df rcall .-68 ; 0xe0 <lcd_instruct>
|
|
lcd_5ms();
|
|
124: 9c df rcall .-200 ; 0x5e <lcd_5ms>
|
|
126: 08 95 ret
|
|
|
|
00000128 <wait_100us>:
|
|
#include <inttypes.h>
|
|
#include <avr/io.h>
|
|
#include "lcd4.h"
|
|
|
|
void wait_100us(void){
|
|
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){
|
|
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 <wait_100us+0x2a>
|
|
i;
|
|
142: 89 81 ldd r24, Y+1 ; 0x01
|
|
#include <inttypes.h>
|
|
#include <avr/io.h>
|
|
#include "lcd4.h"
|
|
|
|
void wait_100us(void){
|
|
for (volatile uint8_t i=68;i--;i>0){
|
|
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 <wait_100us+0x1a>
|
|
i;
|
|
}
|
|
}
|
|
152: 0f 90 pop r0
|
|
154: df 91 pop r29
|
|
156: cf 91 pop r28
|
|
158: 08 95 ret
|
|
|
|
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 <lcd_write_text>:
|
|
}
|
|
}
|
|
}
|
|
|
|
void lcd_write_text(int row, int col, uint8_t text[16])
|
|
{
|
|
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){
|
|
18a: 89 2b or r24, r25
|
|
18c: 29 f0 breq .+10 ; 0x198 <lcd_write_text+0x1a>
|
|
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 <lcd_write_text+0x24>
|
|
196: 0a c0 rjmp .+20 ; 0x1ac <lcd_write_text+0x2e>
|
|
case 0:
|
|
row = line1;
|
|
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 <lcd_write_text+0x2e>
|
|
break;
|
|
case 1:
|
|
row = line2;
|
|
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;
|
|
}
|
|
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_text+0x44>
|
|
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 <lcd_write>
|
|
1c2: 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 <lcd_write_text+0x34>
|
|
if(text[i] != 0x5F){
|
|
lcd_write(row, text[i], 0+i);
|
|
}
|
|
}
|
|
}
|
|
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
|
|
|
|
000001d4 <button_clicked>:
|
|
|
|
int button_clicked(int button)
|
|
{
|
|
if(((PIND & 0x03) == button+1) != ((flags & (1<<button))>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 <flags>
|
|
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 <button_clicked+0x18>
|
|
1e8: aa 0f add r26, r26
|
|
1ea: bb 1f adc r27, r27
|
|
1ec: 8a 95 dec r24
|
|
1ee: e2 f7 brpl .-8 ; 0x1e8 <button_clicked+0x14>
|
|
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 <button_clicked+0x2c>
|
|
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 <button_clicked+0x3e>
|
|
210: e0 e0 ldi r30, 0x00 ; 0
|
|
212: 5e 17 cp r21, r30
|
|
214: 99 f0 breq .+38 ; 0x23c <button_clicked+0x68>
|
|
//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_clicked+0x5a>
|
|
//button is high -> pressed
|
|
flags |= (1<<button);
|
|
222: 84 2b or r24, r20
|
|
224: 80 93 77 00 sts 0x0077, r24 ; 0x800077 <flags>
|
|
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<<button);
|
|
22e: 80 95 com r24
|
|
230: 48 23 and r20, r24
|
|
232: 40 93 77 00 sts 0x0077, r20 ; 0x800077 <flags>
|
|
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 <main>:
|
|
TCNT1 = 63974;
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
DDRD = 0x00;
|
|
242: 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
|
|
|
|
TCCR1A = 0x00;
|
|
24c: 1f bc out 0x2f, r1 ; 47
|
|
TCCR1B = (1<<CS10) | (1<<CS12);; // Timer mode with 1024 prescaler
|
|
24e: 85 e0 ldi r24, 0x05 ; 5
|
|
250: 8e bd out 0x2e, r24 ; 46
|
|
TIMSK = (1 << TOIE1) ; // Enable timer1 overflow interrupt(TOIE1)
|
|
252: 80 e8 ldi r24, 0x80 ; 128
|
|
254: 89 bf out 0x39, r24 ; 57
|
|
sei(); // Enable global interrupts by setting global interrupt enable bit in SREG
|
|
256: 78 94 sei
|
|
// flags &= ~(1<<butt1);
|
|
// }
|
|
// }
|
|
|
|
|
|
t1[0] = counter + 48;
|
|
258: c2 e7 ldi r28, 0x72 ; 114
|
|
25a: d0 e0 ldi r29, 0x00 ; 0
|
|
|
|
|
|
/* Replace with your application code */
|
|
while (1)
|
|
{
|
|
clock_state = clock_new_state;
|
|
25c: 80 91 74 00 lds r24, 0x0074 ; 0x800074 <clock_new_state>
|
|
switch(clock_state){
|
|
260: 88 23 and r24, r24
|
|
262: 19 f0 breq .+6 ; 0x26a <main+0x28>
|
|
264: 81 30 cpi r24, 0x01 ; 1
|
|
266: 51 f0 breq .+20 ; 0x27c <main+0x3a>
|
|
268: fb cf rjmp .-10 ; 0x260 <main+0x1e>
|
|
26a: 10 92 75 00 sts 0x0075, r1 ; 0x800075 <clock_state>
|
|
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>
|
|
lcd_instruct(lcd_DISPLAY_CLEAR);
|
|
270: 81 e0 ldi r24, 0x01 ; 1
|
|
272: 36 df rcall .-404 ; 0xe0 <lcd_instruct>
|
|
//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 <clock_new_state>
|
|
|
|
break;
|
|
27a: f0 cf rjmp .-32 ; 0x25c <main+0x1a>
|
|
27c: 81 e0 ldi r24, 0x01 ; 1
|
|
27e: 80 93 75 00 sts 0x0075, r24 ; 0x800075 <clock_state>
|
|
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 <lcd_write_text>
|
|
|
|
|
|
if(button_clicked(butt1)){
|
|
290: 80 e0 ldi r24, 0x00 ; 0
|
|
292: 90 e0 ldi r25, 0x00 ; 0
|
|
294: 9f df rcall .-194 ; 0x1d4 <button_clicked>
|
|
296: 89 2b or r24, r25
|
|
298: 51 f0 breq .+20 ; 0x2ae <main+0x6c>
|
|
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 <main+0xa6>
|
|
}
|
|
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 <button_clicked>
|
|
2b4: 89 2b or r24, r25
|
|
2b6: 51 f0 breq .+20 ; 0x2cc <main+0x8a>
|
|
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 <main+0xa6>
|
|
}
|
|
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 <button_clicked>
|
|
2d2: 89 2b or r24, r25
|
|
2d4: 49 f0 breq .+18 ; 0x2e8 <main+0xa6>
|
|
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<<butt1);
|
|
// }
|
|
// }
|
|
|
|
|
|
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;
|
|
2f0: b5 cf rjmp .-150 ; 0x25c <main+0x1a>
|
|
|
|
000002f2 <_exit>:
|
|
2f2: f8 94 cli
|
|
|
|
000002f4 <__stop_program>:
|
|
2f4: ff cf rjmp .-2 ; 0x2f4 <__stop_program>
|