📄 1602_main.s
字号:
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall cmp32f
brge X11
xjmp L67
X11:
.dbline 133
; {
.dbline 134
; LCD_write_char(1,0,'U');
ldi R24,85
std y+0,R24
clr R18
ldi R16,1
xcall _LCD_write_char
.dbline 135
; LCD_write_char(2,0,'=');
ldi R24,61
std y+0,R24
clr R18
ldi R16,2
xcall _LCD_write_char
.dbline 136
; LCD_write_num(3,0,(disp_num2*100)/100);
ldi R16,<L73
ldi R17,>L73
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
lds R4,_disp_num2+2
lds R5,_disp_num2+2+1
lds R2,_disp_num2
lds R3,_disp_num2+1
st -y,R5
st -y,R4
st -y,R3
st -y,R2
xcall empy32fs
ldi R16,<L73
ldi R17,>L73
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall div32f
movw R30,R28
std z+1,R16
std z+2,R17
std z+3,R18
std z+4,R19
movw R30,R28
ldd R2,z+1
ldd R3,z+2
ldd R4,z+3
ldd R5,z+4
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L74
ldi R17,>L74
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall cmp32f
brlt L71
movw R30,R28
ldd R2,z+1
ldd R3,z+2
ldd R4,z+3
ldd R5,z+4
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L74
ldi R17,>L74
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall sub32f
xcall fp2int
movw R20,R16
subi R20,0 ; offset = 32768
sbci R21,128
xjmp L72
L71:
movw R30,R28
ldd R16,z+1
ldd R17,z+2
ldd R18,z+3
ldd R19,z+4
xcall fp2int
movw R20,R16
L72:
std y+0,R20
clr R18
ldi R16,3
xcall _LCD_write_num
.dbline 137
; LCD_write_char(4,0,'.');
ldi R24,46
std y+0,R24
clr R18
ldi R16,4
xcall _LCD_write_char
.dbline 138
; LCD_write_num(5,0,(int)(disp_num2*10)%10);
ldi R16,<L75
ldi R17,>L75
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
lds R4,_disp_num2+2
lds R5,_disp_num2+2+1
lds R2,_disp_num2
lds R3,_disp_num2+1
st -y,R5
st -y,R4
st -y,R3
st -y,R2
xcall empy32f
xcall fp2int
ldi R18,10
ldi R19,0
xcall mod16s
std y+0,R16
clr R18
ldi R16,5
xcall _LCD_write_num
.dbline 139
; LCD_write_num(6,0,(int)(disp_num2*100)%10);
ldi R16,<L73
ldi R17,>L73
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
lds R4,_disp_num2+2
lds R5,_disp_num2+2+1
lds R2,_disp_num2
lds R3,_disp_num2+1
st -y,R5
st -y,R4
st -y,R3
st -y,R2
xcall empy32f
xcall fp2int
ldi R18,10
ldi R19,0
xcall mod16s
std y+0,R16
clr R18
ldi R16,6
xcall _LCD_write_num
.dbline 140
; LCD_write_char(7,0,'V');
ldi R24,86
std y+0,R24
clr R18
ldi R16,7
xcall _LCD_write_char
.dbline 142
;
; }
xjmp L68
L67:
.dbline 143
; else if( disp_num2<1&&disp_num2>=0.1)
lds R4,_disp_num2+2
lds R5,_disp_num2+2+1
lds R2,_disp_num2
lds R3,_disp_num2+1
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L70
ldi R17,>L70
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall cmp32f
brlt X12
xjmp L76
X12:
lds R4,_disp_num2+2
lds R5,_disp_num2+2+1
lds R2,_disp_num2
lds R3,_disp_num2+1
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L78
ldi R17,>L78
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall cmp32f
brge X13
xjmp L76
X13:
.dbline 144
; {
.dbline 145
; LCD_write_char(1,0,'U');
ldi R24,85
std y+0,R24
clr R18
ldi R16,1
xcall _LCD_write_char
.dbline 146
; LCD_write_char(2,0,'=');
ldi R24,61
std y+0,R24
clr R18
ldi R16,2
xcall _LCD_write_char
.dbline 147
; LCD_write_num(3,0,0);
clr R2
std y+0,R2
clr R18
ldi R16,3
xcall _LCD_write_num
.dbline 148
; LCD_write_char(4,0,'.');
ldi R24,46
std y+0,R24
clr R18
ldi R16,4
xcall _LCD_write_char
.dbline 149
; LCD_write_num(5,0,(disp_num2*100)/10);
ldi R16,<L73
ldi R17,>L73
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
lds R4,_disp_num2+2
lds R5,_disp_num2+2+1
lds R2,_disp_num2
lds R3,_disp_num2+1
st -y,R5
st -y,R4
st -y,R3
st -y,R2
xcall empy32fs
ldi R16,<L75
ldi R17,>L75
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall div32f
movw R30,R28
std z+1,R16
std z+2,R17
std z+3,R18
std z+4,R19
movw R30,R28
ldd R2,z+1
ldd R3,z+2
ldd R4,z+3
ldd R5,z+4
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L74
ldi R17,>L74
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall cmp32f
brlt L79
movw R30,R28
ldd R2,z+1
ldd R3,z+2
ldd R4,z+3
ldd R5,z+4
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L74
ldi R17,>L74
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall sub32f
xcall fp2int
movw R20,R16
subi R20,0 ; offset = 32768
sbci R21,128
xjmp L80
L79:
movw R30,R28
ldd R16,z+1
ldd R17,z+2
ldd R18,z+3
ldd R19,z+4
xcall fp2int
movw R20,R16
L80:
std y+0,R20
clr R18
ldi R16,5
xcall _LCD_write_num
.dbline 150
; LCD_write_num(6,0,(int)(disp_num2*100)%10);
ldi R16,<L73
ldi R17,>L73
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
lds R4,_disp_num2+2
lds R5,_disp_num2+2+1
lds R2,_disp_num2
lds R3,_disp_num2+1
st -y,R5
st -y,R4
st -y,R3
st -y,R2
xcall empy32f
xcall fp2int
ldi R18,10
ldi R19,0
xcall mod16s
std y+0,R16
clr R18
ldi R16,6
xcall _LCD_write_num
.dbline 151
; LCD_write_char(7,0,'V');
ldi R24,86
std y+0,R24
clr R18
ldi R16,7
xcall _LCD_write_char
.dbline 152
; }
xjmp L77
L76:
.dbline 153
; else if( disp_num2<0.1)
lds R4,_disp_num2+2
lds R5,_disp_num2+2+1
lds R2,_disp_num2
lds R3,_disp_num2+1
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L78
ldi R17,>L78
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall cmp32f
brlt X14
xjmp L81
X14:
.dbline 154
; {
.dbline 155
; LCD_write_char(1,0,'U');
ldi R24,85
std y+0,R24
clr R18
ldi R16,1
xcall _LCD_write_char
.dbline 156
; LCD_write_char(2,0,'=');
ldi R24,61
std y+0,R24
clr R18
ldi R16,2
xcall _LCD_write_char
.dbline 157
; LCD_write_num(3,0,0);
clr R2
std y+0,R2
clr R18
ldi R16,3
xcall _LCD_write_num
.dbline 158
; LCD_write_char(4,0,'.');
ldi R24,46
std y+0,R24
clr R18
ldi R16,4
xcall _LCD_write_char
.dbline 159
; LCD_write_num(5,0,0);
clr R2
std y+0,R2
clr R18
ldi R16,5
xcall _LCD_write_num
.dbline 160
; LCD_write_num(6,0,(disp_num2*100)/10);
ldi R16,<L73
ldi R17,>L73
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
lds R4,_disp_num2+2
lds R5,_disp_num2+2+1
lds R2,_disp_num2
lds R3,_disp_num2+1
st -y,R5
st -y,R4
st -y,R3
st -y,R2
xcall empy32fs
ldi R16,<L75
ldi R17,>L75
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall div32f
movw R30,R28
std z+1,R16
std z+2,R17
std z+3,R18
std z+4,R19
movw R30,R28
ldd R2,z+1
ldd R3,z+2
ldd R4,z+3
ldd R5,z+4
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L74
ldi R17,>L74
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall cmp32f
brlt L83
movw R30,R28
ldd R2,z+1
ldd R3,z+2
ldd R4,z+3
ldd R5,z+4
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L74
ldi R17,>L74
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall sub32f
xcall fp2int
movw R20,R16
subi R20,0 ; offset = 32768
sbci R21,128
xjmp L84
L83:
movw R30,R28
ldd R16,z+1
ldd R17,z+2
ldd R18,z+3
ldd R19,z+4
xcall fp2int
movw R20,R16
L84:
std y+0,R20
clr R18
ldi R16,6
xcall _LCD_write_num
.dbline 161
; LCD_write_char(7,0,'V');
ldi R24,86
std y+0,R24
clr R18
ldi R16,7
xcall _LCD_write_char
.dbline 162
; }
L81:
L77:
L68:
.dbline -2
L66:
adiw R28,5
xcall pop_gset1
.dbline 0 ; func end
ret
.dbend
.dbfunc e main _main fV
; p -> <dead>
; i -> <dead>
; time_s -> R20,R21
.even
_main::
sbiw R28,2
.dbline -1
.dbline 164
; }
; void main(void) {
.dbline 168
; unsigned char i;
; unsigned char *p;
; int time_s;
; PORTB = 0xFF; /*电平设置*/
ldi R24,255
out 0x18,R24
.dbline 169
; DDRB = 0xFF; /*方向输出*/
out 0x17,R24
.dbline 171
;
; PORTA = 0xFF;
out 0x1b,R24
.dbline 172
; DDRA = 0xFF;
out 0x1a,R24
.dbline 173
; delay_ms(100);
ldi R16,100
ldi R17,0
xcall _delay_ms
.dbline 175
;
; LCD_init();
xcall _LCD_init
.dbline 178
;
;
; time_s=0;
clr R20
clr R21
.dbline 180
;
; delay_ms(500);
ldi R16,500
ldi R17,1
xcall _delay_ms
.dbline 181
; LCD_clear();
xcall _LCD_clear
xjmp L87
L86:
.dbline 182
; while (1) {
.dbline 183
; key=get_key();
xcall _get_key
mov R2,R16
clr R3
sts _key+1,R3
sts _key,R2
.dbline 186
;
;
; switch(key)
movw R24,R2
cpi R24,1
ldi R30,0
cpc R25,R30
breq L91
cpi R24,2
ldi R30,0
cpc R25,R30
brne X17
xjmp L94
X17:
cpi R24,3
ldi R30,0
cpc R25,R30
brne X18
xjmp L96
X18:
cpi R24,4
ldi R30,0
cpc R25,R30
brne X19
xjmp L97
X19:
cpi R24,5
ldi R30,0
cpc R25,R30
brne X20
xjmp L98
X20:
cpi R24,6
ldi R30,0
cpc R25,R30
brne X21
xjmp L99
X21:
cpi R24,7
ldi R30,0
cpc R25,R30
brne X22
xjmp L100
X22:
cpi R24,8
ldi R30,0
cpc R25,R30
brne X23
xjmp L101
X23:
cpi R24,9
ldi R30,0
cpc R25,R30
brne X24
xjmp L102
X24:
xjmp L89
X15:
.dbline 187
; {
L91:
.dbline 189
; case 1:
; time_s=1;
ldi R20,1
ldi R21,0
.dbline 190
; LCD_clear();
xcall _LCD_clear
.dbline 191
; LCD_write_str(6,6,"start...");
ldi R24,<L92
ldi R25,>L92
std y+1,R25
std y+0,R24
ldi R18,6
ldi R16,6
xcall _LCD_write_str
.dbline 192
; delay_ms(500);
ldi R16,500
ldi R17,1
xcall _delay_ms
.dbline 193
; LCD_clear();
xcall _LCD_clear
.dbline 194
; disp_num1=get_ad();
xcall _get_ad
sts _disp_num1+1,R17
sts _disp_num1,R16
.dbline 195
; disp_num2=disp_num1*0.00322;
ldi R16,<L93
ldi R17,>L93
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
lds R16,_disp_num1
lds R17,_disp_num1+1
xcall int2fp
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall empy32f
sts _disp_num2+1,R17
sts _disp_num2,R16
sts _disp_num2+2+1,R19
sts _disp_num2+2,R18
.dbline 196
; lcd_process();
xcall _lcd_process
.dbline 199
;
;
; break;
xjmp L90
L94:
.dbline 202
;
; case 2:
; time_s=2;
ldi R20,2
ldi R21,0
.dbline 203
; LCD_clear();
xcall _LCD_clear
.dbline 204
; LCD_write_str(4,4,"over...");
ldi R24,<L95
ldi R25,>L95
std y+1,R25
std y+0,R24
ldi R18,4
ldi R16,4
xcall _LCD_write_str
.dbline 205
; delay_ms(500);
ldi R16,500
ldi R17,1
xcall _delay_ms
.dbline 206
; LCD_clear();
xcall _LCD_clear
.dbline 207
; break;
xjmp L90
L96:
.dbline 210
;
; case 3:
; time_s=3;
ldi R20,3
ldi R21,0
.dbline 211
; break;
xjmp L90
L97:
.dbline 213
; case 4:
; time_s=4;
ldi R20,4
ldi R21,0
.dbline 214
; break;
xjmp L90
L98:
.dbline 216
; case 5:
; time_s=5;
ldi R20,5
ldi R21,0
.dbline 217
; break;
xjmp L90
L99:
.dbline 220
;
; case 6:
; time_s=6;
ldi R20,6
ldi R21,0
.dbline 221
; break;
xjmp L90
L100:
.dbline 224
;
; case 7:
; time_s=7;
ldi R20,7
ldi R21,0
.dbline 225
; break;
xjmp L90
L101:
.dbline 227
; case 8:
; time_s=8;
ldi R20,8
ldi R21,0
.dbline 228
; break;
xjmp L90
L102:
.dbline 230
; case 9:
; time_s=9;
ldi R20,9
ldi R21,0
.dbline 231
; break;
L89:
L90:
.dbline 241
L87:
.dbline 182
xjmp L86
X16:
.dbline -2
L85:
adiw R28,2
.dbline 0 ; func end
ret
.dbsym l p 3 pc
.dbsym l i 3 c
.dbsym r time_s 20 I
.dbend
.area bss(ram, con, rel)
.dbfile F:\tem\1602AN~1\1602_main.c
_disp_num2::
.blkb 4
.dbsym e disp_num2 _disp_num2 D
_disp_num1::
.blkb 2
.dbsym e disp_num1 _disp_num1 I
_key::
.blkb 2
.dbsym e key _key I
.area data(ram, con, rel)
.dbfile F:\tem\1602AN~1\1602_main.c
L95:
.blkb 8
.area idata
.byte 'o,'v,'e,'r,46,46,46,0
.area data(ram, con, rel)
.dbfile F:\tem\1602AN~1\1602_main.c
.area lit(rom, con, rel)
L93:
.word 0x6a3,0x3b53
.area data(ram, con, rel)
.dbfile F:\tem\1602AN~1\1602_main.c
L92:
.blkb 9
.area idata
.byte 's,'t,'a,'r,'t,46,46,46,0
.area data(ram, con, rel)
.dbfile F:\tem\1602AN~1\1602_main.c
.area lit(rom, con, rel)
L78:
.word 0xcccd,0x3dcc
L75:
.word 0x0,0x4120
L74:
.word 0x0,0x4700
L73:
.word 0x0,0x42c8
L70:
.word 0x0,0x3f80
L69:
.word 0x3333,0x4053
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -