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