📄 led.s
字号:
ldi R17,>L29
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall cmp32f
brlt L37
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,<L29
ldi R17,>L29
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall sub32f
xcall fp2int
movw R24,R16
subi R24,0 ; offset = 32768
sbci R25,128
movw R10,R24
xjmp L38
L37:
movw R30,R28
ldd R16,z+0
ldd R17,z+1
ldd R18,z+2
ldd R19,z+3
xcall fp2int
movw R10,R16
L38:
mov R20,R10
.dbline 153
; display_one(3,temp);
mov R18,R20
ldi R16,3
xcall _display_one
.dbline 154
; led_port |= 0x80; //点亮对应小数点
sbi 0x1b,7
.dbline 155
; delay_ms(6);
ldi R16,6
ldi R17,0
xcall _delay_ms
.dbline 156
; led_contrl_port &=~ (1<<3);
cbi 0x18,3
.dbline 158
; //第一位小数
; temp2=(data*10);
ldi R16,<L28
ldi R17,>L28
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
movw R30,R28
; stack offset 4
ldd R2,z+26
ldd R3,z+27
ldd R4,z+28
ldd R5,z+29
st -y,R5
st -y,R4
st -y,R3
st -y,R2
xcall empy32f
movw R30,R28
std z+4,R16
std z+5,R17
std z+6,R18
std z+7,R19
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,<L29
ldi R17,>L29
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall cmp32f
brlt L39
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,<L29
ldi R17,>L29
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall sub32f
xcall fp2int
movw R24,R16
subi R24,0 ; offset = 32768
sbci R25,128
movw R10,R24
xjmp L40
L39:
movw R30,R28
ldd R16,z+4
ldd R17,z+5
ldd R18,z+6
ldd R19,z+7
xcall fp2int
movw R10,R16
L40:
movw R22,R10
.dbline 159
; temp=temp2%10; // 1.234*10%10 = 2
ldi R18,10
ldi R19,0
movw R16,R22
xcall mod16u
mov R20,R16
.dbline 160
; display_one(2,temp);
mov R18,R20
ldi R16,2
xcall _display_one
.dbline 161
; delay_ms(6);
ldi R16,6
ldi R17,0
xcall _delay_ms
.dbline 162
; led_contrl_port &=~ (1<<2);
cbi 0x18,2
.dbline 164
; //第二位小数
; temp2=(data*100);
ldi R16,<L32
ldi R17,>L32
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
movw R30,R28
; stack offset 4
ldd R2,z+26
ldd R3,z+27
ldd R4,z+28
ldd R5,z+29
st -y,R5
st -y,R4
st -y,R3
st -y,R2
xcall empy32f
movw R30,R28
std z+8,R16
std z+9,R17
std z+10,R18
std z+11,R19
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,<L29
ldi R17,>L29
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall cmp32f
brlt L41
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,<L29
ldi R17,>L29
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall sub32f
xcall fp2int
movw R24,R16
subi R24,0 ; offset = 32768
sbci R25,128
movw R10,R24
xjmp L42
L41:
movw R30,R28
ldd R16,z+8
ldd R17,z+9
ldd R18,z+10
ldd R19,z+11
xcall fp2int
movw R10,R16
L42:
movw R22,R10
.dbline 165
; temp=temp2%10; // 1.234*100%10 = 3
ldi R18,10
ldi R19,0
movw R16,R22
xcall mod16u
mov R20,R16
.dbline 166
; display_one(1,temp);
mov R18,R20
ldi R16,1
xcall _display_one
.dbline 167
; delay_ms(6);
ldi R16,6
ldi R17,0
xcall _delay_ms
.dbline 168
; led_contrl_port &=~ (1<<1);
cbi 0x18,1
.dbline 170
; //第三位小数
; temp2=(data*1000);
ldi R16,<L19
ldi R17,>L19
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
movw R30,R28
; stack offset 4
ldd R2,z+26
ldd R3,z+27
ldd R4,z+28
ldd R5,z+29
st -y,R5
st -y,R4
st -y,R3
st -y,R2
xcall empy32f
movw R30,R28
std z+12,R16
std z+13,R17
std z+14,R18
std z+15,R19
movw R30,R28
ldd R2,z+12
ldd R3,z+13
ldd R4,z+14
ldd R5,z+15
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L29
ldi R17,>L29
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall cmp32f
brlt L43
movw R30,R28
ldd R2,z+12
ldd R3,z+13
ldd R4,z+14
ldd R5,z+15
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L29
ldi R17,>L29
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall sub32f
xcall fp2int
movw R24,R16
subi R24,0 ; offset = 32768
sbci R25,128
movw R10,R24
xjmp L44
L43:
movw R30,R28
ldd R16,z+12
ldd R17,z+13
ldd R18,z+14
ldd R19,z+15
xcall fp2int
movw R10,R16
L44:
movw R22,R10
.dbline 171
; temp=temp2%10; // 1.234*1000%10 = 4
ldi R18,10
ldi R19,0
movw R16,R22
xcall mod16u
mov R20,R16
.dbline 172
; display_one(0,temp);
mov R18,R20
clr R16
xcall _display_one
.dbline 173
; delay_ms(6);
ldi R16,6
ldi R17,0
xcall _delay_ms
.dbline 174
; led_contrl_port &=~ (1<<0);
cbi 0x18,0
.dbline 175
; }
xjmp L36
L35:
.dbline 176
; else if(data<100) // 例如12.34
movw R30,R28
ldd R2,z+22
ldd R3,z+23
ldd R4,z+24
ldd R5,z+25
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L32
ldi R17,>L32
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall cmp32f
brlt X2
xjmp L45
X2:
.dbline 177
; {
.dbline 178
; temp2=data;
movw R30,R28
ldd R2,z+22
ldd R3,z+23
ldd R4,z+24
ldd R5,z+25
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L29
ldi R17,>L29
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall cmp32f
brlt L47
movw R30,R28
ldd R2,z+22
ldd R3,z+23
ldd R4,z+24
ldd R5,z+25
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L29
ldi R17,>L29
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall sub32f
xcall fp2int
movw R24,R16
subi R24,0 ; offset = 32768
sbci R25,128
movw R10,R24
xjmp L48
L47:
movw R30,R28
ldd R16,z+22
ldd R17,z+23
ldd R18,z+24
ldd R19,z+25
xcall fp2int
movw R10,R16
L48:
movw R22,R10
.dbline 179
; temp=(temp2/10); // 12.34/10=1
ldi R18,10
ldi R19,0
movw R16,R22
xcall div16u
mov R20,R16
.dbline 180
; display_one(3,temp);
mov R18,R20
ldi R16,3
xcall _display_one
.dbline 181
; delay_ms(6);
ldi R16,6
ldi R17,0
xcall _delay_ms
.dbline 182
; led_contrl_port &=~ (1<<3);
cbi 0x18,3
.dbline 184
;
; temp2=data;
movw R30,R28
ldd R2,z+22
ldd R3,z+23
ldd R4,z+24
ldd R5,z+25
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L29
ldi R17,>L29
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall cmp32f
brlt L49
movw R30,R28
ldd R2,z+22
ldd R3,z+23
ldd R4,z+24
ldd R5,z+25
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L29
ldi R17,>L29
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall sub32f
xcall fp2int
movw R24,R16
subi R24,0 ; offset = 32768
sbci R25,128
movw R10,R24
xjmp L50
L49:
movw R30,R28
ldd R16,z+22
ldd R17,z+23
ldd R18,z+24
ldd R19,z+25
xcall fp2int
movw R10,R16
L50:
movw R22,R10
.dbline 185
; temp=(temp2%10); // 12.34%10=2
ldi R18,10
ldi R19,0
movw R16,R22
xcall mod16u
mov R20,R16
.dbline 186
; display_one(2,temp);
mov R18,R20
ldi R16,2
xcall _display_one
.dbline 187
; led_port |= 0x80; //点亮对应小数点
sbi 0x1b,7
.dbline 188
; delay_ms(6);
ldi R16,6
ldi R17,0
xcall _delay_ms
.dbline 189
; led_contrl_port &=~ (1<<2);
cbi 0x18,2
.dbline 191
;
; temp2=(data*10);
ldi R16,<L28
ldi R17,>L28
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
movw R30,R28
; stack offset 4
ldd R2,z+26
ldd R3,z+27
ldd R4,z+28
ldd R5,z+29
st -y,R5
st -y,R4
st -y,R3
st -y,R2
xcall empy32f
movw R30,R28
std z+0,R16
std z+1,R17
std z+2,R18
std z+3,R19
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,<L29
ldi R17,>L29
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall cmp32f
brlt L51
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,<L29
ldi R17,>L29
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall sub32f
xcall fp2int
movw R24,R16
subi R24,0 ; offset = 32768
sbci R25,128
movw R10,R24
xjmp L52
L51:
movw R30,R28
ldd R16,z+0
ldd R17,z+1
ldd R18,z+2
ldd R19,z+3
xcall fp2int
movw R10,R16
L52:
movw R22,R10
.dbline 192
; temp=temp2%10; // 12.34*10%10=3
ldi R18,10
ldi R19,0
movw R16,R22
xcall mod16u
mov R20,R16
.dbline 193
; display_one(1,temp);
mov R18,R20
ldi R16,1
xcall _display_one
.dbline 194
; delay_ms(6);
ldi R16,6
ldi R17,0
xcall _delay_ms
.dbline 195
; led_contrl_port &=~ (1<<1);
cbi 0x18,1
.dbline 197
;
; temp2=(data*100);
ldi R16,<L32
ldi R17,>L32
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
movw R30,R28
; stack offset 4
ldd R2,z+26
ldd R3,z+27
ldd R4,z+28
ldd R5,z+29
st -y,R5
st -y,R4
st -y,R3
st -y,R2
xcall empy32f
movw R30,R28
std z+4,R16
std z+5,R17
std z+6,R18
std z+7,R19
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,<L29
ldi R17,>L29
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall cmp32f
brlt L53
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,<L29
ldi R17,>L29
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall sub32f
xcall fp2int
movw R24,R16
subi R24,0 ; offset = 32768
sbci R25,128
movw R10,R24
xjmp L54
L53:
movw R30,R28
ldd R16,z+4
ldd R17,z+5
ldd R18,z+6
ldd R19,z+7
xcall fp2int
movw R10,R16
L54:
movw R22,R10
.dbline 198
; temp=temp2%10;// 12.34*100%10=4
ldi R18,10
ldi R19,0
movw R16,R22
xcall mod16u
mov R20,R16
.dbline 199
; display_one(0,temp);
mov R18,R20
clr R16
xcall _display_one
.dbline 200
; delay_ms(6);
ldi R16,6
ldi R17,0
xcall _delay_ms
.dbline 201
; led_contrl_port &=~ (1<<0);
cbi 0x18,0
.dbline 202
; }
xjmp L46
L45:
.dbline 203
; else if(data<1000) //比如123.4
movw R30,R28
ldd R2,z+22
ldd R3,z+23
ldd R4,z+24
ldd R5,z+25
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L19
ldi R17,>L19
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall cmp32f
brlt X3
xjmp L55
X3:
.dbline 204
; {
.dbline 205
; temp2=data;
movw R30,R28
ldd R2,z+22
ldd R3,z+23
ldd R4,z+24
ldd R5,z+25
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L29
ldi R17,>L29
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall cmp32f
brlt L57
movw R30,R28
ldd R2,z+22
ldd R3,z+23
ldd R4,z+24
ldd R5,z+25
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L29
ldi R17,>L29
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall sub32f
xcall fp2int
movw R24,R16
subi R24,0 ; offset = 32768
sbci R25,128
movw R10,R24
xjmp L58
L57:
movw R30,R28
ldd R16,z+22
ldd R17,z+23
ldd R18,z+24
ldd R19,z+25
xcall fp2int
movw R10,R16
L58:
movw R22,R10
.dbline 206
; temp=(temp2/100);// 123.4/100=1
ldi R18,100
ldi R19,0
movw R16,R22
xcall div16u
mov R20,R16
.dbline 207
; display_one(3,temp);
mov R18,R20
ldi R16,3
xcall _display_one
.dbline 208
; delay_ms(6);
ldi R16,6
ldi R17,0
xcall _delay_ms
.dbline 209
; led_contrl_port &=~ (1<<3);
cbi 0x18,3
.dbline 211
;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -