📄 zuhe.s
字号:
ldi R24,255
out 0x17,R24
.dbline 162
; //init_wdt();
; SEI();
sei
.dbline 163
; init_adc();
rcall _init_adc
.dbline 164
; LcdInit();
rcall _LcdInit
.dbline 165
; LcdClr();
rcall _LcdClr
rjmp L33
L32:
.dbline 168
;
; while(1)
; { delay(10000);
.dbline 168
ldi R16,10000
ldi R17,39
rcall _delay
.dbline 169
; WDR();
wdr
.dbline 170
; init_adc();
rcall _init_adc
.dbline 172
; //LcdClr();
; ADCSRA|=(1<<ADSC);
sbi 0x6,6
L35:
.dbline 173
L36:
.dbline 173
; while(ADCSRA&(1<<ADIF));
sbic 0x6,4
rjmp L35
.dbline 174
; readadc();
rcall _readadc
.dbline 175
; ADCSRA|=(1<<ADIF);
sbi 0x6,4
.dbline 176
; datax=(datah<<8)+datal;
lds R2,_datal
lds R3,_datah
sts _datax+1,R3
sts _datax,R2
.dbline 177
; ADCSRA&=~(1<<ADEN);
cbi 0x6,7
.dbline 178
; v=(float)datax/0x3ff*2.56;
ldi R16,<L38
ldi R17,>L38
rcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
ldi R16,<L39
ldi R17,>L39
rcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
lds R16,_datax
lds R17,_datax+1
lsr R17
ror R16
rcall int2fp
st -y,R19
st -y,R18
st -y,R17
st -y,R16
rcall empy32fs
lds R16,_datax
lds R17,_datax+1
andi R16,1
andi R17,0
rcall int2fp
st -y,R19
st -y,R18
st -y,R17
st -y,R16
rcall add32fs
ldi R16,<L40
ldi R17,>L40
rcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
rcall div32fs
rcall empy32f
sts _v+1,R17
sts _v,R16
sts _v+2+1,R19
sts _v+2,R18
.dbline 179
; W=(float)v*v;
st -y,R19
st -y,R18
st -y,R17
st -y,R16
st -y,R19
st -y,R18
st -y,R17
st -y,R16
rcall empy32f
sts _W+1,R17
sts _W,R16
sts _W+2+1,R19
sts _W+2,R18
.dbline 180
; w1=(uint)W;
st -y,R19
st -y,R18
st -y,R17
st -y,R16
ldi R16,<L43
ldi R17,>L43
rcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
rcall cmp32f
brlt L41
lds R4,_W+2
lds R5,_W+2+1
lds R2,_W
lds R3,_W+1
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L43
ldi R17,>L43
rcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
rcall sub32f
rcall fp2int
movw R24,R16
subi R24,0 ; offset = 32768
sbci R25,128
movw R10,R24
rjmp L42
L41:
lds R18,_W+2
lds R19,_W+2+1
lds R16,_W
lds R17,_W+1
rcall fp2int
movw R10,R16
L42:
sts _w1,R10
.dbline 181
; w2=(uint)((W-w1)*10);
ldi R16,<L46
ldi R17,>L46
rcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
lds R4,_W+2
lds R5,_W+2+1
lds R2,_W
lds R3,_W+1
st -y,R5
st -y,R4
st -y,R3
st -y,R2
lds R16,_w1
clr R17
rcall int2fp
st -y,R19
st -y,R18
st -y,R17
st -y,R16
rcall sub32fs
rcall empy32f
movw R30,R28
std z+0,R16
std z+1,R17
std z+2,R18
std z+3,R19
ldd R2,z+0
ldd R3,z+1
ldd R4,z+2
ldd R5,z+3
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L43
ldi R17,>L43
rcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
rcall cmp32f
brlt L44
movw R30,R28
ldd R2,z+0
ldd R3,z+1
ldd R4,z+2
ldd R5,z+3
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L43
ldi R17,>L43
rcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
rcall sub32f
rcall fp2int
movw R24,R16
subi R24,0 ; offset = 32768
sbci R25,128
movw R10,R24
rjmp L45
L44:
movw R30,R28
ldd R16,z+0
ldd R17,z+1
ldd R18,z+2
ldd R19,z+3
rcall fp2int
movw R10,R16
L45:
sts _w2,R10
.dbline 182
; w3=(uint)((W-w1-w2/10)*100);
ldi R16,<L49
ldi R17,>L49
rcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
lds R4,_W+2
lds R5,_W+2+1
lds R2,_W
lds R3,_W+1
st -y,R5
st -y,R4
st -y,R3
st -y,R2
lds R16,_w1
clr R17
rcall int2fp
st -y,R19
st -y,R18
st -y,R17
st -y,R16
rcall sub32fs
ldi R18,10
ldi R19,0
lds R16,_w2
clr R17
rcall div16s
rcall int2fp
st -y,R19
st -y,R18
st -y,R17
st -y,R16
rcall sub32fs
rcall empy32f
movw R30,R28
std z+4,R16
std z+5,R17
std z+6,R18
std z+7,R19
ldd R2,z+4
ldd R3,z+5
ldd R4,z+6
ldd R5,z+7
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L43
ldi R17,>L43
rcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
rcall cmp32f
brlt L47
movw R30,R28
ldd R2,z+4
ldd R3,z+5
ldd R4,z+6
ldd R5,z+7
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L43
ldi R17,>L43
rcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
rcall sub32f
rcall fp2int
movw R24,R16
subi R24,0 ; offset = 32768
sbci R25,128
movw R10,R24
rjmp L48
L47:
movw R30,R28
ldd R16,z+4
ldd R17,z+5
ldd R18,z+6
ldd R19,z+7
rcall fp2int
movw R10,R16
L48:
sts _w3,R10
.dbline 183
; w4=(uint)((W-w1-w2/10-w3/100)*1000);
ldi R16,<L52
ldi R17,>L52
rcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
lds R4,_W+2
lds R5,_W+2+1
lds R2,_W
lds R3,_W+1
st -y,R5
st -y,R4
st -y,R3
st -y,R2
lds R16,_w1
clr R17
rcall int2fp
st -y,R19
st -y,R18
st -y,R17
st -y,R16
rcall sub32fs
ldi R18,10
ldi R19,0
lds R16,_w2
clr R17
rcall div16s
rcall int2fp
st -y,R19
st -y,R18
st -y,R17
st -y,R16
rcall sub32fs
ldi R18,100
ldi R19,0
lds R16,_w3
clr R17
rcall div16s
rcall int2fp
st -y,R19
st -y,R18
st -y,R17
st -y,R16
rcall sub32fs
rcall empy32f
movw R30,R28
std z+8,R16
std z+9,R17
std z+10,R18
std z+11,R19
ldd R2,z+8
ldd R3,z+9
ldd R4,z+10
ldd R5,z+11
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L43
ldi R17,>L43
rcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
rcall cmp32f
brlt L50
movw R30,R28
ldd R2,z+8
ldd R3,z+9
ldd R4,z+10
ldd R5,z+11
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L43
ldi R17,>L43
rcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
rcall sub32f
rcall fp2int
movw R24,R16
subi R24,0 ; offset = 32768
sbci R25,128
movw R10,R24
rjmp L51
L50:
movw R30,R28
ldd R16,z+8
ldd R17,z+9
ldd R18,z+10
ldd R19,z+11
rcall fp2int
movw R10,R16
L51:
sts _w4,R10
.dbline 184
ldi R18,1
ldi R16,5
rcall _LcdXY
.dbline 185
ldi R16,500
ldi R17,1
rcall _delay
.dbline 186
lds R24,_w1
subi R24,208 ; addi 48
sts _d+2,R24
.dbline 187
lds R24,_w2
subi R24,208 ; addi 48
sts _d+4,R24
.dbline 188
lds R24,_w3
subi R24,208 ; addi 48
sts _d+5,R24
.dbline 189
lds R24,_w4
subi R24,208 ; addi 48
sts _d+6,R24
.dbline 190
ldi R16,500
ldi R17,1
rcall _delay
.dbline 191
ldi R16,<_d
ldi R17,>_d
rcall _LcdStr
.dbline 192
L33:
.dbline 167
rjmp L32
X1:
.dbline -2
.dbline 193
; LcdXY(5,1);
; delay(500);
; d[2]=0x30+w1;
; d[4]=0x30+w2;
; d[5]=0x30+w3;
; d[6]=0x30+w4;
; delay(500);
; LcdStr(d);
; }
; }
L31:
adiw R28,12
.dbline 0 ; func end
ret
.dbend
.area bss(ram, con, rel)
.dbfile zuhe.c
_W::
.blkb 4
.dbsym e W _W D
_v::
.blkb 4
.dbsym e v _v D
_w4::
.blkb 1
.dbsym e w4 _w4 c
_w3::
.blkb 1
.dbsym e w3 _w3 c
_w2::
.blkb 1
.dbsym e w2 _w2 c
_w1::
.blkb 1
.dbsym e w1 _w1 c
_i::
.blkb 1
.dbsym e i _i c
_a::
.blkb 3
.dbsym e a _a A[3:3]c
_datal::
.blkb 1
.dbsym e datal _datal c
_K::
.blkb 1
.dbsym e K _K c
_datah::
.blkb 1
.dbsym e datah _datah c
_x::
.blkb 1
.dbsym e x _x c
_datax::
.blkb 2
.dbsym e datax _datax i
.area lit(rom, con, rel)
L52:
.word 0x0,0x447a
L49:
.word 0x0,0x42c8
L46:
.word 0x0,0x4120
L43:
.word 0x0,0x4700
L40:
.word 0xc000,0x447f
L39:
.word 0x0,0x4000
L38:
.word 0xd70a,0x4023
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -