📄 main.lss
字号:
1ae: 0f b6 in r0, 0x3f ; 63
1b0: 0f 92 push r0
1b2: 11 24 eor r1, r1
1b4: 8f 93 push r24
1b6: 9f 93 push r25
++cnt_icp1;
1b8: 80 91 05 01 lds r24, 0x0105
1bc: 90 91 06 01 lds r25, 0x0106
1c0: 01 96 adiw r24, 0x01 ; 1
1c2: 90 93 06 01 sts 0x0106, r25
1c6: 80 93 05 01 sts 0x0105, r24
1ca: 9f 91 pop r25
1cc: 8f 91 pop r24
1ce: 0f 90 pop r0
1d0: 0f be out 0x3f, r0 ; 63
1d2: 0f 90 pop r0
1d4: 1f 90 pop r1
1d6: 18 95 reti
000001d8 <__vector_11>:
}
EMPTY_INTERRUPT(SIG_OUTPUT_COMPARE1A);
1d8: 18 95 reti
000001da <__vector_12>:
EMPTY_INTERRUPT(SIG_OUTPUT_COMPARE1B);
1da: 18 95 reti
000001dc <__vector_13>:
// T1: 精确1秒
SIGNAL(SIG_OVERFLOW1) {
1dc: 1f 92 push r1
1de: 0f 92 push r0
1e0: 0f b6 in r0, 0x3f ; 63
1e2: 0f 92 push r0
1e4: 11 24 eor r1, r1
1e6: 8f 93 push r24
1e8: 9f 93 push r25
TCNT1 = TIME1;
1ea: 80 e8 ldi r24, 0x80 ; 128
1ec: 9f e8 ldi r25, 0x8F ; 143
1ee: 90 93 85 00 sts 0x0085, r25
1f2: 80 93 84 00 sts 0x0084, r24
sample_v = cnt_icp1;
1f6: 80 91 05 01 lds r24, 0x0105
1fa: 90 91 06 01 lds r25, 0x0106
1fe: 90 93 0d 01 sts 0x010D, r25
202: 80 93 0c 01 sts 0x010C, r24
cnt_icp1 = 0;
206: 10 92 06 01 sts 0x0106, r1
20a: 10 92 05 01 sts 0x0105, r1
sample_i = cnt_int1;
20e: 80 91 0a 01 lds r24, 0x010A
212: 90 91 0b 01 lds r25, 0x010B
216: 90 93 03 01 sts 0x0103, r25
21a: 80 93 02 01 sts 0x0102, r24
cnt_int1 = 0;
21e: 10 92 0b 01 sts 0x010B, r1
222: 10 92 0a 01 sts 0x010A, r1
flag0 |= _BV(FLAG0_T1);
226: 80 91 07 01 lds r24, 0x0107
22a: 82 60 ori r24, 0x02 ; 2
22c: 80 93 07 01 sts 0x0107, r24
++cnt_t1;
230: 80 91 08 01 lds r24, 0x0108
234: 90 91 09 01 lds r25, 0x0109
238: 01 96 adiw r24, 0x01 ; 1
23a: 90 93 09 01 sts 0x0109, r25
23e: 80 93 08 01 sts 0x0108, r24
242: 9f 91 pop r25
244: 8f 91 pop r24
246: 0f 90 pop r0
248: 0f be out 0x3f, r0 ; 63
24a: 0f 90 pop r0
24c: 1f 90 pop r1
24e: 18 95 reti
00000250 <__vector_16>:
}
// T0: 刷新LED不闪烁
SIGNAL(SIG_OVERFLOW0) {
250: 1f 92 push r1
252: 0f 92 push r0
254: 0f b6 in r0, 0x3f ; 63
256: 0f 92 push r0
258: 11 24 eor r1, r1
25a: 2f 93 push r18
25c: 3f 93 push r19
25e: 4f 93 push r20
260: 5f 93 push r21
262: 6f 93 push r22
264: 7f 93 push r23
266: 8f 93 push r24
268: 9f 93 push r25
26a: af 93 push r26
26c: bf 93 push r27
26e: ef 93 push r30
270: ff 93 push r31
TCNT0 = TIME0;
272: 80 ee ldi r24, 0xE0 ; 224
274: 86 bd out 0x26, r24 ; 38
if ((bcd_buf[cnt_t0] & 0xf0) == 0) {
276: e0 91 04 01 lds r30, 0x0104
27a: ff 27 eor r31, r31
27c: e1 5f subi r30, 0xF1 ; 241
27e: fe 4f sbci r31, 0xFE ; 254
280: 80 81 ld r24, Z
282: 80 7f andi r24, 0xF0 ; 240
284: 99 f4 brne .+38 ; 0x2ac <__vector_16+0x5c>
led_putchar((bcd_buf[cnt_t0] & 0x0f), cnt_t0, 0);
286: 60 91 04 01 lds r22, 0x0104
28a: e0 91 04 01 lds r30, 0x0104
28e: ff 27 eor r31, r31
290: e1 5f subi r30, 0xF1 ; 241
292: fe 4f sbci r31, 0xFE ; 254
294: 80 81 ld r24, Z
296: 40 e0 ldi r20, 0x00 ; 0
298: 8f 70 andi r24, 0x0F ; 15
29a: 62 d0 rcall .+196 ; 0x360 <led_putchar>
}
else {
led_putchar((bcd_buf[cnt_t0] & 0x0f), cnt_t0, 1);
}
cnt_t0 = (cnt_t0 == 12) ? 0 : (cnt_t0 + 1); // 下一个位
29c: 80 91 04 01 lds r24, 0x0104
2a0: 8c 30 cpi r24, 0x0C ; 12
2a2: 99 f0 breq .+38 ; 0x2ca <__vector_16+0x7a>
2a4: 80 91 04 01 lds r24, 0x0104
2a8: 8f 5f subi r24, 0xFF ; 255
2aa: 10 c0 rjmp .+32 ; 0x2cc <__vector_16+0x7c>
2ac: 60 91 04 01 lds r22, 0x0104
2b0: e0 91 04 01 lds r30, 0x0104
2b4: ff 27 eor r31, r31
2b6: e1 5f subi r30, 0xF1 ; 241
2b8: fe 4f sbci r31, 0xFE ; 254
2ba: 80 81 ld r24, Z
2bc: 41 e0 ldi r20, 0x01 ; 1
2be: 8f 70 andi r24, 0x0F ; 15
2c0: 4f d0 rcall .+158 ; 0x360 <led_putchar>
2c2: 80 91 04 01 lds r24, 0x0104
2c6: 8c 30 cpi r24, 0x0C ; 12
2c8: 69 f7 brne .-38 ; 0x2a4 <__vector_16+0x54>
2ca: 80 e0 ldi r24, 0x00 ; 0
2cc: 80 93 04 01 sts 0x0104, r24
2d0: ff 91 pop r31
2d2: ef 91 pop r30
2d4: bf 91 pop r27
2d6: af 91 pop r26
2d8: 9f 91 pop r25
2da: 8f 91 pop r24
2dc: 7f 91 pop r23
2de: 6f 91 pop r22
2e0: 5f 91 pop r21
2e2: 4f 91 pop r20
2e4: 3f 91 pop r19
2e6: 2f 91 pop r18
2e8: 0f 90 pop r0
2ea: 0f be out 0x3f, r0 ; 63
2ec: 0f 90 pop r0
2ee: 1f 90 pop r1
2f0: 18 95 reti
000002f2 <init_display>:
void init_display(void) {
2f2: 84 b1 in r24, 0x04 ; 4
2f4: 8c 62 ori r24, 0x2C ; 44
2f6: 84 b9 out 0x04, r24 ; 4
u8_t tmp;
// I/O SPI: SD/SCLK/SS is 0 for idle!
DDRB |= (_BV(SD)|_BV(SCLK)|_BV(SS));
PORTB &= ~(_BV(SD)|_BV(SCLK));
2f8: 85 b1 in r24, 0x05 ; 5
2fa: 87 7d andi r24, 0xD7 ; 215
2fc: 85 b9 out 0x05, r24 ; 5
PORTB |= _BV(SS);
2fe: 2a 9a sbi 0x05, 2 ; 5
// SPI mode:
SPCR = (_BV(SPE)|_BV(MSTR));
300: 80 e5 ldi r24, 0x50 ; 80
302: 8c bd out 0x2c, r24 ; 44
// I/O 74HC595: latch is 0 for lock, oe is 0 for open display
DDRC |= (_BV(LATCH1)|_BV(LATCH2)|_BV(LATCH3)|_BV(OE));
304: 87 b1 in r24, 0x07 ; 7
306: 8f 60 ori r24, 0x0F ; 15
308: 87 b9 out 0x07, r24 ; 7
PORTC &= ~(_BV(LATCH1)|_BV(LATCH2)|_BV(LATCH3)|_BV(OE));
30a: 88 b1 in r24, 0x08 ; 8
30c: 80 7f andi r24, 0xF0 ; 240
30e: 88 b9 out 0x08, r24 ; 8
// I/O LED14/15/16: dark is 1
DDRC |= (_BV(LED14)|_BV(LED15));
310: 87 b1 in r24, 0x07 ; 7
312: 80 63 ori r24, 0x30 ; 48
314: 87 b9 out 0x07, r24 ; 7
PORTC |= (_BV(LED14)|_BV(LED15));
316: 88 b1 in r24, 0x08 ; 8
318: 80 63 ori r24, 0x30 ; 48
31a: 88 b9 out 0x08, r24 ; 8
DDRD |= _BV(LED16);
31c: 55 9a sbi 0x0a, 5 ; 10
PORTD |= _BV(LED16);
31e: 5d 9a sbi 0x0b, 5 ; 11
// 清显示缓冲区
for (tmp=0; tmp<13; tmp++) {
bcd_buf[tmp] = 0;
320: 10 92 0f 01 sts 0x010F, r1
324: 10 92 10 01 sts 0x0110, r1
328: 10 92 11 01 sts 0x0111, r1
32c: 10 92 12 01 sts 0x0112, r1
330: 10 92 13 01 sts 0x0113, r1
334: 10 92 14 01 sts 0x0114, r1
338: 10 92 15 01 sts 0x0115, r1
33c: 10 92 16 01 sts 0x0116, r1
340: 10 92 17 01 sts 0x0117, r1
344: 10 92 18 01 sts 0x0118, r1
348: 10 92 19 01 sts 0x0119, r1
34c: 10 92 1a 01 sts 0x011A, r1
350: 10 92 1b 01 sts 0x011B, r1
354: 08 95 ret
00000356 <display_off>:
}
return;
}
// 用于立即关闭所有显示
// 通常在掉电时节能,以便完成剩余的紧急事件。比如:写EEPROM
void display_off(void) {
356: 43 9a sbi 0x08, 3 ; 8
// 74HC595 ouput Z, display off
PORTC |= _BV(OE);
// 指示灯关闭
LED14_OFF;
358: 45 9a sbi 0x08, 5 ; 8
LED15_OFF;
35a: 44 9a sbi 0x08, 4 ; 8
LED16_OFF;
35c: 5d 9a sbi 0x0b, 5 ; 11
35e: 08 95 ret
00000360 <led_putchar>:
return;
}
// sdata: 显示的BCD码0xo~0x9
// spos: 显示位置
// spt: 0x01显示小数点,00x00不显示小数点
// 该过程主要由T0中断自动调用,也可以外部使用
void led_putchar(u8_t sdata, u8_t spos, u8_t spt) {
360: 43 9a sbi 0x08, 3 ; 8
// 以下参看硬件原理图:操作LED14/15/16
// 74HC595 ouput Z, display off
PORTC |= _BV(OE);
// SPI send out LED segment code,如果该位显示小数点:led_data[i] |= 0x01;
SPDR = (pgm_read_byte(&led_seg[sdata]) | spt);
362: e8 2f mov r30, r24
364: ff 27 eor r31, r31
366: ec 5c subi r30, 0xCC ; 204
368: ff 4f sbci r31, 0xFF ; 255
36a: e4 91 lpm r30, Z
36c: e4 2b or r30, r20
36e: ee bd out 0x2e, r30 ; 46
while (!(SPSR & _BV(SPIF)));
370: 0d b4 in r0, 0x2d ; 45
372: 07 fe sbrs r0, 7
374: fd cf rjmp .-6 ; 0x370 <led_putchar+0x10>
PORTC |= _BV(LATCH1);
376: 41 9a sbi 0x08, 1 ; 8
PORTC &= ~_BV(LATCH1);
378: 41 98 cbi 0x08, 1 ; 8
// select need of LED0-4
SPDR = (spos > 6) ? 0x00 : pgm_read_byte(&led_select[spos]);
37a: 67 30 cpi r22, 0x07 ; 7
37c: a8 f0 brcs .+42 ; 0x3a8 <led_putchar+0x48>
37e: 80 e0 ldi r24, 0x00 ; 0
380: 8e bd out 0x2e, r24 ; 46
while (!(SPSR & _BV(SPIF)));
382: 0d b4 in r0, 0x2d ; 45
384: 07 fe sbrs r0, 7
386: fd cf rjmp .-6 ; 0x382 <led_putchar+0x22>
PORTC |= _BV(LATCH2);
388: 40 9a sbi 0x08, 0 ; 8
PORTC &= ~_BV(LATCH2);
38a: 40 98 cbi 0x08, 0 ; 8
// select need of LED5-12
SPDR = (spos > 6) ? pgm_read_byte(&led_select[spos]) : 0x00;
38c: 67 30 cpi r22, 0x07 ; 7
38e: 30 f4 brcc .+12 ; 0x39c <led_putchar+0x3c>
390: 60 e0 ldi r22, 0x00 ; 0
392: 6e bd out 0x2e, r22 ; 46
while (!(SPSR & _BV(SPIF)));
394: 0d b4 in r0, 0x2d ; 45
396: 07 fe sbrs r0, 7
398: fd cf rjmp .-6 ; 0x394 <led_putchar+0x34>
39a: 0c c0 rjmp .+24 ; 0x3b4 <led_putchar+0x54>
39c: e6 2f mov r30, r22
39e: ff 27 eor r31, r31
3a0: ec 5b subi r30, 0xBC ; 188
3a2: ff 4f sbci r31, 0xFF ; 255
3a4: 64 91 lpm r22, Z
3a6: f5 cf rjmp .-22 ; 0x392 <led_putchar+0x32>
3a8: e6 2f mov r30, r22
3aa: ff 27 eor r31, r31
3ac: ec 5b subi r30, 0xBC ; 188
3ae: ff 4f sbci r31, 0xFF ; 255
3b0: 84 91 lpm r24, Z
3b2: e6 cf rjmp .-52 ; 0x380 <led_putchar+0x20>
PORTC |= _BV(LATCH3);
3b4: 42 9a sbi 0x08, 2 ; 8
PORTC &= ~_BV(LATCH3);
3b6: 42 98 cbi 0x08, 2 ; 8
// 74HC595 ouput enable, display on
PORTC &= ~_BV(OE);
3b8: 43 98 cbi 0x08, 3 ; 8
3ba: 08 95 ret
000003bc <htobcd8>:
return ;
}
// buff: BCD的数据指针,指向8单元的数组
// pdata: 数据最大99999999
// 转换正确返回: 1
u8_t htobcd8(u8_t *buff, u32_t pdata) {
3bc: ef 92 push r14
3be: ff 92 push r15
3c0: 0f 93 push r16
3c2: 1f 93 push r17
3c4: cf 93 push r28
3c6: df 93 push r29
3c8: ec 01 movw r28, r24
3ca: 7a 01 movw r14, r20
3cc: 8b 01 movw r16, r22
if (pdata > 99999999) {
3ce: 40 30 cpi r20, 0x00 ; 0
3d0: 81 ee ldi r24, 0xE1 ; 225
3d2: 58 07 cpc r21, r24
3d4: 85 ef ldi r24, 0xF5 ; 245
3d6: 68 07 cpc r22, r24
3d8: 85 e0 ldi r24, 0x05 ; 5
3da: 78 07 cpc r23, r24
3dc: 08 f0 brcs .+2 ; 0x3e0 <htobcd8+0x24>
3de: 6d c0 rjmp .+218 ; 0x4ba <htobcd8+0xfe>
return 0;
}
else {
buff[0]= pdata/10000000; // BCD码第8位
3e0: cb 01 movw r24, r22
3e2: ba 01 movw r22, r20
3e4: 20 e8 ldi r18, 0x80 ; 128
3e6: 36 e9 ldi r19, 0x96 ; 150
3e8: 48 e9 ldi r20, 0x98 ; 152
3ea: 50 e0 ldi r21, 0x00 ; 0
3ec: 62 d4 rcall .+2244 ; 0xcb2 <__udivmodsi4>
3ee: 28 83 st Y, r18
pdata %= 10000000;
3f0: c8 01 movw r24, r16
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -