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