📄 m16_int.lss
字号:
M16_INT.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 000001b6 00000000 00000000 00000074 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .bss 00000001 00800060 00800060 0000022a 2**0
ALLOC
2 .debug_aranges 00000020 00000000 00000000 0000022a 2**0
CONTENTS, READONLY, DEBUGGING
3 .debug_pubnames 00000057 00000000 00000000 0000024a 2**0
CONTENTS, READONLY, DEBUGGING
4 .debug_info 00000296 00000000 00000000 000002a1 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_abbrev 00000131 00000000 00000000 00000537 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_line 000002ba 00000000 00000000 00000668 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_frame 00000060 00000000 00000000 00000924 2**2
CONTENTS, READONLY, DEBUGGING
8 .debug_str 000000cc 00000000 00000000 00000984 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_loc 000000a0 00000000 00000000 00000a50 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_ranges 000000d8 00000000 00000000 00000af0 2**0
CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:
00000000 <__vectors>:
0: 0c 94 2a 00 jmp 0x54 ; 0x54 <__ctors_end>
4: 0c 94 bb 00 jmp 0x176 ; 0x176 <__vector_1>
8: 0c 94 ca 00 jmp 0x194 ; 0x194 <__vector_2>
c: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
10: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
14: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
18: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
1c: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
20: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
24: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
28: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
2c: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
30: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
34: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
38: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
3c: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
40: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
44: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
48: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
4c: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
50: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
00000054 <__ctors_end>:
54: 11 24 eor r1, r1
56: 1f be out 0x3f, r1 ; 63
58: cf e5 ldi r28, 0x5F ; 95
5a: d4 e0 ldi r29, 0x04 ; 4
5c: de bf out 0x3e, r29 ; 62
5e: cd bf out 0x3d, r28 ; 61
00000060 <__do_copy_data>:
60: 10 e0 ldi r17, 0x00 ; 0
62: a0 e6 ldi r26, 0x60 ; 96
64: b0 e0 ldi r27, 0x00 ; 0
66: e6 eb ldi r30, 0xB6 ; 182
68: f1 e0 ldi r31, 0x01 ; 1
6a: 02 c0 rjmp .+4 ; 0x70 <.do_copy_data_start>
0000006c <.do_copy_data_loop>:
6c: 05 90 lpm r0, Z+
6e: 0d 92 st X+, r0
00000070 <.do_copy_data_start>:
70: a0 36 cpi r26, 0x60 ; 96
72: b1 07 cpc r27, r17
74: d9 f7 brne .-10 ; 0x6c <.do_copy_data_loop>
00000076 <__do_clear_bss>:
76: 10 e0 ldi r17, 0x00 ; 0
78: a0 e6 ldi r26, 0x60 ; 96
7a: b0 e0 ldi r27, 0x00 ; 0
7c: 01 c0 rjmp .+2 ; 0x80 <.do_clear_bss_start>
0000007e <.do_clear_bss_loop>:
7e: 1d 92 st X+, r1
00000080 <.do_clear_bss_start>:
80: a1 36 cpi r26, 0x61 ; 97
82: b1 07 cpc r27, r17
84: e1 f7 brne .-8 ; 0x7e <.do_clear_bss_loop>
86: 0e 94 87 00 call 0x10e ; 0x10e <main>
8a: 0c 94 d9 00 jmp 0x1b2 ; 0x1b2 <_exit>
0000008e <__bad_interrupt>:
8e: 0c 94 00 00 jmp 0 ; 0x0 <__vectors>
00000092 <LED_1>:
volatile uint8 g_key = 0; // 与中断相关的变量,还是加一个volatile比较好
void LED_1(void)
{
DDRA |= (1<<LED0);
92: d0 9a sbi 0x1a, 0 ; 26
94: 28 e8 ldi r18, 0x88 ; 136
96: 33 e1 ldi r19, 0x13 ; 19
milliseconds can be achieved.
*/
void
_delay_loop_2(uint16_t __count)
{
__asm__ volatile (
98: 48 eb ldi r20, 0xB8 ; 184
9a: 50 e0 ldi r21, 0x00 ; 0
9c: 05 c0 rjmp .+10 ; 0xa8 <LED_1+0x16>
__ticks = (uint16_t) (__ms * 10.0);
while(__ticks)
{
// wait 1/10 ms
_delay_loop_2(((F_CPU) / 4e3) / 10);
__ticks --;
9e: ca 01 movw r24, r20
a0: 01 97 sbiw r24, 0x01 ; 1
a2: f1 f7 brne .-4 ; 0xa0 <LED_1+0xe>
a4: 21 50 subi r18, 0x01 ; 1
a6: 30 40 sbci r19, 0x00 ; 0
__ticks = 1;
else if (__tmp > 65535)
{
// __ticks = requested delay in 1/10 ms
__ticks = (uint16_t) (__ms * 10.0);
while(__ticks)
a8: 21 15 cp r18, r1
aa: 31 05 cpc r19, r1
ac: c1 f7 brne .-16 ; 0x9e <LED_1+0xc>
while (1)
{
_delay_ms(500);
PORTA |= (1<<LED0);
ae: d8 9a sbi 0x1b, 0 ; 27
b0: 88 e8 ldi r24, 0x88 ; 136
b2: 93 e1 ldi r25, 0x13 ; 19
b4: fa 01 movw r30, r20
b6: 31 97 sbiw r30, 0x01 ; 1
b8: f1 f7 brne .-4 ; 0xb6 <LED_1+0x24>
{
// wait 1/10 ms
_delay_loop_2(((F_CPU) / 4e3) / 10);
__ticks --;
ba: 01 97 sbiw r24, 0x01 ; 1
__ticks = 1;
else if (__tmp > 65535)
{
// __ticks = requested delay in 1/10 ms
__ticks = (uint16_t) (__ms * 10.0);
while(__ticks)
bc: d9 f7 brne .-10 ; 0xb4 <LED_1+0x22>
_delay_ms(500);
PORTA &= ~(1<<LED0);
be: d8 98 cbi 0x1b, 0 ; 27
if (g_key) // 由于这是一个死循环,故要置一跳出语句,
c0: 80 91 60 00 lds r24, 0x0060
c4: 88 23 and r24, r24
c6: 19 f4 brne .+6 ; 0xce <LED_1+0x3c>
break; // 下面调用前先将g_key清零,出现中断后其值不为零,故跳出
c8: 28 e8 ldi r18, 0x88 ; 136
ca: 33 e1 ldi r19, 0x13 ; 19
cc: e8 cf rjmp .-48 ; 0x9e <LED_1+0xc>
ce: 08 95 ret
000000d0 <LED_2>:
}
}
void LED_2(void)
{
DDRA |= (1<<LED1);
d0: d1 9a sbi 0x1a, 1 ; 26
d2: 20 ed ldi r18, 0xD0 ; 208
d4: 37 e0 ldi r19, 0x07 ; 7
d6: 48 eb ldi r20, 0xB8 ; 184
d8: 50 e0 ldi r21, 0x00 ; 0
da: 05 c0 rjmp .+10 ; 0xe6 <LED_2+0x16>
{
// wait 1/10 ms
_delay_loop_2(((F_CPU) / 4e3) / 10);
__ticks --;
dc: ca 01 movw r24, r20
de: 01 97 sbiw r24, 0x01 ; 1
e0: f1 f7 brne .-4 ; 0xde <LED_2+0xe>
e2: 21 50 subi r18, 0x01 ; 1
e4: 30 40 sbci r19, 0x00 ; 0
__ticks = 1;
else if (__tmp > 65535)
{
// __ticks = requested delay in 1/10 ms
__ticks = (uint16_t) (__ms * 10.0);
while(__ticks)
e6: 21 15 cp r18, r1
e8: 31 05 cpc r19, r1
ea: c1 f7 brne .-16 ; 0xdc <LED_2+0xc>
while (1)
{
_delay_ms(200);
PORTA |= (1<<LED1);
ec: d9 9a sbi 0x1b, 1 ; 27
ee: 80 ed ldi r24, 0xD0 ; 208
f0: 97 e0 ldi r25, 0x07 ; 7
f2: fa 01 movw r30, r20
f4: 31 97 sbiw r30, 0x01 ; 1
f6: f1 f7 brne .-4 ; 0xf4 <LED_2+0x24>
{
// wait 1/10 ms
_delay_loop_2(((F_CPU) / 4e3) / 10);
__ticks --;
f8: 01 97 sbiw r24, 0x01 ; 1
__ticks = 1;
else if (__tmp > 65535)
{
// __ticks = requested delay in 1/10 ms
__ticks = (uint16_t) (__ms * 10.0);
while(__ticks)
fa: d9 f7 brne .-10 ; 0xf2 <LED_2+0x22>
_delay_ms(200);
PORTA &= ~(1<<LED1);
fc: d9 98 cbi 0x1b, 1 ; 27
if (g_key) // 由于这是一个死循环,故要置一跳出语句,
fe: 80 91 60 00 lds r24, 0x0060
102: 88 23 and r24, r24
104: 19 f4 brne .+6 ; 0x10c <LED_2+0x3c>
break; // 下面调用前先将g_key清零,出现中断后其值不为零,故跳出
106: 20 ed ldi r18, 0xD0 ; 208
108: 37 e0 ldi r19, 0x07 ; 7
10a: e8 cf rjmp .-48 ; 0xdc <LED_2+0xc>
10c: 08 95 ret
0000010e <main>:
}
}
int main(void)
{
10e: 1f 93 push r17
110: cf 93 push r28
112: df 93 push r29
DDRD &= ~((1<<KEY0) | (1<<KEY1));
114: 81 b3 in r24, 0x11 ; 17
116: 83 7f andi r24, 0xF3 ; 243
118: 81 bb out 0x11, r24 ; 17
PORTD |= (1<<KEY0) | (1<<KEY1);
11a: 82 b3 in r24, 0x12 ; 18
11c: 8c 60 ori r24, 0x0C ; 12
11e: 82 bb out 0x12, r24 ; 18
DDRA |= (1<<LED0) | (1<<LED1);
120: 8a b3 in r24, 0x1a ; 26
122: 83 60 ori r24, 0x03 ; 3
124: 8a bb out 0x1a, r24 ; 26
// MCUCR |= (1<<ISC01) | (1<<ISC11); // 都是下降沿触发
MCUCR |= (1<<ISC01) | (1<<ISC11) | (1<<ISC10); // INT0下降沿,INT1上升沿,可在仿真中看出其方式的差别
126: 85 b7 in r24, 0x35 ; 53
128: 8e 60 ori r24, 0x0E ; 14
12a: 85 bf out 0x35, r24 ; 53
GICR = (1<<INT0) | (1<<INT1); // 允许两个中断
12c: 80 ec ldi r24, 0xC0 ; 192
12e: 8b bf out 0x3b, r24 ; 59
sei();
130: 78 94 sei
DDRB = 0xff;
132: 8f ef ldi r24, 0xFF ; 255
134: 87 bb out 0x17, r24 ; 23
DDRC = 0xff;
136: 84 bb out 0x14, r24 ; 20
while(1)
{
PORTC = 0xff;
138: 1f ef ldi r17, 0xFF ; 255
13a: c8 eb ldi r28, 0xB8 ; 184
13c: d0 e0 ldi r29, 0x00 ; 0
13e: 15 bb out 0x15, r17 ; 21
PORTB = 0xff;
140: 18 bb out 0x18, r17 ; 24
142: 80 e1 ldi r24, 0x10 ; 16
144: 97 e2 ldi r25, 0x27 ; 39
146: fe 01 movw r30, r28
148: 31 97 sbiw r30, 0x01 ; 1
14a: f1 f7 brne .-4 ; 0x148 <main+0x3a>
{
// wait 1/10 ms
_delay_loop_2(((F_CPU) / 4e3) / 10);
__ticks --;
14c: 01 97 sbiw r24, 0x01 ; 1
__ticks = 1;
else if (__tmp > 65535)
{
// __ticks = requested delay in 1/10 ms
__ticks = (uint16_t) (__ms * 10.0);
while(__ticks)
14e: d9 f7 brne .-10 ; 0x146 <main+0x38>
_delay_ms(1000);
PORTC = 0x00;
150: 15 ba out 0x15, r1 ; 21
PORTB = 0x00;
152: 18 ba out 0x18, r1 ; 24
switch(g_key)
154: 80 91 60 00 lds r24, 0x0060
158: 81 30 cpi r24, 0x01 ; 1
15a: 19 f0 breq .+6 ; 0x162 <main+0x54>
15c: 82 30 cpi r24, 0x02 ; 2
15e: 79 f7 brne .-34 ; 0x13e <main+0x30>
160: 05 c0 rjmp .+10 ; 0x16c <main+0x5e>
{
case 1: g_key = 0;
162: 10 92 60 00 sts 0x0060, r1
LED_1();
166: 0e 94 49 00 call 0x92 ; 0x92 <LED_1>
16a: e9 cf rjmp .-46 ; 0x13e <main+0x30>
break;
case 2: g_key = 0;
16c: 10 92 60 00 sts 0x0060, r1
LED_2();
170: 0e 94 68 00 call 0xd0 ; 0xd0 <LED_2>
174: e4 cf rjmp .-56 ; 0x13e <main+0x30>
00000176 <__vector_1>:
//////////////new OK too
ISR(INT0_vect)
{
176: 1f 92 push r1
178: 0f 92 push r0
17a: 0f b6 in r0, 0x3f ; 63
17c: 0f 92 push r0
17e: 11 24 eor r1, r1
180: 8f 93 push r24
g_key = 1;
182: 81 e0 ldi r24, 0x01 ; 1
184: 80 93 60 00 sts 0x0060, r24
}
188: 8f 91 pop r24
18a: 0f 90 pop r0
18c: 0f be out 0x3f, r0 ; 63
18e: 0f 90 pop r0
190: 1f 90 pop r1
192: 18 95 reti
00000194 <__vector_2>:
ISR(INT1_vect)
{
194: 1f 92 push r1
196: 0f 92 push r0
198: 0f b6 in r0, 0x3f ; 63
19a: 0f 92 push r0
19c: 11 24 eor r1, r1
19e: 8f 93 push r24
g_key = 2;
1a0: 82 e0 ldi r24, 0x02 ; 2
1a2: 80 93 60 00 sts 0x0060, r24
}
1a6: 8f 91 pop r24
1a8: 0f 90 pop r0
1aa: 0f be out 0x3f, r0 ; 63
1ac: 0f 90 pop r0
1ae: 1f 90 pop r1
1b0: 18 95 reti
000001b2 <_exit>:
1b2: f8 94 cli
000001b4 <__stop_program>:
1b4: ff cf rjmp .-2 ; 0x1b4 <__stop_program>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -